Repository navigation
fix: tighten a channel send permission check - #33353
Conversation
UX Review (Opus 5.5) — ⏭️ skippedRevision |
Design Review (Opus 5.5) — ✅ PASSDesign-level review of Design-Verdict: PASS Nothing blocks: each part is now authorized by the same questions its path already asked before the first part, through one shared helper, and nothing is taken away. Notes
[DESIGN-REVIEWED] 8769771 Description read[DESCRIPTION-READ] b5e4452bf395d2e8836fcccb8dad50e20cbe0cf0e6806ec3a538ec3cb444a0e5 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. The base spec already listed both legs as a deferred gap, and #26339 is linked. The new helper is moved out of What this change shipsInventory (6 items) — 6 justifiedIntent: when an operator withdraws a channel or recipient, a long proactive message stops going out partway through. FIX.
[FIRST-PRINCIPLES-REVIEWED] 8769771 Description read[DESCRIPTION-READ] 7fe010c85571f95e06a19fff65548b29a2ba00ec565421805f8577e27997bfeb 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: |
The channel owner's direct message and a configured channel destination now re-check their permission before every part of a long proactive message, as the session's own conversation already does, so a policy narrowed or a recipient removed mid-send stops the remaining parts. Closes #26339
cd559aa to
8769771
Compare
|
self-added: yes
|
buluoray
left a comment
There was a problem hiding this comment.
Approved at 8769771. The earlier security block is fixed. The configured-target leg reads configured_targets() synchronously before and after the awaited resolve, and refuses target_not_allowed if the target disappeared, with no await between that check and send (src/kiro_crew/dashboard/messaging_api/channel_delivery.py:805, :832, :836, :869; src/kiro_crew/discord/transport.py:350). A new test pins it and turns red under mutation.
|
[operator: bolichen97] Red/green for the test added on 8769771, run in place because the throwaway-worktree prover could not finish its checkout on this host: |
Problem / Motivation
Goal: A long proactive channel message stops going out as soon as the permission behind it is withdrawn, on every proactive channel send path.
A long proactive message reaches a channel as several parts. Two of the three proactive channel paths, the channel owner's direct message and a configured channel destination, decide permission once before the first part. If the operator narrows the channel policy or removes the recipient while the message is going out, the remaining parts are still sent.
Why it matters
An operator who withdraws a channel or a recipient expects messages there to stop. Today the rest of a long agent message, such as a cron report or a subagent result, can still reach a destination that no longer has permission to receive it.
Not a goal
What changed (motivation → approach → change)
The two proactive paths in
src/kiro_crew/dashboardask their own permission questions again before every part of a message, the way the session-conversation path already does: is the channel still allowed by policy, and is the recipient or destination still allowed. The destination is checked once more after it has been looked up, so a destination removed during that lookup is refused as well. When an answer turns to no, the remaining parts are not sent, and the caller gets the permission refusal that path already uses, saying how many parts went out first. When the policy is changing at that very moment, the path asks once more and otherwise stops with a retryable failure. All three paths share one way of asking.The messaging spec under
docs/records both paths as re-checking before every part, where it used to list them as a deferred gap.Backwards compatibility
Compatible: a send whose permissions hold delivers every part as before, and a refused part answers with the status and code its path already returns for that refusal.
Removes nothing: no field, key, route, code or command is removed or renamed.
Tests
test/: a multi-part send with nothing withdrawn still delivers every part; a policy withdrawn after the first part stops the rest with that path's policy refusal; a recipient or destination withdrawn after the first part stops the rest with that path's recipient refusal; a body that renders to no part at all is still refused where it is not permitted.Proof: not provable -- other: prove.py could not check out its throwaway worktree on this disk-bound host before the push
Manual verification
N/A — unit coverage sufficient: each check runs in the send loop itself, and the tests withdraw each permission between real parts of a chunked message.
Related Issues
Closes #26339
Sibling sweep
Siblings: none -- of the three
send_messagechannel paths, the session-conversation one already asks before each part, and these are the other two.Pattern harvest
Not generalizable: a decision taken once for a message sent in parts; no text rule can tell which loop sends parts of one authorization.
Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)