Repository navigation
Conversation
Sign Out cleared the console's local state and ended the provider's browser session, but never called the token revocation endpoint: the OIDC client was configured with `logout_tokens_to_invalidate: []`. A copy of the refresh token kept minting access tokens after the user had signed out (pentest finding INT-30989, CWE-613). Sign-out now sends the refresh token to the revocation endpoint before the local state is destroyed. Access tokens are not sent: Cognito rejects them, and the manager validates the JWT locally, so revoking one at the provider would not shorten its remaining lifetime anyway. The dummy OIDC provider used by the auth e2e suite gains a `revocation_endpoint` and `POST /revoke`. A new e2e test signs in, signs out, checks that the revoke request carried the stored refresh token, and checks that the provider then refuses a replay of that token. The signed-in profile button gets the same `aria-label` as the signed-out one so the test can open it.
| const revokePromise = page.waitForRequest( | ||
| (req) => req.method() === 'POST' && /\/revoke$/.test(req.url()) | ||
| ) | ||
| await signOut(page) | ||
| const revoke = await revokePromise | ||
| const params = new URLSearchParams(revoke.postData() ?? '') | ||
| expect(params.get('token')).toBe(refreshToken) | ||
| expect(params.get('token_type_hint')).toBe('refresh_token') | ||
|
|
||
| // The provider has processed the revocation once the console is back on | ||
| // its login page. A replay of the refresh token must fail from then on. | ||
| await page.waitForURL((url) => url.pathname === '/authorize' || url.pathname === '/') |
There was a problem hiding this comment.
Bug: possible flakiness (medium). loginAs leaves the page on the console, often at /. waitForURL checks the current URL first, so this predicate can pass straight away, before the redirect even starts. waitForRequest resolves once the request is sent, not once it has been handled. dummy_oidc.py runs a ThreadingHTTPServer, and the replay below goes out on its own connection, so it can race the /revoke handler. Waiting on the response removes the race and also checks the status:
const revokePromise = page.waitForResponse(
(res) => res.request().method() === 'POST' && /\/revoke$/.test(res.url())
)
await signOut(page)
const revokeRes = await revokePromise
expect(revokeRes.status()).toBe(200)
const revoke = revokeRes.request()With that change, the waitForURL is no longer needed.
|
Review: revoke the refresh token on sign-out The fix is correct. I read
|
|
Adopted and superseded by #7781 |
Fixes pentest finding INT-30989 (CWE-613, sign-out does not revoke the OIDC refresh token).
Problem
Sign Out cleared the console's local state and ended the provider's browser session, but the OIDC client was configured with
logout_tokens_to_invalidate: [], so nothing was ever sent to the revocation endpoint. A copy of the refresh token kept minting access tokens after the user had signed out.Change
js-packages/web-console/src/lib/compositions/@axa-fr/auth.tslogout_tokens_to_invalidate: ['refresh_token']js-packages/web-console/src/lib/components/auth/ProfileButton.sveltearia-labelon the signed-in profile button, which had no accessible namescripts/dummy_oidc.pyrevocation_endpointin discovery andPOST /revoke(RFC 7009)js-packages/web-console/tests/auth/logout.e2e.tsAccess tokens are not revoked on purpose: Cognito's revoke endpoint only accepts refresh tokens, and the manager validates JWTs locally, so a revoked access token would keep working until it expires either way. Shortening the access token validity on the Cognito app client is an infra change outside this repo.
Test
The new e2e test signs in through the dummy provider, reads the refresh token from
sessionStorage, clicks Sign Out, asserts the revoke request carried that token withtoken_type_hint=refresh_token, then replays the token against/tokenand expectsinvalid_grant.Run locally against a manager with generic OIDC auth and
scripts/dummy_oidc.py: the test passes with the fix and fails with a timeout waiting for the revoke request when the config line is reverted. The other four auth e2e tests still pass.