Skip to content

JWT assertion jti leaves the replay cache before the assertion expires #1877

Open

Description

@SudoThijn

JwtAuthService::verifyAssertion() stores a used assertion's jti for ACCESS_TOKEN_TTL (300s) from now (lib/Service/JwtAuthService.php:205). JwtAssertionVerifier accepts an iat up to CLOCK_SKEW_SECONDS (60s) in the future, with exp - iat ≤ 300 (lib/Service/JwtAssertionVerifier.php:193-200).

An assertion minted with iat = now + 60 and exp = now + 360 therefore stays valid until about now + 360s, while its jti leaves the cache at now + 300s.

Impact: anyone holding a captured assertion can exchange it a second time in that ~60s gap (POST /api/v1/token, ApplicationTokenController::exchange()) and get a fresh 300s access token. Deactivating the application still stops it.

Fix: cache the jti until the assertion's own expiry plus skew, for example max(1, (int)$claims['exp'] - time() + self::CLOCK_SKEW_SECONDS). Add a test that replays an iat = now + 60, exp = now + 360 assertion after 300s and expects the replay refusal.

Activity

  1. added
    bugSomething isn't working
    phpPull requests that update php code
    securityA user can read or write what they must not
    on Nov 17, 2026
  2. github-actions commented on Nov 17, 2026

    @github-actions
    Contributor

    Thank you for opening this issue! It has been assigned to @rubenvdlinde for review.

    What happens next:

    1. A maintainer will review this issue and determine the appropriate action
    2. If accepted, it may be converted into an OpenSpec change for structured development
    3. You will be notified of any status changes

    Triage labels:

    • triage:accept-feature — accepted as a new feature
    • triage:accept-bugfix — accepted as a bug fix
    • triage:needs-info — more information needed
    • triage:wontfix — will not be addressed
    • triage:duplicate — duplicate of another issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingphpPull requests that update php codesecurityA user can read or write what they must nottriageAwaiting triage

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions