Skip to content

[Backend] backend/src/types/auth.types.ts JWT payload type does not include an issuer or audience claim #1097

Description

@grantfox-oss

Join our community: https://t.me/+DOylgFv1jyJlNzM0

Why this matters

backend/src/types/auth.types.ts defines the shape of the JWT payload issued by middleware/auth.ts. Without iss/aud claims, a token minted for this API could theoretically be replayed against another service sharing the same signing secret, and there's no defense-in-depth check that a token was actually issued for this API.

Acceptance criteria

  • Add iss and aud fields to the payload type and to token issuance
  • Verify iss/aud on token verification, rejecting mismatches
  • Add a test for a token with a wrong audience being rejected

Files to touch

  • backend/src/types/auth.types.ts
  • backend/src/middleware/auth.ts

Out of scope

  • Rotating the JWT signing secret
  • Multi-tenant token scoping

Metadata

Metadata

Assignees

Labels

GrantFox OSSIssue tracked in GrantFox OSSMaybe RewardedIssue may be eligible for a GrantFox rewardOfficial Campaign | FWC26Campaign: Official Campaign | FWC26Stellar WaveIssues in the Stellar wave programbackendBackend related taskssecuritySecurity related tasks

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions