Repository navigation
fix(auth): read a re-sign-in as an account change in the vault fingerprint - #25608
Conversation
UX Review (Opus 5.5) — ⏭️ skippedRevision |
Design Review (Opus 5.5) — ✅ PASSDesign-level review of Design-Verdict: PASS Nothing blocks: the sign-in marker addresses the cause, and Notes
[DESIGN-REVIEWED] 4f4b094 Description read[DESCRIPTION-READ] 6f713ee3cbbd30c1193f9c78dbddbd7d58ab7bcb19f7bed841cc769a6db2abf3 That sha256 names everything this verdict read: the PR description, plus the 1 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with |
First Principles Review (Opus 5.5) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS Nothing blocks. Each item has a named cause: issue #24942 and the fingerprint docstring's "a Crew sign-out or account switch changes this value". Each one fixes the mechanism, and the one save site has no unfixed sibling. What this change shipsInventory (6 items) — 6 justifiedIntent: when someone signs in as a second account of the same kind, Crew stops serving the first account's model catalog and sessions. This is a FIX.
[FIRST-PRINCIPLES-REVIEWED] 4f4b094 Description read[DESCRIPTION-READ] 255cfaf6867a280d8c794e89efc12b7dc5557b692bc97d890a777bc58738d0a0 That sha256 names the PR description this verdict read. Recompute it with |
Opus 5.5 Review — ✅ no blocking findingsReviewed Verdict parsed from the review's SHA-scoped output markers for commit False positive or not applicable? A repository writer can comment: |
GPT 6.1 Review — ✅ no blocking findingsGPT 6.1 completed its review of This comment is updated in place on each push. Review detailsNo findings. False positive or not applicable? A repository writer can comment: |
efa136f to
7aa19b7
Compare
7aa19b7 to
ff3689f
Compare
Sensitive change review
|
…print Two accounts of one kind can come back with the same profileArn, and none of the claims vault_identity_fingerprint hashes tells them apart, so after A then B the KAS bundle-route model catalog served A's models to B and the identity sweep did not retire A's sessions. The vault now carries a sign-in generation (kas/signed-in), shaped like the sign-out one: the login service bumps it right after it saves a new credential, inside the same flock, and a refresh does not. The fingerprint folds it in when set, so both readers see every completed sign-in as a change; an unmarked vault keeps its fingerprint. Fixes #24942
ff3689f to
4f4b094
Compare
Sensitive change review
|
|
Hold for human review at I found no defect. The marker is folded in only when set, so existing vaults keep their digest (bridge.py#L124-L142). The login bumps it under the sign-out lock after the sign-out generation check and before the save. A failed write returns Non-blocking, for the human reviewer: the Design Review note is accurate. On Windows, a fingerprint read that times out on the exclusive lock while a sign-in or sign-out holds it returns To clear: a maintainer reviews and approves the identity change. — crew-pr-reviewer (r135) |
KiroCrewCaptain
left a comment
There was a problem hiding this comment.
Approved on behalf of the watch holder (bolichen). Design and First Principles pass on this head (or skipped / author override), UX skipped or pass, no conflict, no open change request.
|
🤖 Kiro Crew Auto-Pipeline [operator: buluoray]: Post-merge review follow-up: re-signing in to the same account now retires idle sessions and drops their conversations. Tracked in #25964. |
…#32979) The vault's sign-in marker moves on every saved sign-in, so a same-account re-sign-in also retires idle kiro-backed sessions once. The sign-in responses carry no per-account id that tells it apart from another account answered with the same profileArn (#24942, #25608). Records the trade so it is a stated choice. Fixes #25964 Co-authored-by: sim <a@b.c>
Problem / Motivation
Goal: after a sign-in as another account of the same kind, Crew treats the vault as a new account.
auth/bridge.vault_identity_fingerprinthashesidentity,provider,profile_arn,region,client_id,token_endpointandauth_method. It leaves out credentials on purpose, so a token refresh is not read as an account change. When two same-kind sign-ins (Google A, then Google B) come back with the sameprofileArn, every one of those fields matches, and the fingerprint does not move.Why it matters
Two readers depend on that fingerprint:
agent_sdk/kas_model_catalog.py): B gets A's recorded models and credit multipliers until B's first session records its own.kiro_prerequisite_identity._crew_vault_fingerprint,chat_turn/account_identity._retire_sessions_on_identity_change): sessions started under A are not retired.Not a goal
Intended? / Repro
Intended? No. The fingerprint's own docstring says "a Crew sign-out or account switch changes this value" (
src/kiro_crew/auth/bridge.py:135-147), and the GPT review on #23618 found the gap.Repro (read on current main):
src/kiro_crew/auth/bridge.py:104-112(_VAULT_IDENTITY_CLAIMS) and:124-132(_identity_digest): only those seven claims.src/kiro_crew/auth/login/device.py_token_from_pollbuilds the social token fromprofileArn,providerand the poll's tokens; two Google accounts answered with oneprofileArnproduce the same seven claims, sovault_identity_fingerprint()returns the same digest before and after the second sign-in.What changed (motivation → approach → change)
Symptom: an account switch looks unchanged. Cause: no fingerprinted field names the sign-in. Change: a sign-in marker the fingerprint folds in, as the issue proposes.
auth/store.py:TokenStore.signin_generation()/bump_signin_generation(), filekas/signed-in, a fresh random value per bump. Same shape as the existingsignout_generation.auth/service.py:_persist_and_finishbumps it right BEFOREself._store.save(token), inside the samewith_signout_lockflock. The dashboard andkirocrew kas loginboth buildKasLoginService, so both write it. The refresh path never calls this code, so a refresh does not bump it. Fail closed: a marker that cannot be written raises before the save, and the login answerstoken_store_failedwith nothing saved, because a saved sign-in the fingerprint cannot see would keep serving the previous account's state. A save that fails after the bump leaves only a moved marker, which reads as an account change (the safe side).auth/bridge.py:vault_identity_claimsreads the token and the marker together underwith_signout_lock, the flock a login holds from its bump to its save, so a read never pairs the previous account's token with a marker the login has just moved._identity_digestfolds the marker in when it is set. An unmarked vault (signed in before this change) keeps the digest it had, so upgrading does not read as an account change.docs/system-specs/modules/kas-auth.md: a Sign-in generation paragraph beside the sign-out one.A same-account re-sign-in also bumps the marker: the catalog goes cold and the sweep retires once. The issue calls that the safe answer.
Security
area: auth. The marker is a random token in the owner-onlykas/directory (make_owner_only_dir,_assert_unlinked), never returned: only its hash reaches the fingerprint. No credential, claim or file permission changes.Backwards compatibility
Compatible. An unmarked vault fingerprints exactly as on main. The first sign-in after upgrade changes the fingerprint once, which is the point.
Removes nothing: no key, field or error path is removed.
Tests
test/test_kas_login_signout_generation.py:test_a_second_sign_in_with_the_same_profile_arn_moves_the_fingerprint: two device sign-ins with oneprofileArn; the marker and the fingerprint both change. Fails on main.test_a_refresh_write_does_not_move_the_fingerprint: re-saving a refreshed token keeps the fingerprint.test_an_unmarked_vault_keeps_the_fingerprint_it_had: no marker → the plain claims digest.test_a_sign_in_whose_marker_cannot_be_written_saves_nothing: the poll answerstoken_store_failedand the vault stays empty.test_the_fingerprint_read_waits_for_a_sign_in_between_its_marker_and_its_save: a read started between the bump and the save waits for the lock and fingerprints the saved sign-in.Proof: not provable -- other: this host runs no local tests; CI runs them
Manual verification
N/A: needs two same-kind accounts. Static gates run locally: black, isort, flake8,
scripts/docs_lint.py,scripts/check_file_line_cap.py, comment-history gate.Related Issues
Fixes #24942
Sibling sweep
Swept: git grep -n "vault_identity_fingerprint|vault_identity_claims|_identity_digest" -- src/
Sibling: src/kiro_crew/auth/bridge.py -- changed here (the one digest)
Sibling: src/kiro_crew/agent_sdk/kas_model_catalog.py -- not affected (reads the fingerprint)
Sibling: src/kiro_crew/kiro_prerequisite_identity.py -- not affected (reads the fingerprint)
Sibling: src/kiro_crew/dashboard/handlers/kiro_vault_identity.py -- not affected (reads the claims)
Pattern harvest
Not generalizable: one marker, the sibling of an existing one.
Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)Contribution License Agreement
Contributed under the project's Apache-2.0 license.