← 输入框|github.com|刷新
Skip to content

[web-console] Revoke the refresh token on sign-out - #7781

Merged
Karakatiza666 merged 3 commits into
mainfrom
web-console-revoke-refresh-token-on-sign-out
Nov 4, 2026
Merged

Karakatiza666 merged 3 commits into
mainfrom
web-console-revoke-refresh-token-on-sign-out

Conversation

@Karakatiza666

Copy link
Copy Markdown
Contributor

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

  • Unit tests added/updated
  • Integration tests added/updated
  • Documentation updated
  • Changelog updated

Breaking Changes?

Mark if you think the answer is yes for any of these components:

Describe Incompatible Changes

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>
@mythical-fred-oss

Copy link
Copy Markdown
Contributor

What I ran

Check Result
bun run test-unit -- src/lib/compositions/@axa-fr/auth.spec.ts ✅ 6/6
pre-commit run --files <changed files> ✅
New test: revocation endpoint hangs (fake timers, mock fetch honours signal) ✅ shows sign-out completes only after 3 attempts / ~30s (see inline)

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 oidcDatabase).

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 init):

-  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 logoutAsync('/') without the Cognito logoutExtras that the app really passes (client_id, redirect_uri, nonce, ...). I checked extractExtras: it forwards only keys with the :revoke_refresh_token suffix, so these extras don't leak into the revocation body today. A test that passes them would protect against that changing.

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.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

in that case text should be formulates as 'should' not 'must'

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

drop

@Karakatiza666
Karakatiza666 force-pushed the web-console-revoke-refresh-token-on-sign-out branch from cef5bd6 to 7cf7f49 Compare November 3, 2026 22:34
@Karakatiza666
Karakatiza666 force-pushed the web-console-revoke-refresh-token-on-sign-out branch from 7cf7f49 to c26f8a0 Compare November 3, 2026 22:44
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.
@Karakatiza666
Karakatiza666 force-pushed the web-console-revoke-refresh-token-on-sign-out branch from c26f8a0 to c8f7225 Compare November 3, 2026 22:49
@Karakatiza666
Karakatiza666 added this pull request to the merge queue Nov 3, 2026
@Karakatiza666
Karakatiza666 removed this pull request from the merge queue due to a manual request Nov 3, 2026
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.
@Karakatiza666
Karakatiza666 added this pull request to the merge queue Nov 4, 2026
Merged via the queue into main with commit ce04f0a Nov 4, 2026
1 check passed
@Karakatiza666
Karakatiza666 deleted the web-console-revoke-refresh-token-on-sign-out branch November 4, 2026 13:47
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.

2 participants