Repository navigation
fix(dashboard): audit app-token chat stops as via app:<app> - #21127
Conversation
|
Hi — friendly note on the checks: the In the meantime, locally on
Happy to approve workflow runs whenever convenient — thanks for taking a look! |
e681fda to
d43250a
Compare
|
Reworded three comments so added lines no longer carry issue references ( |
UX Review (Opus 5.5, fork) — ⏭️ skippedRevision |
First Principles Review (Opus 5.5, fork) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS The fix is at mechanism level, so nothing blocks. Notes
What this change shipsInventory (2 items) — 1 justifiedIntent: when an app token stops a chat turn, the audit should name that app, not the owner's dashboard press. This is a FIX.
[FIRST-PRINCIPLES-REVIEWED] 6871f2f Description read[DESCRIPTION-READ] 87d805ced4cef75f2ed13e1a304b8970a1a25a2be83d25ff1eb19ba4a2ed4219 That sha256 names the PR description this verdict read. Recompute it with |
Design Review (Opus 5.5, fork) — ✅ PASSDesign-level review of Design-Verdict: PASS Nothing blocks: inside Notes
[DESIGN-REVIEWED] 6871f2f Description read[DESCRIPTION-READ] e5d3505800aecc041c353eb0ae39ae7903e4389f17fc48282d21f0bd13b6ae76 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 (fork) — ✅ no blocking findingsReviewed |
GPT 6.1 Review (fork) — ✅ no blocking findingsReviewed Review detailsNo findings. |
Fixes kirodotdev#20874 Co-authored-by: akushonkamen <akushonkamen@users.noreply.github.com>
5453366 to
6871f2f
Compare
|
HOLD (policy-sensitive) at 6871f2f. The code looks correct: I am not recommending approval only because this changes what identity a security audit line records on an app-token-authenticated route, which this reviewer reserves for a human maintainer. The SEL — crew-pr-reviewer (r131) |
iamwhatever
left a comment
There was a problem hiding this comment.
APPROVE (security-sensitive scope, maintainer-accepted)
This PR touches a security-sensitive area, so it was held for a human decision. A maintainer reviewed the deep-check notes for this exact head (6871f2fbefbb) and accepted it. This approval supersedes any earlier HOLD from crew-pr-reviewer.
Why it is safe: records app-token chat stops in the audit log as app:; the permission check order is unchanged. CI is green on this head, the base is main, and there is no conflict.
— crew-pr-reviewer (r132)
Problem / Motivation
Goal: An app token's chat stop is audited as
via app:<app>, not as the owner's dashboard press.While a turn runs, #19898 gave the embedded chat a Stop button backed by the app's token. Every stop that button makes — the soft press, the
?force=trueescape, and the escalated second press — lands in the SEL audit lines asvia "dashboard", indistinguishable from the owner pressing Stop in the dashboard.Why it matters
Any app that embeds the chat can stop a running turn, and the audit is the only record of who did it. An app-token stop that reads as the owner's own press blinds the audit exactly when work was cancelled — whether diagnosing "who stopped my crew" or investigating an app acting up.
Not a goal
sourcefield: it names the client surface and keeps its hard-coded"dashboard"(raised on the issue; will follow a maintainer's call).What changed (motivation → approach → change)
Root cause:
api_chat_slot_stopcalledstop_slot_turnwithoutsource=, andstop_slot_turn's signature (src/kiro_crew/dashboard/chat_api/turn_stop.py:427) defaultssource: str = "dashboard"— a default written into all four SEL lines'metadata.via(:617,:628,:684,:749).The route now lifts the app name it already extracted for the first deny check into
request_app(:780) and passessource=f"app:{request_app}" if request_app else "dashboard"(:806): the same identity the deny checks just authorized against is the one recorded. Owner stops (no app on the request) audit exactly as before. Authorization order is untouched — both deny checks still run before any side effect, and the new test pins that.Backwards compatibility
Compatible: no field, response shape, or accepted input changes; the only delta is the value of
metadata.viaon SEL lines produced by app-token stops, which is the audit correction itself. Dashboard callers keep the effectivesource="dashboard"they had before.Removes nothing: the route's behavior for owner callers is unchanged, and both deny checks are byte-identical.
Tests
test/test_app_token_stop_source.py(new, 6 cases, pattern fromtest_chat_slot_muted.py's middleware identity injection andtest_compaction_stop_declined.py's_make_state/SEL patching): app-token soft stop, force escape, and escalated second press each auditvia app:<app>; the owner's dashboard stop still auditsvia dashboard; thestop_slot_turn(source=...)contract; both deny checks still precede any side effect.PYTHONPATH=$PWD/src .venv/bin/python -m pytest test/test_app_token_stop_source.py -q --timeout=120→ 4 failed, 2 passed (the app-token soft/force/escalated asserts fail with'dashboard' == 'app:mail-bot').scripts/local-gate.py, backend (related) lane (python -m pytest -q -n auto --dist loadgroup --no-cov --timeout=120 -- test/test_app_token_stop_source.py test/test_chat_handlers_composition_contract.py test/test_json_object_body_guard.py test/test_slot_running_readers.py) → 351 passed in 15.86s. The gate's frontend lane fails in this offline environment (node_modulesabsent,npm cinot possible); the gate classifies this diff's frontend bucket as False (frontend=False meta=False backend=True), so the failure is environmental and CI covers it.ruff/flake8unavailable in the offline venv; both changed files passpy_compileand the 100-column line cap.Manual verification
N/A — unit coverage sufficient: the value under change is
metadata.viaon the SEL linesstop_slot_turnwrites, and the new tests assert it directly for both callers; no UI surface changes.Related Issues
Fixes #20874
Claimed in #20874 (comment).
Pattern harvest
Rule candidate: review-prompt
Pattern: an audit-identity parameter with a caller-agnostic default (
source="dashboard") mis-attributes cross-surface calls; a call site holding the caller's identity must pass it explicitly instead of letting the default stand in.Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)