Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: revocation inconsistencies and match oauth spec rfc7009 #152

Merged
merged 1 commit into from
Aug 9, 2024

Conversation

jasonraimondi
Copy link
Owner

  • requires client credentials authentication over the revoke endpoint
  • properly support token_type_hint access_token and revoke_token
    • previously only token_type_hint refresh_token was supported
  • extends the token_type_hint parameter to support 'auth_code' revocation

Copy link

gitguardian bot commented Aug 8, 2024

⚠️ GitGuardian has uncovered 1 secret following the scan of your pull request.

Please consider investigating the findings and remediating the incidents. Failure to do so may lead to compromising the associated services or software components.

🔎 Detected hardcoded secret in your pull request
GitGuardian id GitGuardian status Secret Commit Filename
13251990 Triggered Generic High Entropy Secret 8d14378 test/e2e/authorization_server.spec.ts View secret
🛠 Guidelines to remediate hardcoded secrets
  1. Understand the implications of revoking this secret by investigating where it is used in your code.
  2. Replace and store your secret safely. Learn here the best practices.
  3. Revoke and rotate this secret.
  4. If possible, rewrite git history. Rewriting git history is not a trivial act. You might completely break other contributing developers' workflow and you risk accidentally deleting legitimate data.

To avoid such incidents in the future consider


🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request.

@jasonraimondi jasonraimondi force-pushed the fix/token-revoke branch 2 times, most recently from 76ca09c to e52dd7f Compare August 9, 2024 00:38
@jasonraimondi jasonraimondi marked this pull request as ready for review August 9, 2024 00:38
@@ -322,4 +306,38 @@ export class AuthCodeGrant extends AbstractAuthorizedGrant {
await this.authCodeRepository.persist(authCode);
return authCode;
}

canRespondToRevokeRequest(request: RequestInterface): boolean {
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

auth codes can be revoked with token_type_hint=auth_code

return response;
}

canRespondToRevokeRequest(request: RequestInterface): boolean {
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the server will assume that the token is an access_token, so all other revoke requests besides auth_code should come to the client credentials grant and if it is missing a token, it will throw, and then if it is not an access/refresh token, it will throw, etc.

src/grants/client_credentials.grant.ts Show resolved Hide resolved
src/grants/refresh_token.grant.ts Show resolved Hide resolved
- requires client credentials authentication over the revoke endpoint
- properly support token_type_hint access_token and revoke_token
  - previously only token_type_hint refresh_token was supported
- extends the token_type_hint parameter to support 'auth_code' revocation
@jasonraimondi
Copy link
Owner Author

The breaking change here is requiring client credentials authorization to the revoke endpoint

@jasonraimondi jasonraimondi merged commit e9c94c0 into main Aug 9, 2024
6 checks passed
@jasonraimondi jasonraimondi deleted the fix/token-revoke branch August 14, 2024 14:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant