mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-11-26 22:57:32 +00:00
fix(oauth): an authorization code mints tokens only while the password it was granted under holds
The consent page mints a two-minute authorization code from the cookie session. A password reset or change revokes the user's OAuth tokens but left such a pending code alone, so a code granted before the reset still redeemed afterwards into a fresh token pair at either token endpoint. The code now carries the password version of the session that consented, and both token endpoints issue tokens for it only while that version is still the account's, checked in the transaction that writes the tokens. A refused code answers invalid_grant as any other and is audited as password_changed.
This commit is contained in:
@@ -61,6 +61,7 @@ const { oauthSvc } = vi.hoisted(() => ({
|
||||
consumeAuthCode: vi.fn(),
|
||||
saveConsent: vi.fn(),
|
||||
issueTokens: vi.fn(),
|
||||
issueTokensForCode: vi.fn(),
|
||||
issueClientCredentialsToken: vi.fn(),
|
||||
refreshTokens: vi.fn(),
|
||||
revokeToken: vi.fn(),
|
||||
|
||||
Reference in New Issue
Block a user