Skip to content

feat(relay): reserve nonces and validate signed submissions - #1208

Closed
nasirudeenbadirudeen87-cloud wants to merge 4 commits into
accesslayerorg:mainfrom
nasirudeenbadirudeen87-cloud:fix/issue-1088
Closed

nasirudeenbadirudeen87-cloud wants to merge 4 commits into
accesslayerorg:mainfrom
nasirudeenbadirudeen87-cloud:fix/issue-1088

Conversation

@nasirudeenbadirudeen87-cloud

@nasirudeenbadirudeen87-cloud nasirudeenbadirudeen87-cloud commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

Closes #1088

Adds /relay/nonce/:wallet and /relay/submit for signed Stellar submissions. A nonce is the wallet's next on-chain sequence, represented as a decimal string and reserved in Redis for five minutes. Both endpoints share an atomic rolling limit of ten requests per wallet per minute.

Submission validates the wallet checksum, source account, sequence, and detached Ed25519 signature before atomically claiming the reservation. Concurrent/replayed submissions fail with 409. Failed or uncertain submissions stay claimed until expiry. Fully sponsored fee-bump envelopes are supported without mutating their inner signatures, preserving the fee sponsor's signature. Callers provide the sponsored envelope; the server does not generate a fee sponsor or use a new signing secret.

The existing contract service performs submission, retries, persistence, confirmation, and events under operation relay. Confirmed submissions return tx_hash; failures expose sanitized error details. Redis unavailability fails closed. The API contract, signing order, expiry/retry behavior, and deployment requirements are documented in docs/relay.md.

Preserved the supplied branch's existing relay work and merged current upstream before completing validation and hardening.

Validation:

  • pnpm lint: passed.
  • pnpm build: passed.
  • Prisma client generation: passed.
  • pnpm test --runInBand --testPathPatterns='relay|contract.service.test|nonce.service': 3 suites, 37 tests passed, including 15 new relay HTTP tests.
  • Prettier on relay files/docs; git diff --check: passed.
  • Tests cover next nonce, large sequence precision, expiry, actual cryptographic signature checks, forged signatures, mismatches, concurrent submits/replay, uncertain failures, next-sequence advancement, rolling rate limits, Redis absence, malformed payloads, and sponsored fee-bump signature preservation.

Limits: tests mock Redis and Horizon/the shared contract-service boundary. No live Redis, PostgreSQL, funded wallet, or on-chain submission was used. Existing contract-service tests cover the persistence/submission boundary with mocks. The full repository test suite was not run.

Source, install hooks, workflows, and complete PR diff reviewed for PolinRider indicators and exposed credentials; no suspicious payload found in these changes. The existing upstream malware workflow is malformed (control characters and unindented multiline shell strings) and did not produce a scan run for this PR. It is unchanged here; local review did not rely on that workflow. Server CI passed, including verify and invoice-protocol jobs.

@Chucks1093

Copy link
Copy Markdown
Member

🚨 Automated Security Alert

This PR has been automatically closed by the PR monitor because it contains code patterns associated with the PolinRider malware campaign.

Detected indicators may include:

  • Obfuscated payloads hidden after long whitespace in config files
  • eval() or spawn() calls in config files
  • VS Code auto-task on folder open (runOn: folderOpen)
  • Suspicious font files or dist/setup.js loader
  • Known PolinRider marker strings

Please do not reopen this PR or run the code locally. If you believe this is a false positive, contact a maintainer directly.

@Chucks1093 Chucks1093 closed this Oct 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add nonce generation endpoint for gasless meta-transaction relay flow

2 participants