Repository navigation
fix(kas-auth): offer the kiro-cli account switch only to the owner - #37275
Conversation
UX Review (Opus 5.5) — ⏭️ skippedRevision |
First Principles Review (Opus 5.5) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS Nothing blocks. The fix adds Notes
What this change shipsInventory (4 items) — 3 justifiedIntent: stop showing a teammate who isn't the owner a "Use the Kiro CLI account" button that always fails with a 403. This is a FIX.
[FIRST-PRINCIPLES-REVIEWED] 32fc5d4 Description read[DESCRIPTION-READ] 21bf36ebf1ee6bdf05439d6a98efdfdd50f75daee1b0e0a5aef4289a6812e365 That sha256 names the PR description this verdict read. Recompute it with |
Design Review (Opus 5.5) — ✅ PASSDesign-level review of Design-Verdict: PASS Nothing blocks: this is the right fix in the right place. The owner check moves into the status field that offers the switch, and the frontend already handles [DESIGN-REVIEWED] 32fc5d4 Description read[DESCRIPTION-READ] 3787f4d24886c2ce2261d5d633ca9915394882d6a8fca1940119db9bc06373f6 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 |
Opus 5.5 Review — ✅ no blocking findingsReviewed Review detailsNo findings. The candidate list was empty. I read the whole diff and found nothing that meets the bar for a finding. [OPUS-REVIEWED] 32fc5d4 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: |
The sign-in card offered "Use the Kiro CLI account" to any dashboard viewer, but the sign-out it runs is owner-only, so anyone else got a 403. can_use_kiro_cli now requires the owner. Also states in same_account's docstring, and pins with a test, that equal Identity Center or External IdP profile ARNs count as one account: the cost is a missing two-accounts notice, never a wrong one. Follow-up to #36324 review notes.
bfcf1d5 to
32fc5d4
Compare
Code change approver recommendation: ApproveWhy: the decider estimates a 4% chance that this change introduces a defect, within the 12% limit for approving on its own, and every check passes. The PR adds the An automated recommendation, not a review: a maintainer still decides. It approves on its own only when the estimated chance of a defect is at most 12% and the change has at most 400 changed lines. Decider v3c (217fe607) · commit |
KiroCrewCaptain
left a comment
There was a problem hiding this comment.
Verified on this head: can_use_kiro_cli now starts with the owner value from is_owner_dashboard_request, the same predicate _require_owner uses to guard the sign-out route. The new test test_only_the_owner_is_offered_the_kiro_cli_account passes at this head. It fails with assert True is False when the owner and term is removed. The other tests in test_kas_login_sources.py pass either way. The spec kas-auth.md is updated in the same commit, and the frontend already hides the button and confirm step when the field is false.
Security: this only narrows what the dashboard offers. A falsy owner gives False, so the check fails closed. The sign-out route still enforces its own owner check and returns 403 to anyone else. Nothing that main refuses is now allowed.
Done well: the offer and its enforcement now come from one predicate, so they cannot drift apart. The test keeps the stored accounts of the owner case and changes only owner=False.
Optional:
- The Proof line names head bfcf1d5. The patch is identical to 32fc5d4 (rebased only), so you could refresh it on the next body edit.
- The claim that LTS skips the account-lock read for a non-owner is true in the code but has no test. An LTS non-owner case that spies on
account_lock_allowswould pin it. - The two new kind pairs in
test_equal_organization_profile_arns_count_as_one_accountcould go into the existingtest_the_verdictparametrize list.
Problem / Motivation
Goal: Only the dashboard owner sees Use the Kiro CLI account on the Kiro sign-in card, because only the owner can run the sign-out it needs.
A teammate on a shared dashboard who is not the owner sees Use the Kiro CLI account when the Kiro Crew and Kiro CLI sign-ins are different accounts. Clicking it runs
POST /api/kas-login/logout, which is owner-only, so they get a 403 and the button does nothing. KiroCrewCaptain raised this in its review of #36324 (review 5903662688), and I took it as a follow-up.Why it matters
A button that always fails for the person who sees it is a dead end. It also suggests they may change a sign-in that only the owner controls.
Not a goal
same_accountdecides; this PR only documents and pins its current answer for Identity Center and External IdP.What changed (motivation → approach → change)
kas_login_sources.api_kas_login_sourcescomputedcan_use_kiro_cliwithout theownervalue it already reads for the email field.can_use_kiro_clinow also requiresowner. On LTS the account-lock read is skipped for a non-owner, since the answer is already False.lts_sign_in.same_account's docstring now says that equal Identity Center or External IdP profile ARNs count as one account even though one organization can share that ARN. The cost is a missing two-accounts notice, never a wrong one. A test pins that answer.Backwards compatibility
Compatible: the response keeps the same fields; for a non-owner
can_use_kiro_cliis now False, and that button could never work for them.Removes nothing: the owner keeps the button; a non-owner loses only a control that always failed with 403.
Tests
test_only_the_owner_is_offered_the_kiro_cli_account: a non-owner request with two different accounts getscan_use_kiro_cliFalse.test_equal_organization_profile_arns_count_as_one_account[identity_center|external_idp]: pinssame_accountreturning True for equal ARNs of those kinds.test_kas_login_sources.pyandtest_lts_sign_in.py: 138 passed.Proof: PROVEN test/test_kas_login_sources.py::test_only_the_owner_is_offered_the_kiro_cli_account (head bfcf1d5)
Manual verification
N/A — unit coverage sufficient: the change is one boolean term in a JSON status read, and the handler test drives the real handler with an owner and a non-owner request.
Related Issues
Follow-up to #36324 (KiroCrewCaptain review 5903662688, optional notes).
Sibling sweep
Swept: git grep -n "kas-login/logout|is_owner_dashboard_request" -- src/kiro_crew/dashboard/handlers/kas_login*.py
Sibling: src/kiro_crew/dashboard/handlers/kas_login_sources.py -- changed here
Sibling: src/kiro_crew/dashboard/handlers/kas_login.py -- not affected -- the logout route itself already refuses non-owners
Pattern harvest
Not generalizable: one status field that offers an owner-only action; the route it points at already enforces the owner check.
Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)Contribution License Agreement
Contributions are accepted under the project's Apache-2.0 license.