Repository navigation
fix: keep the key when redacting an aws key-value credential - #32401
Conversation
Sensitive Change Review
|
9c1eb17 to
c50c057
Compare
|
Rebased: main moved in docs/system-specs/modules/security.md, test/test_security_gate_liveness.py since this head went green (d27a5fd -> 21597a3); CI re-running. The rebase conflicted on the security package line budget, now stacked on main's new value, and the amend moves the two backend tag literals in the dashboard scan into the [operator: bolichen97] |
UX Review (Opus 5.5) — ✅ PASSUX-level review of UX-Verdict: PASS Nothing to check. The diff only changes how the sanitizer treats a value the backend already redacted. It adds or changes no control, and a missing screenshot is no gap here. Notes
[UX-REVIEWED] 1c6ae05 Description read[DESCRIPTION-READ] d933b427f79025b7047c2e048c53ada076e0daf6b08b22bc5af0e9205a267b41 That sha256 names everything this verdict read: the PR description, plus the 3 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 One mechanism-level fix with a linked issue (#22576) and a test that fails on main. It adds no new surface. What this change shipsInventory (3 items) — 3 justifiedIntent: in the dashboard, an approval or workflow-run label that holds an AWS key the backend already redacted keeps the key name and the backend's tag, instead of being garbled to
[FIRST-PRINCIPLES-REVIEWED] 1c6ae05 Description read[DESCRIPTION-READ] a6851011f290bd13851540a3b0dfa68f69934a36810a91a0016d2f9124d8e54c 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 fix is small, sits in the one reader that mangled the backend's tag, and is safe because it only skips placeholders, which hold no secret. Notes
[DESIGN-REVIEWED] 1c6ae05 Description read[DESCRIPTION-READ] ab2bb85a725a333803990aea15de32b9033c315d71bc0f7871723c7bf2e69fb8 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 |
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: |
Security Scope Review -- ✅ PASSWhich legitimate operations does Verdict basis: adjudicated, zero confirmed regressions. Security scope review -- adjudicated candidates
No candidate flipped from allowed to refused. Scope-Verdict: PASS Reason: Nothing here tightens a shell rule. The diff makes output redaction looser: pass 1 now keeps the AWS key-value label and replaces only the value, and it skips a value that is already a credential tag. No shell deny tier calls TIGHTENING: There isn't one. The patch narrows the pass-1 redacted span and adds a skip: ADJUDICATED: 16 candidates written. The confirmed newly-refused count is not available to this review: no verdicts have come back yet, so I report no regressions. PLATFORM COVERAGE: I wrote rows for posix and windows. The diff assumes no path, separator, interpreter or environment variable. The posix rows cover the AWS CLI credential-view commands that the credential-sources record recommends, grep over UNADJUDICATED:
[SCOPE-REVIEWED] 4e73899 |
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: |
c50c057 to
fc0c4a2
Compare
|
[operator: bolichen97] Rebased onto main fe2d88c to clear the merge conflict (head fc0c4a2).
|
fc0c4a2 to
4e73899
Compare
|
[operator: bolichen97] New head 4e73899 (rebased onto main 273fa43). It fixes both blocking findings the GPT 6.1 and Opus 5.5 lanes raised on fc0c4a2, in
|
|
|
Thanks for picking this up and carrying it to main. One gap I found while comparing it with #28522, which I'm closing in favour of this PR: The batch pass keeps the key, but the stream redactor's fail-closed drop still takes it. When a streamed AWS value outgrows the holdback ceiling, On head 4e73899, for example: Offer. #28522 handles this in about 30 lines:
You're welcome to take it in directly. What actually differs. I ran #28522's tests against this branch at 4e73899. Every case that passes on both is left out:
Everything else passes on this branch: the other 292 backend cases (across |
|
[operator: bolichen97] Thanks for comparing the two, and for closing #28522 in favour of this one. I'm keeping the stream ceiling out of this PR. Its Not a goal list names both the stream redactor's over-ceiling drop and the dashboard mirror's own redaction of a raw value, and the goal stays as written. Your label-keeping branch before the drop ( One thing still holds this PR: the Opus finding above. With the key kept, |
|
[operator: bolichen97] Status on head 4e73899:
|
The backend redactor now keeps an AWS key's label and masks only its
value, so {"aws_secret_access_key": "<secret>", "region": "x"} keeps
its key and still parses. The dashboard sanitizer read that output as
a raw key assignment: sanitizeLlmOutput turned
aws_secret_access_key=[REDACTED: credential] into
[REDACTED] credential], dropping the key the backend kept and garbling
the tag on the approval prompt and the workflow run labels.
The sanitizer's key-assignment reader now leaves a value that is
already a backend tag, after an opening quote that may be JSON-escaped,
as written. A raw value is still redacted. The security spec's frontend
sanitizer bullet says the same.
Builds on #28522 by @dodgeblaster.
Closes #22576
Co-authored-by: Gary Jennings <garysjennings@gmail.com>
4e73899 to
1c6ae05
Compare
|
[operator: bolichen97] Rebased onto current main to resolve the merge conflict in |
KiroCrewCaptain
left a comment
There was a problem hiding this comment.
I reviewed head 1c6ae05, which changes only the dashboard sanitizer's AWS key-assignment reader, its test, and one line of the security spec. The old pattern stopped at the space inside the backend's tag, so skipping a value that is already a tag uncovers nothing that was masked before. I checked that the AWS keys, key assignments and JSON fields that follow are still redacted. The sanitizer suites pass on this head, and the new test fails against main's sanitizer, so it really pins the fix. I found nothing that blocks.
Problem / Motivation
Goal: Redacting an AWS key-value credential keeps the key name and replaces only the value, so a JSON document or config line holding one keeps its shape after redaction.
The three AWS key-value branches of the credential redactor (
aws_secret_access_key/SecretAccessKey,aws_session_token/SessionToken,aws_access_key_id/AccessKeyId) replace their whole match, key included.{"aws_secret_access_key": "SECRET", "region": "x"}becomes{"[REDACTED: credential]", "region": "x"}: the document no longer parses, and the reader cannot tell which field was removed.Builds on #28522 by @dodgeblaster.
Why it matters
Anyone who opens an AWS credentials file, an STS or CloudFormation JSON output, or a config holding an AWS key through the dashboard or a tool result gets a document that no longer parses, so the Files view reports a valid file as invalid JSON and the agent reads a broken document.
Not a goal
Authorization: Bearerbranch: that is file viewer: credential redaction consumes the JSON key, so any file holding an Authorization header renders as "Invalid JSON" #13873, fixed in fix: keep the key when redacting an authorization bearer header #32367; the two touch the same pass-1 lines, and whichever lands second rebases onto the other.[REDACTED]over the key and value.What changed (motivation → approach → change)
The backend half of this fix has landed on main by another route: the rule-table redactor (#37408) replaced pass 1 and masks only the value of an AWS key-value credential, so
{"aws_secret_access_key": "<secret>"}keeps its key and still parses. The rebase onto it takes main's side forsecurity/redaction.pyand its tests.What is left is the dashboard mirror.
sanitizeLlmOutput(the approval prompt's label, the workflow run labels) reads the backend's outputaws_secret_access_key = [REDACTED: credential]as a key assignment with a raw value and rewrites it to[REDACTED] credential], dropping the key the backend kept and garbling the tag. Its key-assignment reader now leaves a value that is already a backend tag as written.website/src/utils/sanitize.ts,CredentialScan.keyAssignmentaws_secret_access_key = [REDACTED: credential]becomes[REDACTED] credential][REDACTED: encoded credential]aws_secret_access_key = abcbecomes[REDACTED]The security spec's frontend sanitizer bullet says the same.
Backwards compatibility
Compatible: every raw value after an AWS key is still redacted, at the same span; only a value that is already a backend tag, which holds no secret, is now left as written.
Removes nothing: the sanitizer stops rewriting a backend placeholder and masks every value it masked before.
Tests
website/src/test/sanitizeCredentials.test.ts: a value the backend already replaced with its tag (plain, single-quoted, the encoded-credential tag, and a JSON-escaped quote inside a serialized string) is left as written; a raw value after the same key is still redacted.Proof: not provable -- frontend test (prove.py runs Python only)
Manual verification
N/A — unit coverage sufficient: the change is one reader of a pure string function, and the new test fails on main (the tag is rewritten to
[REDACTED] credential]) and passes on this head.Screenshots / video
The earlier captures showed a transcript whose AWS keys the backend now keeps on main, so they no longer show this diff and are removed. This diff changes only the text of an approval prompt label or a workflow run label that holds an already-redacted AWS key, which the new test pins; it touches no component, page or style.
Related Issues
Closes #22576
Sibling sweep
Swept: git grep -nE "SecretAccessKey|aws_secret_access_key|token|secret" -- website/src/utils/ src/kiro_crew/security/redaction_structured/
Sibling: website/src/utils/sanitize.ts -- changed here
Sibling: src/kiro_crew/security/redaction_structured/table.py -- not affected -- main's AWS label rows mask only the value and leave an exact tag alone
Sibling: website/src/utils/errorReport.ts -- not affected -- its generic secret and token replacer (
redactSecrets, run aftersanitizeLlmOutputon a workflow run error) keeps the key; it rewrites only the first word of a backend tagPattern harvest
Rule candidate: review-prompt
Pattern: a redactor's mirror that re-reads the other side's output must treat that side's placeholder as a value already redacted, or it garbles the tag and drops the key the other side kept.
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.