fix: enforce JWT wallet ownership in claims and policy controllers#140
Merged
nonsobethel0-dev merged 1 commit intoJun 27, 2026
Conversation
…arashield-Protocol#85 Parashield-Protocol#86 Parashield-Protocol#87 Parashield-Protocol#88) Parashield-Protocol#85 — submitClaim: replace `req.wallet || dto.claimant` with the JWT-verified wallet (`req.user?.walletAddress || req.wallet`); return 403 when dto.claimant differs from the authenticated wallet, eliminating BOLA. Parashield-Protocol#86 — getClaimsByWalletQuery: ownership check now reads from req.user?.walletAddress instead of req.wallet (header-auth only), so JWT-authenticated callers cannot enumerate another wallet's claim history. Parashield-Protocol#87 — getPolicy: added @UseGuards(JwtAuthGuard) + ownership check comparing policyData.policyholder against the authenticated wallet; returns 403 on mismatch. Unauthenticated clients can no longer enumerate policy PII by UUID (IDOR). Parashield-Protocol#88 — confirmPolicy: added wallet-match guard (dto.walletAddress vs req.user?.walletAddress); returns 403 when a JWT user submits on behalf of another wallet. Same req.user?.walletAddress pattern applied consistently across getClaim, getClaimHistory, getMyPolicies, and buyPolicy for defence-in-depth.
|
@Gbangbolaoluwagbemiga 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
Fixes four BOLA/IDOR vulnerabilities where JWT-authenticated callers could act on behalf of arbitrary wallets by supplying a different wallet in the request body or query param.
submitClaim: usereq.user?.walletAddressas authoritative wallet; return403whendto.claimantdiffers.getClaimsByWalletQuery: ownership check now reads fromreq.user?.walletAddressinstead ofreq.wallet(which is only set by Ed25519 header middleware), closing the JWT bypass.getPolicy: added@UseGuards(JwtAuthGuard)+ ownership check againstpolicyData.policyholder; unauthenticated IDOR access to policy PII is blocked.confirmPolicy: comparedto.walletAddressagainstreq.user?.walletAddress; returns403when a JWT user submits on behalf of another wallet.Same
req.user?.walletAddress || req.walletpattern applied consistently togetClaim,getClaimHistory,getMyPolicies, andbuyPolicyfor defence-in-depth.Closes #85
Closes #86
Closes #87
Closes #88