Repository navigation
fix(agent-ipc): record a granted session query in the SEL - #33269
Conversation
GET /api/ipc/session answered a verified capability holder without writing any audit row, so a granted capability decision never reached the operator's SEL. Every other grant on the agent socket is recorded. The session-query success path now writes the same granted dashboard.token_auth row as the internal-route grant. Refs #31016, #33177
UX Review (Opus 5.5) — ⏭️ skippedRevision |
First Principles Review (Opus 5.5) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS Nothing blocks. This is a one-line audit write that reuses the existing What this change shipsInventory (3 items) — 3 justifiedIntent: the operator's audit log should record every granted agent-socket session query, as it already records other capability grants. This is a FIX.
[FIRST-PRINCIPLES-REVIEWED] 246c23f Description read[DESCRIPTION-READ] 29d16b2a554d3aa231ceb5c944bda471665a8994903d534b9f97ebeefba74cb9 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: the change adds one audit row on an already-gated success path. It reuses the same Notes
[DESIGN-REVIEWED] 246c23f Description read[DESCRIPTION-READ] 6940bd5150fcae8ca5394f9f8624b1d760dd576bfefc16f2c69a2cec36ff66ed 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 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: |
KiroCrewCaptain
left a comment
There was a problem hiding this comment.
Approved. The review checked these points on head 246c23f:
- The only change in the gate is one
_log_auth(..., "granted", ...)call. It sits on the session query's GET success path indashboard/agent_ipc.py, after every admit check, and it matches the existing internal-route grant row. - The new test fails when that line is removed. It passes on the head.
- The
security.mdsentence matches what the code now does.
Security: no admit or deny decision changes, and every refusal still goes through _refuse. _log_auth catches its own exceptions, and the SEL write is only added to a background queue, so a response cannot newly fail or block. The row records the server name the gateway issued. It does not contain the session key or the capability.
Done well: the test checks the exact list of audit rows. A stray denial or a duplicate grant would also make it fail.
Optional:
- Under an enforced harness,
capability_session_key()is not memoised, so each identity lookup adds one moredashboard.token_authrow. A short disposition on the Design note accepting that volume would close it. - The release backport #33177 does not carry this line yet and may need the same fix.
GET /api/ipc/session answered a verified capability holder without writing any audit row, so a granted capability decision never reached the operator's SEL. Every other grant on the agent socket is recorded. The session-query success path now writes the same granted dashboard.token_auth row as the internal-route grant. Refs #31016, #33177 (cherry picked from commit 8e4486f) Original author: Ray Xu (#33269).
GET /api/ipc/session answered a verified capability holder without writing any audit row, so a granted capability decision never reached the operator's SEL. Every other grant on the agent socket is recorded. The session-query success path now writes the same granted dashboard.token_auth row as the internal-route grant. Refs #31016, #33177 (cherry picked from commit 8e4486f) Original author: Ray Xu (#33269).
Problem / Motivation
Goal: A granted agent-socket session query is recorded in the operator's SEL, like every other capability grant.
GET /api/ipc/session(src/kiro_crew/dashboard/agent_ipc.py,agent_socket_gate) answers a verified capability holder with the session its stub token names, and returned before any audit call, so that granted capability decision wrote no SEL row. The redemption (_audit) and the internal-route grant (_log_auth) are both recorded. Found by GPT on the 0.12.1 backport #33177; the same code is onmain.Why it matters
Every enforced-harness
kirocrew-coreresolves its session through this query, so the operator's audit log was missing a permission decision on a common path.Not a goal
What changed (motivation → approach → change)
The session-query success path calls
_log_auth(request, "agent-ipc", "granted", "session query <server>")before it answers, the samedashboard.token_authgrant row the internal-route path already writes. The docs specdocs/system-specs/modules/security.md(agent socket) lists it among the recorded decisions.builder-security checked: no bind, listener, route or auth mechanism changes; this adds an audit write on an existing, already-gated unix-socket route.
Backwards compatibility
Compatible: one more SEL row on a granted session query; responses are unchanged.
Removes nothing.
Tests
Proof: PROVEN test/test_agent_ipc.py::test_a_granted_session_query_writes_one_granted_sel_row (head 246c23f)
test_a_granted_session_query_writes_one_granted_sel_row(test/test_agent_ipc.py) redeems a capability over a real unix listener, makes one session query, and asserts exactly onegrantedrow for/api/ipc/session. With the new line removed it fails (assert [] == [('/api/ipc/s...', 'granted')]). Determinism: 5 of 5 repeats.test/test_agent_ipc.py,test/test_agent_ipc_client.py,test/test_agent_ipc_enforced_spawn_e2e.py: 50 passed.--platform linux), docs-lint, comment-history, brand and the flake-pattern ratchet pass.Manual verification
N/A - the test drives the real listener.
Screenshots / video
N/A - no frontend file changes.
Related Issues
Refs #31016, #33177.
Sibling sweep
Siblings: none -- the session query was the only success return in
agent_socket_gatewithout an audit call; redeem and the internal-route grant already write one.Pattern harvest
Rule candidate: every success return of an auth gate writes its granted audit row before it answers, not only the denials.
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; see the Licensing section of CONTRIBUTING.md.