Skip to content

JWT Parsing Failure - potential Base64 encoding issue #7461

@lbusch25

Description

@lbusch25

Branch/Environment/Version

  • Branch/Version: Release v5.9.0, pulled in as part of the v4.0.0 helm chart
  • Environment: On-prem hosting

Describe the bug
Upon upgrading to v5.9.0, our JWT fails to parse (we use Keycloak as our IDP and JWT provider, if needed for replication). Reverting to v5.8.6 solves the issue and the JWT parses as expected.

Messages from Tyk, in order:

  • level=error msg="Couldn't get token" error="illegal base64 data at input byte 5" mw="JWTMiddleware"
  • level=info msg="Attempted JWT access with non-existent key." mw=JWTMiddleware
  • `level=error msg="JWT validation error" error=illegal base64 data at input byte 5"

Nothing in our environment has changed besides the Tyk helm chart, and associated Tyk version, upgrade. We've also managed to reproduce this issue with helm chart v3.0.0 and bumping Tyk to v5.9.0.

Reproduction steps
Steps to reproduce the behavior:

  1. Add api using JWT based authentication
  2. Add Security Policy
  3. Send request to API

Actual behavior
JWT fails to parse. Reverting to v5.8.6 resolves the issue.

Expected behavior
JWT parses as expected.

Configuration (tyk config file):

api-config.json

security-policy-config.json

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions