Repository navigation
Conversation
Design Review (Fable 5, fork) — 🟡 CONCERNSDesign-level review of Design-Verdict: CONCERNS The demonstrated leak stays live at 47 pinned egress sites (channel, voice, discord, ACP) with no tracked follow-up — the ratchet only stops growth. WatchThe PR's own test proves the reversed order leaves "a live, clickable exfiltration endpoint" standing, and the pinned baseline includes outbound-message paths ( Suggestions
[DESIGN-REVIEWED] 48d4c73 |
GPT 5.6 Review (fork) — ✅ no blocking findingsReviewed Review detailsFINDING -- test/test_redaction_pair_order.py:233 -- restricting |
First Principles Review (Fable 5, fork) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS The gate's two-statement scan links calls only through bare names — a reversed pair on a subscript (the Not justified as shipped
What this change shipsInventory (9 items) — 8 justifiedIntent: FIX — stop the reversed redaction order leaving live exfiltration URLs at dashboard egress surfaces, and gate the tree against new reversed pairs (documented invariant at
Verified against base: no existing gate covers pair order (grepped [FIRST-PRINCIPLES-REVIEWED] 48d4c73 |
Opus 4.8 Review (fork) — ✅ no blocking findingsReviewed |
49e1397 to
d0ad586
Compare
|
The remaining
|
d0ad586 to
746a2ab
Compare
746a2ab to
48d4c73
Compare
48d4c73 to
8f1c508
Compare
|
Rebased onto main Conflicts resolved (only this file was hand-merged; no other manual edits):
Same single commit, same author, same message. Apart from changes inherited from main, everything outside the conflict hunk was preserved without manual edits. The original 16-file PR change set is unchanged. All 15 changed Python files compile; the focused redaction-order suite passes (19 tests); diff whitespace and conflict-marker checks pass. The full suite was not run. Any prior approval was dismissed by the push and needs to be re-given after CI re-runs. |
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: the URL pass matches whole token-bearing URLs, so a credential replaced ahead of it leaves a placeholder inside the URL and the URL pass fails to recognise the shape it exists 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: 452 same-variable pairs across the tree, 84 of them in the reversed order across 48 files. The dashboard package's 37 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). The remaining 47 pairs in 36 files are pinned rather than migrated, so the rule holds from today and the sweep reviews separately. `test_redaction_pair_order.py` pins the behaviour the order decides, the pinned baseline (shrink-only: a paid-off entry that is not pruned fails), and the scan's own soundness. The scan resolves every spelling the tree uses — a bare name, a qualified chain, and an import alias that resolves to a module re-exporting the passes — while refusing a same-named method on an unrelated object. It reads the AST, so a comment or string literal quoting the pattern cannot count, and the target/argument comparison is by source, so a `entry["path"]` target counts too. Two existing tests assert the seams this change moves, so both follow the migrated call: `files.py` now composes through the context-aware `redact` shim and no longer binds either raw pass, and `state._log_task_exception` calls `redact`, which is the symbol a failing-redactor test patches.
8f1c508 to
31da7ea
Compare
|
@bolichen97 thanks for rebasing this onto What I changed since your rebase ( Both reviewers flagged the same real defect in the new gate, and they were right — my scan only resolved calls through a bare name (
The suite is now 25 tests (up from 19). I proved the tightened scan catches a regression rather than merely passing: I planted an attribute-spelled reversed pair in I also fixed a performance problem I had introduced. Two independent walks of On the review lanes The four model lanes are currently reporting I have not re-pushed to try to shake it loose, because a re-run is unlikely to help if the cause is transient, and each push dismisses whatever approval state exists. Happy to force-push a fresh SHA if you would prefer the lanes to re-run against the current head. Status of the checks I can act on 75 checks pass, including One thing still open from Design Review, which I deliberately did not act on unilaterally: the 47 sites pinned in the baseline include outbound paths ( |
|
🤖 Kiro Crew [operator: NicholasRBowers#a942f9ca]: This PR has been inactive for 7+ days with failing CI. I've assessed the blockers and they appear resolvable — I'll push fixes directly to this branch as a co-author. Assessment: Nothing is wrong with the change itself — every CI job is green, First Principles is PASS, and the two findings the lanes raised are already fixed on your current head. Three things are left:
For the record, so it isn't re-litigated: GPT's If you'd prefer I don't touch this PR, add the |
Problem / Motivation
Two redaction passes have a fixed order, and a call site that writes them by hand can get it backwards without anything failing loudly.
kiro_crew.security.redactcomposes them correctly, and its docstring states why:redact_exfiltration_urlsmatches whole token-bearing URLs, so a credential replaced ahead of it leaves a placeholder sitting inside the URL and the URL pass stops recognising the shape it exists to catch. Call sites have been writing the pair out anyway. Acrosssrc/kiro_crewthere are 452 pairs composed on the same variable, and 84 of them use the reversed order in 48 files. Thedashboardpackage holds 37 of those.The credential itself is removed either way, which is what makes the reversed order read as harmless. What it loses is the other half: the destination. Reducing the input to the minimum,
see https://evil.example.com/collect?token=AKIAIOSFODNN7EXAMPLE&x=1 now, the canonical order producessee [REDACTED: suspicious URL to evil.example.com] now, while the reversed order producessee https://evil.example.com/collect?token=[REDACTED: credential]&x=1 now. The host survives as a live, clickable endpoint in a line a reader is meant to trust as cleaned.Why it matters
Redaction is the boundary between what the operator may see and what must not travel. Every one of these sites is an egress: a chat transcript, a dashboard WebSocket broadcast, a SEL audit record, a channel delivery, an exception message shown in a UI. When the order is reversed, the text arrives at that surface looking redacted while still naming the endpoint an attacker chose. That is worse than not redacting at all, because the tag signals "this was handled" and a reader stops looking.
This is a bug class the repository has already paid for once. Issue #9014 measured five egress sites composing the passes in reverse; PR #9033 fixed exactly those five and added no mechanism to stop the sixth. Nothing prevents the pattern from being written again, which is why the 84 current sites exist. This change fixes one package and adds the missing mechanism, so the count can only go down from here.
What changed (motivation → approach → change)
The two passes already have a single correct home.
kiro_crew.security.redactcomposes URL-then-credential, andredact_with_findingsdoes the same work while also returning the two warning lists. Both live beside the passes they sequence, so the ordering lives in exactly one place instead of being re-spelled at hundreds of call sites.The
dashboardpackage's 37 reversed sites now compose through those helpers.redact_with_findingscovers the sites that capture the warning lists as a signal rather than merely counting them, because that path returns both lists in the same order the hand-written pair did. The swap is otherwise a pure composition change: I checkedredact()against the manual pairing over a corpus of 15 inputs (empty string, plain prose, a bare AWS key, a slash-bearing secret key, a GitHub token, a JWT, a JSON blob, a URL with the credential in its query, and a base64-encoded key) and got byte-identical output on every one. So the only behavioural delta a reviewer has to reason about is the order itself, which is the fix.I deliberately did not migrate all 84 sites in one go. The remaining 47 pairs in 36 files are pinned in the baseline instead. A sweep that large mixes the ordering fix with a lot of unrelated review surface, and the sites that are left sit in packages where the pinned list is easy to work through separately. Pinning them means the rule is enforced from today rather than after a long sweep lands.
Two alternatives I passed on. Wrapping just the URL pass so the order becomes unstateable at the call site would have been a smaller diff, but it hides the sequencing inside a helper whose name says nothing about ordering, and the next person writing the pair by hand still gets it backwards. Doing the whole tree at once would leave the ratchet with an empty baseline, which sounds cleaner but makes the PR un-reviewable and couples a mechanical sweep to a security fix.
Tests
test/test_redaction_pair_order.py(19 tests, new) carries both halves: the behaviour the order decides, and the mechanism that keeps the order from being rewritten.The behavioural half asserts the canonical order suppresses the destination, the reversed order leaves a live URL standing, the two orders genuinely disagree on this input, and they agree when no URL carries the credential. That last one is a negative control, without which "the orders differ" could be satisfied by any divergence and the rule would say nothing about when it matters. A separate test pins
redact()against the manual composition across the corpus, so a third variant cannot appear unnoticed.The mechanism half scans
src/kiro_crewand compares both spellings against a pinned baseline. It covers a two-statement pair and a single nested expression, and the nesting direction matters: the innermost call runs first, soredact_credentials(redact_exfiltration_urls(x))is the correct order andredact_exfiltration_urls(redact_credentials(x))is the reversal. The scan parses the AST withast, so a comment or a string literal quoting the pattern can never count as a violation.Twelve probes keep the scan honest: same variable, a different target variable fed from the first, nested in a branch, nested in an
excepthandler, the subscript form, the correct order, unrelated redactions, both nesting directions, and a comment quoting the pattern. One further test asserts the walk actually reaches real files and thesecuritypackage, because a scan that silently found nothing would pass forever.The baseline is shrink-only. A pinned entry that has been paid off must be pruned, or the comparison fails, so the list cannot quietly stop measuring anything.
The ratchet is proven to catch a regression rather than merely observed going green. I planted a reversed pair in
session_summary.py, watched the gate fail and name that file, then removed it and watched the gate pass.Gates run locally:
black --target-version py310on the changed files,isort,flake8— cleanmypy—Success: no issues found in 12 source filesscripts/check_black_formatting.py— 14 changed files in scope, nothing unformatted outside the baselinescripts/check_subprocess_encoding.py— passedscripts/check_comment_history.pywithCOMMENT_HISTORY_BASE_REF=upstream/main— passedscripts/docs_lint.py—All documentation checks passedtest/test_redaction_pair_order.py test/test_security.py test/test_workflows_agent_pool.py— 1044 passed, 19 skipped, 3 xfailedtest/test_artifacts.py test/test_artifacts_handlers.py test/test_artifacts_handlers_coverage.py test/test_chat_runner_coverage.py test/test_dashboard_sessions_search.py— 841 passed, 10 skipped, 6 xfailedManual verification
N/A — unit coverage is sufficient. The change moves which helper composes two pure text functions; it touches no HTTP surface, no rendering, and no user-facing string, and the corpus check above proves the composition is byte-identical to the manual pairing it replaces. The one observable difference is the order itself, and that is asserted directly against the helper.
Related Issues
Relates to #9014, closed by #9033, which fixed the five egress sites that issue identified and added no mechanism to catch a recurrence. This change migrates one package and adds that mechanism, so the class is gated rather than re-fixed per instance. There is no dedicated issue for the remaining 47 sites.
Pattern harvest
Rule candidate: test
Pattern: a required composition order re-spelled by hand at call sites is a silent downgrade, so gate the tree against the reversed spelling and pin what is not migrated yet in a shrink-only baseline.
Checklist
security.redactseam rather than inventing onedocs/system-specs/modules/security.mdrecords the rule, the gate, and the pinned remainder