feat: secure wallet endpoints with JWT authentication - #165
Open
davedumto wants to merge 2 commits into
Open
Conversation
Apply jwtMiddleware to all /wallet/* routes via index.ts and add it explicitly to POST /wallet/create. Reject mismatched JWT/body user_id with HTTP 403 on /wallet/create. Add tests covering missing JWT (401), mismatched user_id (403), and the existing happy-path cases now that JWT identity is asserted.
stellar contract build requires overflow-checks to be enabled in the release profile to prevent silent integer overflow in Soroban contracts. Added the missing [profile.release] section to kyc-kyb-contract/Cargo.toml. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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 #136
Summary
Apply JWT authentication to the wallet endpoints in
services/stellar-wallet, as specified in the issue.Changes
src/index.ts: MountjwtMiddlewareon/wallet/*so every wallet endpoint requires a valid JWT.src/routes/wallet.ts: AddjwtMiddlewaretoPOST /wallet/createexplicitly (matches the per-route pattern already used by/wallet/sendand/wallet/transactions/:user_id) and reject mismatched JWT vs. bodyuser_idwith HTTP 403{ error: 'Forbidden' }. Missing/invalid tokens continue to return HTTP 401 fromjwtMiddleware.tests/routes/wallet.test.ts: Add tests for the newPOST /wallet/createaccess control:user_id-> 403user_id-> 201 (existing case)The existing 400/500 tests are updated to set
AUTH_USER_IDto match the request body so they still exercise the post-auth branches.Verification
Locally in
services/stellar-wallet:npx tsc --noEmitcleannpm run lintcleannpx prettier --check .cleanNODE_ENV=test npx jest --no-coverage-> 107/107 passing (27/27 inwallet.test.ts)CI is the source of truth on this repo.
Notes
feat/secure-wallet-endpoints-jwtbecause the originally-specifiedfeat/secure-wallet-endpointsbranch name already exists on my fork from a prior closed PR (Feat/secure wallet endpoints #156). The commit message is the lowercasefeat:style required by the issue.jwtMiddlewarefromsrc/auth/jwt.ts(added in implement jwt authentication #159) - no new auth framework introduced.