-
Notifications
You must be signed in to change notification settings - Fork 287
Description
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
- Dynamic JWKs Fetching: Automatically attempt to retrieve the JWKs file from the PERMIFY server if it is not currently available.
- 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.
- 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.