Skip to content

Tokens outlive the absolute session lifetime: the session start is the time of the authorize request #3205

Open

Description

@pournasserian

What happens

fcms_session_start, which the token endpoint compares with AbsoluteSessionLifetime before it rotates a refresh token, is set to the time of the authorize request (ConnectEndpoints.cs, MemberConnect.cs: .SetClaim(TokenClaims.SessionStart, now.ToUnixTimeSeconds())), not to the time of the sign-in that the request rode on. A code flow made late in a sign-in therefore gets a full lifetime of its own.

The second review of #3199 probed it: lifetime 8 h, sign in, code flow at 7 h; at 9 h, one hour after the sign-in's absolute lifetime ended, the token endpoint still rotated the refresh token (200). Tokens can live up to twice the lifetime after the sign-in.

Expected

The start of a token's session is the sign-in's time (the cookie's auth_time, which the authorize endpoint already reads for max_age and the lifetime check), so every authorization issued under one sign-in ends with it. With that in place, the authorize endpoint that finds the sign-in past its lifetime may revoke the server session's authorizations too (left out of #3198 because today those tokens are still valid).

Acceptance

  • A refresh token issued by a code flow late in a sign-in is refused once AbsoluteSessionLifetime has passed since the sign-in.
  • Both pools; the password grant of the member pool keeps its own start.
  • Tests with the clock, and the specification's sentence on the absolute lifetime made exact.

From the second review of #3199.

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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions