Skip to content

[security] - JWT does not check Issuer/Audience binding (omits context validation) #91

Open

Description

@shieldx-bot
  • Description: ValidateToken function only checks signing method and expiry date; does not bind Issuer/Audience to expected value → can accept tokens valid for signature but issued from other issuers.

  • Location: pkg/auth/jwt_manager.go and shared/shieldx-common/pkg/auth/jwt_manager.go (function ValidateToken).

  • Suggestion: Use parser with strict option: jwt.NewParser(jwt.WithValidMethods(["RS256"]), jwt.WithIssuer(expectedIssuer), jwt.WithAudience(expectedAud)); after parsing, check claims.Issuer, claims.Audience, claims.Subject according to config; consider kid rotation and JWKS.

  • Complete when: Unit test wrong token issuer/audience is rejected; issuer/audience configuration exists via environment variable/secret.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedExtra attention is neededsecuritysystem security vulnerabilities

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions