Repository navigation
[web-console] Revoke the refresh token on sign-out - #7781
Conversation
Sign-out now sends the OIDC refresh token to the identity provider's revocation endpoint before it clears the local session, so the provider stops issuing access tokens for that session. Only the refresh token is revoked, because AWS Cognito's revocation endpoint rejects access tokens. If revocation fails, the client logs a warning and sign-out still completes. The authentication docs say that token revocation must be enabled for the app client, and that access tokens already issued stay valid until they expire, because pipeline-manager validates them locally. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
What I ran
Gates: Unit tests ✅, docs ✅ (the PR checklist box is unchecked, but docs are in the diff), no new deps, no flakiness risk in the PR's tests (fully mocked; random config names avoid clashes in the client's global missing (medium): No test covers a timed-out or hanging revocation, the one failure mode with a visible UX impact. Suggested test (it also lets the mock see - respondToRevocation?: () => Promise<Response>
+ respondToRevocation?: (init?: RequestInit) => Promise<Response>
@@
- return respondToRevocation()
+ return respondToRevocation(init)
@@
+ it('waits for the revocation timeout and retries before signing out', async () => {
+ vi.useFakeTimers()
+ vi.spyOn(console, 'warn').mockImplementation(() => {})
+ let attempts = 0
+ let done = false
+ signOut({
+ respondToRevocation: (init) => {
+ attempts++
+ return new Promise<Response>((_, reject) =>
+ init?.signal?.addEventListener('abort', () =>
+ reject(Object.assign(new Error('aborted'), { name: 'AbortError' }))
+ )
+ )
+ }
+ }).then(() => (done = true))
+ await vi.advanceTimersByTimeAsync(29_000)
+ expect(done).toBe(false)
+ await vi.advanceTimersByTimeAsync(2_000)
+ expect(done).toBe(true)
+ expect(attempts).toBe(3)
+ vi.useRealTimers()
+ })missing (low-medium): The tests call |
| When a user signs out of the Web Console, it sends the user's refresh token to the revocation endpoint of the identity provider | ||
| to finalize the user session. | ||
|
|
||
| Make sure that your identity provider allows token revocation for the Feldera application. |
There was a problem hiding this comment.
what happens if it's not enabled. is the failure graceful (logout still works)? and maybe all it should do is call it out in logs?
There was a problem hiding this comment.
in that case text should be formulates as 'should' not 'must'
There was a problem hiding this comment.
Graceful. The doc is not as strict as "must"
| If revocation is disabled, or the provider does not publish a revocation endpoint, sign-out still completes but the refresh token stays valid. | ||
| The provider-specific setup guides below describe this step. | ||
|
|
||
| Revocation does not invalidate access tokens that the provider already issued. |
cef5bd6 to
7cf7f49
Compare
7cf7f49 to
c26f8a0
Compare
Sign-out waits for the identity provider to revoke the refresh token. The OIDC client aborts each revocation attempt after 10 s and retries an aborted attempt twice, with no option to change this, so a provider that does not answer delayed sign-out by about 30 s. The console now wraps the client's fetch so that an aborted revocation request fails with a TimeoutError, which the client does not retry. Sign-out then waits at most 10 s and completes with the refresh token unrevoked, as it does for any other revocation failure. The Sign Out button shows a pending state and ignores clicks while sign-out waits. Tests cover a provider that does not answer, a sign-out with the logout extras the console passes for Cognito, and the pending button.
c26f8a0 to
c8f7225
Compare
The dummy OIDC provider publishes a revocation endpoint and forgets a refresh token when the client revokes it. A new e2e test signs in through the provider, signs out, and checks that the console revoked the refresh token and that the provider rejects it afterwards. This covers the generic OIDC path, where the console finds the revocation endpoint through discovery. The signed-in profile button gets the same accessible name as the signed-out one, so the test can open the menu. The client logs nothing when the provider answers a revocation with an error status. The code comment no longer claims that a failed revocation is logged, and the docs say that the console logs no error when revocation is disabled.
Sign-out now sends the OIDC refresh token to the identity provider's revocation endpoint before it clears the local session, so the provider stops issuing access tokens for that session. Only the refresh token is revoked, because AWS Cognito's revocation endpoint rejects access tokens. If revocation fails, the client logs a warning and sign-out still completes.
The authentication docs say that token revocation must be enabled for the app client, and that access tokens already issued stay valid until they expire, because pipeline-manager validates them locally.
Linked Issue
Describe Manual Test Plan
Checklist
Breaking Changes?
Mark if you think the answer is yes for any of these components:
Describe Incompatible Changes