Repository navigation
Conversation
Design Review (Opus 5.5, fork) — ✅ PASSDesign-level review of Design-Verdict: PASS Before merge, fix the counts in Suggestions
[DESIGN-REVIEWED] 80fd8d9 Description read[DESCRIPTION-READ] 1162f2464092cfd8a60ee11dc6e4933fd202a15bead6d0039bf76a59b9b61c64 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, fork) — 🟡 CONCERNSPremise-level review of First-Principles-Verdict: CONCERNS
Not justified as shipped
What this change shipsInventory (8 items) — 5 justifiedIntent: stop dashboard redaction leaving the destination URL visible when the two passes run in the wrong order. This is a FIX, although the title says
[FIRST-PRINCIPLES-REVIEWED] 80fd8d9 Description read[DESCRIPTION-READ] a0bfe85bbbab2536e5484707ced393476d68fa8f99e4dbb8b640cfd67c492ec9 That sha256 names the PR description this verdict read. Recompute it with |
Opus 5.5 Review (fork) — ✅ no blocking findingsReviewed Review detailsNo blocking issues; one advisory finding on new in-function imports. FINDING — src/kiro_crew/dashboard/messaging_api/proactive_send.py:512 — [OPUS-REVIEWED] 80fd8d9 |
GPT 6.1 Review (fork) — ✅ no blocking findingsReviewed Review detailsFINDING -- src/kiro_crew/dashboard/messaging_api/proactive_send.py:62 -- Function-local |
56d765a to
49b0d1c
Compare
49b0d1c to
f6d4175
Compare
The credential and exfiltration-URL passes must run in a fixed order, and `kiro_crew.security.redact` already composes them that way. Its docstring gives the reason: exfiltration URLs run FIRST because that pass matches whole URLs, and a credential replaced ahead of it leaves a placeholder inside one, which the URL matcher then fails to recognise as the shape it is there to catch. The credential goes either way; what the reversed order loses is suppression of the destination, which is the half a reader acts on. Call sites hand-sequenced the pair anyway. The dashboard package's pairs now compose through `redact` (or `redact_with_findings` where the warning lists are used as a signal, which preserves both lists in the same order), with one deliberate exception: `file_api/grep.py`'s `_grep_hit` keeps the two raw passes, reordered into the canonical sequence, because the facade composition contract requires the grep row to read the facade-bound pass bindings and take only its preview ceiling from the facade. The four credential-first pairs the `messaging_api/` split had re-introduced are converted, and `handlers/updates.py` no longer imports either raw pass; `handlers/files.py` keeps its facade bindings while its own body composes through `redact`. `test/test_redaction_pair_order.py` is new. It asserts the behaviour the order decides on the helper itself, then pins a tree-wide baseline of hand-sequenced pairs (shrink-only: a paid-off entry that is not pruned fails, and a new hand-sequenced pair anywhere under src/ fails). The scan resolves every spelling the tree uses and reads the AST, so a comment or string literal quoting the pattern cannot count. On today's tree the baseline holds 38 two-line pairs in 32 files plus one inline pair, all outside the dashboard package; they are pinned rather than migrated, so the rule holds from today and the sweep reviews separately. Two existing tests assert the seams this change moves, so both follow the migrated call: `files.py` composes through the context-aware `redact` shim, and `state._log_task_exception` calls `redact`, which is the symbol a failing-redactor test patches.
f6d4175 to
80fd8d9
Compare
|
Reviewed, not approving (crew-pr-reviewer). This refactors how the redaction passes are composed across several sinks. Redaction is security code, so it needs a security owner. |
Problem / Motivation
Goal: Redacted dashboard output no longer depends on individual call sites running the credential and exfiltration-URL passes in the right order; one shared helper composes them, and a tree-wide test keeps it that way.
kiro_crew.security.redactandredact_with_findingsalready compose the two redaction passes in a fixed order, and the docstring records why the order matters: exfiltration URLs run first because that pass matches whole URLs, and a credential replaced ahead of one leaves a placeholder inside it, which the URL matcher then fails to recognize as the shape it exists to catch. Call sites that wire the two passes by hand inherit no such guarantee. The dashboard package sequenced the pair by hand in dozens of places, and a number of them had it backwards.Why it matters
The credential goes either way; what the reversed order loses is suppression of the destination.
redact_exfiltration_urlsclassifies a URL as suspicious partly by query length and replaces the entire URL when it fires, so once a credential inside that URL has been swapped for a placeholder, the exfil pass no longer recognizes the shape and the host survives the redaction untouched. The host is the half a reader acts on: it says which surface the content was about to leave for. The entropy and length heuristics also stop firing for that URL, so the loss is not limited to the credential shape that happened to match.Every one of these sites is dashboard egress (audit rows, error text, file-search previews), so a reversed pair leaks exactly the detail an operator would use to judge the exposure while still reporting that a credential was redacted. The failure is quiet: the log looks redacted, and the destination is still in it.
A test that only checked the helper would not stop this class. The failure mode is a call site re-sequencing the pair, which any new handler can reintroduce, so the guard has to read the tree.
Not a goal
What changed (motivation → approach → change)
The approach reuses the existing composer instead of inventing a new one:
redactat sites that discard the per-pass warnings,redact_with_findingswhere the warning lists are consumed as a signal, which preserves both lists in the same fixed order.Concretely:
file_api/andmessaging_api/submodules (two infile_api/grep.py's_grep_hit, four inmessaging_api/proactive_send.py), plus the pairs inhandlers/messaging.py,handlers/updates.py,dashboard/state.py, andchat_runner.py.handlers/files.pyandhandlers/updates.pyno longer import either raw pass;files.pycomposes through the context-awareredactshim it already had.test/test_redaction_pair_order.pyis new. It first asserts the behavior the order decides, on the helper itself: the canonical order suppresses the destination, the reversed order leaves a live URL standing, and the two orders agree when no URL carries a credential. It then pins a tree-wide baseline of hand-sequenced pairs, and the baseline is shrink-only: a pair that gets migrated must be pruned from the baseline in the same commit, and a new hand-sequenced pair anywhere undersrc/fails the test. On the current tree the baseline holds 38 two-line pairs in 32 files plus one inline pair, all outside the dashboard package.entry["path"]counts.files.pycomposes through the shim, andstate._log_task_exceptioncallsredact, which is the symbol a failing-redactor test patches.docs/system-specs/modules/security.mdis updated in the same commit to record the composition rule and the pin test.Backwards compatibility
Compatible: no exported symbol is added, renamed, or removed.
redact_credentialsandredact_exfiltration_urlskeep their signatures and remain the public passes; callers outside the dashboard package are untouched.Removes nothing: the two passes stay importable and in use across the tree. Only call composition inside the dashboard package, two now-unneeded import bindings, and one new test module change.
Tests
test/test_redaction_pair_order.py(new): the order-decides assertions on the helper, the shrink-only tree-wide baseline, and soundness probes for every spelling the scanner resolves (bare, qualified, aliased, and subscripted targets; pairs nested in branches and handlers; independent redactions that must not be flagged).test/test_cse_2026_08_07_fixes.pyandtest/test_heartbeat_prompt_deliver.pyfollow the migrated seams.flake8,mypy src/kiro_crew,isort --check-only, and the black gate are clean on the branch. CI runs the full suite.Manual verification
N/A — unit coverage sufficient. The change is call composition, and the new tests exercise the exact property at stake (the order decides the output) against the real passes; the tree-wide scan is itself executed by the suite rather than trusted.
Related Issues
Supersedes #11501, the earlier PR of this refactor, which I closed to rebase it. The dashboard has since been split into the
file_api/andmessaging_api/submodules, and that split carried six credential-first pairs back into the tree; this converts them and re-takes the pinned baseline counts on the current tree.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. This change adds no new third-party dependency, so THIRD-PARTY-NOTICES needs no update.