Skip to content

UI auth: refine session token handling (backport 2.1 #36250) - #36436

Merged
chirag-madlani merged 1 commit into
2.1from
backport/36250-to-2.1
Oct 28, 2026
Merged

chirag-madlani merged 1 commit into
2.1from
backport/36250-to-2.1

Conversation

@chirag-madlani

@chirag-madlani chirag-madlani commented Oct 28, 2026 •

Copy link
Copy Markdown
Collaborator

Backport of #36250 to 2.1.

Describe your changes:

Refines how the UI handles session tokens. Interactive UI sessions now use tokens from the login flow, and API tokens (bot and personal access tokens) are meant for API clients only. REST API behaviour is unchanged.

Cherry-picked from ca5ccc3. The only conflict was the eslint suppression baseline in corpus.test.mjs, which is set to 2.1's count (537).

Test plan

  • Auth suites (components/Auth, utils/Auth, AuthProvider.util, SwTokenStorageUtils, useApplicationStore): 390 pass
  • DomainIsolationIT#test_ingestionBot_readsDomainAssetAndService passes locally against 2.1
  • eslint, check-i18n, corpus.test.mjs, decision-record check

🤖 Generated with Claude Code

RetriggerView in GreptileConfidence Score: 4/5

The code changes appear sound, but the sign-out test must check real outcomes to satisfy the repository’s testing requirement before merging.

Findings

  1. P2 Test misses failed sign-out ▶

Summary

The UI now rejects stored bot and personal access tokens while leaving REST API behavior unchanged.

  • The UI rejects bot and personal access tokens as login sessions.
  • The mocked MSAL login uses an ID token signed by the mock OIDC provider.
  • Ingestion-bot domain access is checked through the REST API.

Acknowledged and excluded: chirag-madlani records in the decision that an already-running refresh can restore a session during sign-out. That existing race is deferred to #36319.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A["Read stored token"] --> B{"API-only claims?"}
  B -- No --> C["Return login token"]
  B -- Yes --> D["Clear app_state"]
  B -- Yes --> E["Notify AuthProvider once"]
  E --> F["Show translated toast"]
  F --> G["Pause renewal and sign out"]
  D --> H["Return empty token"]
Loading

Reviews (1) · Last reviewed commit: "UI auth: refine session token handling (..." · Reviewed by Greptile

(cherry picked from commit ca5ccc3)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@chirag-madlani chirag-madlani added the UI UI specific issues label Oct 28, 2026
@github-actions

Copy link
Copy Markdown
Contributor

❌ PR checklist incomplete

This PR cannot be merged until the following are addressed on its linked issue:

  • No GitHub issue is linked. Link an issue in the Development section of the PR (or add Fixes #12345 to the description). For a same-org cross-repo issue, add Fixes open-metadata/<repo>#123 to the description.

The fields live on the linked issue in the Shipping project (open the issue → right sidebar → Projects). After you set them, re-run this check (or push a commit) — issue/project changes do not re-trigger it automatically.

Maintainers can bypass this check by adding the skip-pr-checks label.

@gitar-bot

gitar-bot Bot commented Oct 28, 2026 •

Copy link
Copy Markdown
Code Review ✅ Approved

🔴 High risk · Rejecting bot and personal-access tokens in the UI clears stored sessions; claim misclassification could sign out legitimate users and block UI access.

Backport of the UI session token refinement to 2.1: interactive UI sessions now use tokens from the login flow, while bot and personal access tokens are restricted to API clients, with REST API behaviour unchanged. No issues found.

Verification

Rules No rules evaluated

Functional validation Not enabled

Set up

Auto-approval Not enabled

Set up

For more verification details, comment gitar display:verbose.

Options

Display: compact → Showing compact verification results.

Comment with these commands to change the behavior for this request:

Compact
gitar display:verbose         

Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source

Comment on lines +1110 to +1121
it('signs out with a toast when a stored bot or personal access token is rejected', async () => {
await renderForLogout();
const onRejected = mockSetApiOnlyTokenListener.mock.calls.at(-1)?.[0];
await act(async () => {
onRejected?.();
});

expect(showErrorToast).toHaveBeenCalledWith(
'server.api-only-token-ui-access-denied'
);
expect(mockPause).toHaveBeenCalled();
expect(markSignedOut).toHaveBeenCalled();

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.

P2 Test misses failed sign-out

The new test calls a captured listener and checks mocked calls to showErrorToast, pause, and markSignedOut. It never checks that the user becomes signed out, so it can pass even if the rest of sign-out fails.

The repository requires tests to check real outcomes rather than mock wiring. Before merging, drive a rejected stored token through the listener and check that the session is cleared and the user reaches sign-in.

Context Used: AGENTS.md (source)

@github-actions

Copy link
Copy Markdown
Contributor

Jest test Coverage

UI tests summary

Lines Statements Branches Functions
Coverage: 79%
79.75% (131298/164619) 66.28% (46322/69888) 69.22% (26282/37964)

@sonarqubecloud

Copy link
Copy Markdown

@github-actions

Copy link
Copy Markdown
Contributor

✅ SSO Login Nightly — PASSED

View workflow run · Commit 676c015

Provider Status Pass Fail Flaky Skip Duration
basic ✅ pass 28 0 0 0 6m 44s
ldap ✅ pass 7 0 0 0 0m 50s
keycloak-oidc-confidential ✅ pass 12 0 0 0 1m 42s
keycloak-oidc-public ✅ pass 11 0 0 0 1m 16s
msal-mock ✅ pass 7 0 0 0 0m 37s
auth0-mock ✅ pass 6 0 0 0 0m 51s
okta ✅ pass 24 0 0 0 6m 25s
keycloak-azure-saml ✅ pass 23 0 0 0 6m 26s
keycloak-azure-saml-crosssite ⏩ skipped - - - - -

Totals: 118 passed · 0 failed · 0 flaky · 0 skipped · duration 24m 55s

@chirag-madlani
chirag-madlani merged commit d3bc1a0 into 2.1 Oct 28, 2026
126 of 128 checks passed
@chirag-madlani
chirag-madlani deleted the backport/36250-to-2.1 branch October 28, 2026 11:27

This branch was successfully deployed

1 active deployment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

safe to test Add this label to run secure Github workflows on PRs UI UI specific issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants