Skip to content

Better control over expiration and IssuedAtOffset for grace periods #740

@EthanHeilman

Description

@EthanHeilman

Preflight Checklist

  • I could not find a solution in the existing issues, docs, nor discussions
  • I have joined the ZITADEL chat

Describe your problem

I'm running into an issue where ID Tokens are set to expiry is 30 seconds after issuedAt, but client's have 1 minute random clock skew. This means that sometimes issuedAt from the client's perspective be 1 minue in the future. I fixed the clock skew issue by setting an IssuedAtOffset of 1 minute. The problem is this offset is also used for expiry, so that if expiry <= (issuedAt + 1 minute) the ID Token fails as expired.

These both share the same offset:

if err = oidc.CheckExpiration(claims, v.Offset); err != nil {
    return nilClaims, err
}

if err = oidc.CheckIssuedAt(claims, v.MaxAgeIAT, v.Offset); err != nil {
    return nilClaims, err
}

Originally reported here: openpubkey/openpubkey#313

Describe your ideal solution

Possible solutions:

  • Allow these offsets to be independently specified. Maybe a clock skew grace period option.
  • Allow the ability to disable expiration check so that dependent software can handle the expiration itself. This is less likely to be a foodgun because the implementor must be explicit about their intention.
    Inject my own NewIDTokenVerifier into the RP, is this possible?

Version

v3.23.2

Additional Context

I'd be willing to open a PR for this, if there is interest.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    Status

    Gathering community feedback

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions