Repository navigation
fix(security): classify redaction by what a value can do (awaiting design approval) - #22887
bolichen97 wants to merge 1 commit into
Conversation
Sensitive Change ReviewSensitive files changed:
How to clear this check:
Only the author's comment counts this way. A reviewer can instead |
First Principles Review (Opus 5.5) — 🔴 BLOCKPremise-level review of First-Principles-Verdict: BLOCK The description says the entropy guess "is removed, with every exemption that existed only for it". The diff does the opposite in the aws_control bundle scan: it widens the entropy detector to every mode and adds new false-positive exemptions to it. What this change shipsInventory (10 items) — 8 justifiedIntent: redact every secret and never an identifier, by tier. This is a FIX, under the maintainer decision
BlockersEntropy guess kept and widened in the bundle scan — symptom-level [FIRST-PRINCIPLES-REVIEWED] 56d1b35 Description read[DESCRIPTION-READ] 8dc2246e52ce11038832e29a3e7ecbe36611298e46a4af3c3e0f7994885fbdd6 That sha256 names the PR description this verdict read. Recompute it with |
Opus 5.5 Review — 🔴 changes requested (blocking)Reviewed Blocks: the label pass now treats JS identifiers and plain prose after a secret word as credentials. Deploy scan turns these into credential findings that can't be overridden, and the member dashboard rewrites page BLOCKING — src/kiro_crew/deploy/scan.py:226 [BLOCK-MERGE] 41bc201 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 — 🔴 changes requested (blocking)GPT 6.1 found at least one blocking issue that must be resolved before merging This comment is updated in place on each push. BLOCKING -- scripts/gen_secret_catalog.py:715 -- Airtable PATs escape live redaction before vendor context arrives
Adjudication (Opus 5.5) — is blocking on each finding proportionate?F1 (fenced): I'm upholding it. Nothing has to line up unusually for this to happen. The Airtable PAT rule at False positive or not applicable? A repository writer can comment: |
Security Scope Review -- 🔴 could not complete (fails closed)No scope verdict for |
aadfe69 to
ca60662
Compare
|
|
|
|
|
|
|
|
ca60662 to
6a1aab9
Compare
|
|
|
[operator: bolichen97] Disposition for GPT 6.1 on 11fbc2d. Fixed on 9adca1b. F1 (credential_values.py:123), blank lines in quoted YAML: fixed. F2 (credential_values.py:160), XML values over lines: fixed.
F3 (credential_patterns.py:236), triple-quoted literals: fixed. The separator reads F4 (credential_values.py:568), encoded config lines: fixed.
Other lanes on 11fbc2d:
Verification: the backend lint gates pass. The local battery passed 27,431, and the earlier CI-failing modules passed 626. |
|
[operator: bolichen97] Disposition for GPT 6.1 on 9adca1b. Fixed on 2550983. F1 (credential_patterns.py:138), next-line values containing
F2 (credential_values.py:657), folded plain YAML values: fixed.
F3 (scan.py:297), standalone media bypass: fixed. In standalone mode, a base64 run that decodes to binary is no longer skipped. Its printable runs (a PNG Other lanes on 9adca1b:
Verification: the backend lint gates pass. The local battery passed 27,442, the earlier CI-failing modules plus the prefilter oracle passed 1,035, and the line budget was re-measured at 34,771. |
|
[operator: bolichen97] Disposition for GPT 6.1 on 2550983. Fixed on a7238fa, which is also rebased onto fresh main: #22887 had gone CONFLICTING. F1 (text_redaction.py:225), long values past the stream's hold: fixed. When a value runs past the hold, the stream drops it through the value's own close:
Rebase:
Lanes on 2550983:
Verification: the backend lint gates pass. The local battery passed 27,480. The earlier CI-failing modules, the prefilter oracle and the two files main touched passed 1,226. |
|
[operator: bolichen97] Disposition for GPT 6.1 on a7238fa. Fixed on 5d8d178. F1 (credential_values.py:756), quoted config values behind weak labels: fixed.
Lanes on a7238fa:
Verification: the backend lint gates pass. The local battery passed 27,487; its one failure was the case moved above, which now passes. The earlier CI-failing modules and the prefilter oracle passed 1,035. The line budget was re-measured at 34,807. |
|
[operator: bolichen97] Disposition for GPT 6.1 on 5d8d178. Fixed on 903e7a2. F1 (credential_values.py:786), short quoted passwords behind weak labels: fixed. A quoted value behind a weak label ( Tests: Lanes on 5d8d178:
Verification: the backend lint gates pass. The local battery passed 27,495. The earlier CI-failing modules and the prefilter oracle passed 1,035. |
|
[operator: bolichen97] Disposition for GPT 6.1 on 903e7a2. Fixed on c51a175. F1 (redaction_labels.py:1034, credential_values.py:704), long folded YAML values: fixed.
F2 (credential_values.py:357), vendor Identifier tier behind a generic label: fixed.
Lanes on 903e7a2:
Verification: the backend lint gates pass. The local battery passed 27,501 and the earlier CI-failing modules passed 1,035. The line budget was re-measured at 34,847. |
|
[operator: bolichen97] Disposition for GPT 6.1 on c51a175. Fixed on dea0017. F1 (credential_patterns.py:152), backtick-quoted values: fixed.
F2 (redaction_labels.py:121), name/value fields in any order: fixed.
Lanes on c51a175:
Verification: backend lint gates pass. Local battery 27,512 passed; earlier CI-failing modules 1,035 passed. Line budget re-measured at 34,897. |
|
[operator: bolichen97] Disposition for GPT 6.1 on dea0017. Fixed on 1274e13. F1 (text_redaction.py:500), a value streamed before its secret name: fixed. The stream's F2 (redaction_labels.py:149), braces inside quoted values: fixed. F3 (redaction_labels.py:146), upper-case fields: fixed. The pre-check is now case-insensitive ( Lanes on dea0017: First Principles is the product-shape BLOCK that the owner override covers on the final head. Verification: the backend lint gates pass. The local battery passed 27,534, and the earlier CI-failing modules passed 1,035. The line budget was re-measured at 34,965. |
|
[operator: bolichen97] Disposition for CI, CodeQL and GPT 6.1 on 1274e13. Fixed on 1e2b431. CI Backend Tests (3.12, 3) and (Windows, 3): fixed. CodeQL (1 new high): fixed. GPT F1 (redaction_labels.py:622), sibling fields far apart in the stream: fixed.
GPT F2 (text_redaction.py:1230), long backtick values: fixed. A backtick value past the hold now drops as Verification:
|
|
[operator: bolichen97] Disposition for GPT 6.1 on 1e2b431. Fixed on a5358d7. F1 (credential_values.py:235), YAML list-item values swallowing sibling fields: fixed.
Verification:
|
|
[operator: bolichen97] Disposition for GPT on a5358d7, fixed on f4b2c33:
Local gate (black, isort, flake8, mypy, repo checks, comment-history, semgrep) and the 294-module redaction battery (42,017 passed) are green. |
|
[operator: bolichen97] Disposition for Opus 5.5 on f4b2c33, fixed on 6448fce:
Red on f4b2c33, green now: |
|
[operator: bolichen97] Disposition for GPT 6.1 and Opus 5.5 on 6448fce, on fde20b7 (rebased onto main 2e0b123: one test conflict in GPT F1 (redaction_normalise.py:50, a password with GPT F2 (sibling readers skip the Twilio SK veto): fixed with the shared predicate. Opus B3 (pass/pwd/token false positives, URL
Opus B1 (AKIA/ASIA key IDs visible): rebutted. #22552 section 3 / Q1: a cloud key ID is Identifier tier. It names a key, is sent in cleartext in every SigV4 request and logged by CloudTrail, and cannot authenticate without the secret access key, so it is never redacted. The hard deploy verdict follows the same tier. Owner-approved design; see #22552 comment 6301939162 and decision record #22577. No code change. Opus B2 (a bare unlabelled 40-character secret is not caught after pass 3 was removed): rebutted. #22552 section 4: the entropy guess for a bare secret is removed, not narrowed. Case-insensitive labels and key-ID pairing are the control: an unlabelled 40-character value next to a key ID is a Secret. A secret pasted alone, with no label and no key ID, is the accepted residual. Owner-approved design; see #22552 comment 6301939162 and decision record #22577. No code change. Local gate and the 294-module redaction battery (42,073 passed) are green. |
|
[operator: bolichen97] Disposition for GPT 6.1 on fde20b7, fixed on 6342533 (rebased onto main 4c1536c: main moved the warm-brief shape tests to GPT F1 (redaction_labels.py:1248, an ANSI-coloured YAML block label streams its body): fixed, with two causes.
The Opus 5.5 run on fde20b7 failed in its discovery step ( |
|
[operator: bolichen97] Disposition for GPT 6.1 on 6342533, fixed on 203eb13: GPT F1 (credential_values.py:843, Literals stay redacted:
Red/green: |
Also on this head: the Fast Gate flake-ratchet red came from a wall-clock bound in that same test file; the bound is removed and only the correctness assertions remain. |
|
|
|
||
|
|
||
| def _holding_label(text: str, start: int) -> str: | ||
| match = _HOLDING_LABEL_RE.search(text[max(0, start - 96) : start]) |
|
Both findings fixed on
|
|
All three findings fixed on
Red 5 on the judged head, green 9 now. Full battery 42,085 passed (one unrelated push-guard timeout). |
|
Both findings fixed on
Red 5 on the judged head, green 8 now. Full battery 42,093 passed (one unrelated push-guard timeout). |
|
Disposition for GPT 6.1 on
Tests: |
|
Disposition for GPT 6.1 on
Opus 5.5 on Battery: 42,107 passed; one push-guard timeout outside this PR (passes alone). |
|
Disposition for GPT 6.1 on
Tests in |
Every redaction rule now carries a tier (Secret, Bearer link, Identifier), decided once by what a value can do, not guessed from its shape. - AWS access key IDs (AKIA/ASIA) are Identifier tier and stay visible on every surface; a signed link loses its signature and session token, not its key ID. - Labelled values keep their label and lose only the value (`api_key = [REDACTED: credential]`), so structured output still parses. Labels match case-insensitively with the usual word separators, cover generic secret fields and Authorization Bearer/Basic, and are shared with the log filter, which now redacts the Secret tier too. - A 40-character secret-shaped value next to an AWS key ID is the secret half of the pair; the key ID stays. - Every rule also runs over a normalised view (percent-decoded, JSON-unescaped, control and invisible characters dropped), with spans mapped back to the original text. Base64 decoding covers URL-safe and wrapped runs. - The entropy guess for unlabelled values is removed, with every exemption that existed only for it (document and diagram links, commit permalinks, macOS temp-dir ids, the code-text scope). - The stream redactor holds a value with any secret label while it may still be arriving. - A vendor token catalog is generated at build time from the Betterleaks rule set (MIT) by scripts/gen_secret_catalog.py into src/kiro_crew/data/secret_catalog.generated.json; a finding whose value is an identifier shape is dropped. No new runtime dependency. Closes #22552
|
Disposition for GPT on 9a5c48f, Opus on 41bc201 and CodeQL on 9a5c48f. Fixed in 56d1b35. GPT F1 (fixed): a percent-encoded signed link ( CodeQL (fixed): two polynomial-regex alerts.
Opus, per the maintainer ruling:
Checks: battery 42,123 passed; lint, mypy, semgrep and the flake ratchet pass. |
|
Closed by the owner (bolichen97): cancelled for now. The branch |
Do not merge: waiting for design approval on #22552.
Problem / Motivation
Goal: Redact every secret and never an identifier, by deciding once, per rule, what a matched value can do.
Today each redaction rule decides sensitivity on its own. AWS access key IDs are removed from every log row and CloudTrail record, so an investigator loses the value they join on. A JSON field loses its label along with its value and stops parsing. A secret behind an upper-case or camel-case label, or in an escaped form, is missed. A guess by entropy for unlabelled values removes digests, request IDs and inline images, and needs a new exemption for every false positive.
Why it matters
People investigating incidents cannot read the logs and transcripts Kiro Crew writes, because identifiers are replaced. Secrets in common spellings still reach the screen, the log and chat channels. Every new false positive costs another one-off exemption, and those exemptions have been a source of leaks themselves.
Not a goal
What changed (motivation → approach → change)
The design is in #22552 (tier model, section 3; detection, section 4); the tier decision is recorded in
docs/decisions/2026-10-20-redaction-classifies-by-what-a-value-can-do.md.{"SecretAccessKey": "[REDACTED: credential]"}still parses. Labels match in any case and spelling, after=,:,=>, an XML tag or a siblingname/valuepair; generic secret fields andAuthorizationBasic/Bearer are covered. The log filter now applies the same Secret tier.scripts/gen_secret_catalog.pygeneratessrc/kiro_crew/data/secret_catalog.generated.jsonfrom the Betterleaks rule set (MIT, licence kept in the file) at build time. Rules that need a filter program, a file path, or are not linear-time in Python'sreare skipped; a finding whose value is an identifier shape is dropped. No new runtime dependency.get_credential_patterns()read the same records and labels; a deploy finding names its rule and length, never a character of the value.Where. Shared spellings live in
src/kiro_crew/credential_patterns.pyand feedsrc/kiro_crew/log_redaction.pyandsrc/kiro_crew/deploy/scan.py. The key-ID copies leavesrc/kiro_crew/sel.py,src/kiro_crew/metrics/schema.py,src/kiro_crew/decisions/gate.py,src/kiro_crew/security_posture.py,src/kiro_crew/platform/, the built-in apps undersrc/kiro_crew/apps/,src/kiro_crew/computer_use/,src/kiro_crew/testing/fake_computer_use.py, and the frontendwebsite/src/utils/sanitize.ts,website/src/utils/errorReport.tsandwebsite/src/apps/mochi/src/shared/utils.ts(signed links keyed on the signature inwebsite/src/utils/credentialSignature.test.ts; fixtures inwebsite/src/test/).setup.cfgpackages the catalog;.github/drops the removed module from a path list.This carries the work of #22757, #22736 and #22737 in one commit.
Backwards compatibility
Breaking: AWS access key IDs are no longer redacted or blocked, an unlabelled value with no prefix, label or key ID beside it is no longer redacted, and the redacted text now keeps a value's label. Writer sweep on origin/main: every in-repo caller of the removed helpers is updated in this diff (listed below); stored transcripts are unchanged, and credential records naming the old rule id still resolve.
Reader: src/kiro_crew/security/exfil.py:_oauth_url_payload_diagnostic call site -- chat -- scans with
_contains_fixed_credentialonly;test_security.pyReader: src/kiro_crew/security/exfil_oauth.py:_safe_oauth_parameter_name -- chat -- same;
test_security.pyReader: src/kiro_crew/security/display_safety.py:sanitize -- chat -- same;
test_display_redaction_source_guard.pyReader: src/kiro_crew/dashboard/chat_utils_display.py:_display_scope_changes_battery -- crew page -- reads only the owner-view scope;
test_display_time_redaction.pyReader: src/kiro_crew/dashboard/handlers/member_dashboard.py:_template_text_safe -- crew page -- script and style text get the same pass;
test_member_dashboard_routes.pyReader: src/kiro_crew/dashboard/file_api/project_dirs.py:_redact_project_path -- crew page -- canonical redactor;
test_project_git.pyReader: src/kiro_crew/dashboard/display_verdicts.py:_rules_fingerprint -- crew page -- new rule files are in the digest, so stored verdicts are recomputed;
test_display_time_redaction.pyReader: src/kiro_crew/security/credential_sources.py:_AWS_TEMPLATE_KEYS -- chat -- keeps the old rule id for existing records;
test_credential_sources.pyReader: src/kiro_crew/security/stream_aws_anchor.py:names_a_key -- chat -- reads the shared label table;
test_stream_redactor_aws_keyed.pyTests
test/test_redaction_context_rules.py: everyday inputs (CloudTrail row, assume-role output, env dump,~/.aws/credentials, escaped JSON, percent-encoded values, CSV pair, SigV4 header, presigned S3 and CloudFront links, base64 INI, Basic header) lose every secret and keep every identifier; label shapes beyondkey=value; fields that name no secret stay; stream splits mid-label, mid-URL, after each separator, across invisible characters and beside a key ID.test/test_secret_catalog.py: one test per ported vendor rule with a sample generated at test time from the rule itself, the Go-to-Python translation cases, the identifier veto, and a zero-noise check over the repository's own docs.test/test_redaction_tiers.py,test/test_log_redaction.py,test/test_redaction_key_id_identifier.py: tiers for the new rules, the log Secret tier, and key IDs kept.Manual verification
N/A — unit coverage sufficient: the change is text-in, text-out, and every surface is covered by the tests above. An independent read of the diff looked for secrets that survive; the shapes it found are fixed and pinned in
test_redaction_context_rules.py.Screenshots / video
Why no screenshot: the frontend change only swaps which strings the shared sanitizer replaces (key IDs stay, signing values go), so no panel, layout or component renders differently.
Related Issues
Closes #22552
Pattern harvest
Rule candidate: review-prompt
Pattern: a redaction rule that decides sensitivity from a value's shape instead of reading its tier from the shared table
Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)