Skip to content

Implement Enhanced Backoff Policy for JWKs Retrieval and Validation #1135

@tolgaozen

Description

@tolgaozen

Context

This feature request relates to our OIDC implementation, which is located at /internal/authn/oidc within our Permify's repository.

Current Behavior

The system currently operates by fetching JWKs on a set timed interval. This mechanism does not support scenarios requiring urgent token rotation and may not be effective in mitigating abuse through the submission of invalid tokens.

Proposed Enhancements

  1. Dynamic JWKs Fetching: Automatically attempt to retrieve the JWKs file from the PERMIFY server if it is not currently available.
  2. Token Validation with KID Checking:
    • If a presented token's KID is not found in the existing headers, initiate a JWKs fetch and validate the token.
    • Implement a backoff policy as follows:
      • If the KID is absent in the header and it has been less than X minutes since the last JWKs retrieval attempt, reject the token as invalid without a new fetch.
      • If the KID is missing in the header and more than X minutes have elapsed since the last fetch, then retrieve the JWKs and validate the token.
  3. Configurability: Allow these behaviors to be adjustable through configuration settings, enabling customization of the backoff timer and response strategies to fit varying security and operational requirements.

Rationale

This enhancement aims to bolster security by facilitating urgent token rotation and preventing potential abuse scenarios without overwhelming the JWKS server with requests due to invalid token submissions.

Suggested Libraries/References

We are using the lestrrat-go/jwx/jwk library for JWK handling.

Timeline

Urgently needed by Wednesday (20.03.2024) to meet security and operational standards.

Request

We are seeking feedback on this proposed approach and would appreciate any support in implementing these changes. Thank you for your attention and assistance.

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions