Skip to content

authGuard does not validate JWT stellarAddress against DB user #114

Description

@DeFiVC

Problem

In src/middleware/auth.ts lines 16-32, the auth guard loads the user by decoded.sub (user ID) and sets authUser.stellarAddress from the database record. However, it never validates that decoded.stellarAddress (from the JWT) matches user.stellarAddress.

While JWT forgery is prevented by the secret, this means the stellarAddress claim in the JWT is effectively ignored. If the JWT signing key were ever compromised, an attacker could craft tokens for any user ID without the stellarAddress check providing any validation.

Fix

Validate decoded.stellarAddress === user.stellarAddress.

Severity

Low — defense-in-depth gap

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Stellar WaveIssues in the Stellar wave program

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions