Repository navigation
feat(relay): reserve nonces and validate signed submissions - #1208
Closed
nasirudeenbadirudeen87-cloud wants to merge 4 commits into
Closed
nasirudeenbadirudeen87-cloud wants to merge 4 commits into
nasirudeenbadirudeen87-cloud wants to merge 4 commits into
Conversation
Member
🚨 Automated Security AlertThis PR has been automatically closed by the PR monitor because it contains code patterns associated with the PolinRider malware campaign. Detected indicators may include:
Please do not reopen this PR or run the code locally. If you believe this is a false positive, contact a maintainer directly. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #1088
Adds
/relay/nonce/:walletand/relay/submitfor 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 returntx_hash; failures expose sanitized error details. Redis unavailability fails closed. The API contract, signing order, expiry/retry behavior, and deployment requirements are documented indocs/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.pnpm test --runInBand --testPathPatterns='relay|contract.service.test|nonce.service': 3 suites, 37 tests passed, including 15 new relay HTTP tests.git diff --check: passed.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.