fix(security): wire CORS config and add Ed25519 signature auth for cancel, accept, fill, and solver registration (#39 #40 #41 #42) - #166
Open
meetdarc-tech wants to merge 1 commit into
Conversation
|
@meetdarc-tech Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
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.
Summary
This PR resolves four issues spanning a dead CORS configuration and a class of authorization bypass vulnerabilities across intent cancellation, solver accept/fill, and solver registration.
Issue #39 — Wire CORS_ORIGIN config into the app
Problem: \CORS_ORIGIN\ was fully defined and Joi-validated in \env.validation.ts\ and mapped into \AppConfig.corsOrigin, but \�ootstrap()\ in \src/main.ts\ never called \�pp.enableCors(). The config was completely dead — the browser same-origin policy applied regardless of what was set in the environment.
Changes:
Issue #40 — Add signature verification for intent cancellation
Problem: \IntentsController.cancel()\ only compared \intent.user !== dto.user\ as a plain string check against a client-supplied field. Anyone who knew a user's Stellar address could cancel their intent by simply including it in the request body — a real authorization bypass, not just hardening.
Changes:
Issue #41 — Add signature verification for solver accept/fill
Problem: Same class of bug as #40 but for solvers: \�ccept()\ and \ill()\ trusted the raw \solver\ field in the request body with no proof the caller controlled that solver's keypair. Any client could impersonate any registered solver.
Changes:
Issue #42 — Add authentication to solver registration
Problem: \SolversService.register()\ existed but had no controller endpoint — entirely unreachable. When the endpoint is added it must not allow anyone to claim an arbitrary address and bond amount without proof of key ownership.
Changes:
egister:) before delegating to \SolversService.register(). Solvers default to \isActive: false\ pending bond escrow verification (ties to Instrument the sweeper with duration and expired-count metrics #96)
Shared infrastructure
*\src/common/stellar-signature.ts* — new helper module, single source of truth for all signature logic across the codebase:
*\src/solvers/solvers.seed.ts* — seed solvers now use real Stellar keypairs (generated via \Keypair.random()) so signature verification works end-to-end in tests. Secrets and keypairs are exported as \SEED_SOLVER_SECRETS\ / \SEED_SOLVER_KEYPAIRS\ for use by tests and the solver-bot demo.
Tests
All existing e2e tests updated to use real Stellar keypairs and properly signed requests:
Result: 27/27 e2e tests pass. \ sc --noEmit\ exits 0.
est build\ is clean.
Breaking changes
closes #39
closes #40
closes #41
closes #42