Skip to content

fix(auth): require re-authentication before minting a CLI access token - #72

Merged
KFilippopolitis merged 2 commits into
masterfrom
fix/cli-token-reauth
Nov 9, 2026
Merged

KFilippopolitis merged 2 commits into
masterfrom
fix/cli-token-reauth

Conversation

@KFilippopolitis

Copy link
Copy Markdown
Contributor

Summary

Implements U1 and U2 of the laptop Jupyter sign-in security plan.

  • U1 (M4/W3): the Create access token authorization-code sign-in now sends prompt=login, so Keycloak asks for the password even with a live SSO session — an open session on a borrowed/stolen laptop can no longer mint a long-lived token silently. Deliberately no max_age=0/auth_time client-side checks (bypassable; real enforcement is Keycloak's flow override, K3).
  • Release note: minimum UI version for the M6 gate recorded in docs/llm-wiki/08-auth-and-terms-flow.md (first present on master after 8b17318, 2026-11-06; repo has no CHANGELOG and package version is 0.0.0).
  • U2 (S5/A8): the account page now states in both the guide above the button and under the shown token: "This token works like your password for up to 180 days. Keep it only in mip login --token; never put it in notebooks, .env files, repositories or chat." plus a link "See and remove computers signed in to MIP" to ${issuer}/account/applications. Replaces the older "treat it like a password / 6 months" note.
  • U2: the shown token is now cleared in ngOnDestroy when the page is left; clipboard copy was verified to not log the token.

Files changed

  • src/app/pages/account-page/cli-token.ts — prompt: 'login'
  • src/app/pages/account-page/cli-token.spec.ts — asserts prompt=login
  • src/app/pages/account-page/account-page.component.html — warning text + revocation link (both places)
  • src/app/pages/account-page/account-page.component.ts — OnDestroy clears the shown token
  • docs/llm-wiki/08-auth-and-terms-flow.md — minimum-version release note

Tests/checks run

  • npm test -- --watch=false: 79 files / 1146 tests passed (account-page specs extended)
  • npm run build: passed
  • npm run lint: no such script in this repo (stale plan item)

Risk

  • prompt=login makes every token mint ask for credentials again — intended (M4), slightly more friction.
  • Applications-link path kept at the modern /account/applications used elsewhere on the page; older account consoles use #/applications — verify on the EBRAINS Keycloak.
  • No auth/backend contract changes beyond the Keycloak redirect parameters.

Rollback

Revert the single commit; no data or deployment migration involved.

Pending manual check

Signed in to the portal → Create access token → Keycloak shows the password form (needs a live Keycloak with the laptop client).

- Send prompt=login in the authorization-code sign-in so Keycloak asks for
  the password even with a live SSO session (M4/W3).
- Warn on the account page that the token works like a password for up to
  180 days, and link to the Keycloak Applications page to remove signed-in
  computers (S5/A8). Clear the shown token when the page is left.
- Record the minimum UI version (master after 8b17318) in the auth wiki for
  the M6 gate.
…where

Review feedback on PR #72: the warning paragraph was pasted twice and the
under-token note lost the 30-day idle / mip logout rules; the footer mixed
'6 months' with the new '180 days'. The guide above the button keeps the
password warning once; the note under the token now states how the token
ends (180 days, 30 days idle, mip logout) plus the Applications link.
Specs now lock the destroy-clears-token behaviour, the warning copy, every
Applications link, and prompt=login on the click path.
@KFilippopolitis
KFilippopolitis merged commit 7781fc1 into master Nov 9, 2026
16 checks passed
@KFilippopolitis
KFilippopolitis deleted the fix/cli-token-reauth branch November 9, 2026 17:16
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.

1 participant