Repository navigation
fix(security): keep commit permalinks whose query carries a git object name - #19540
Conversation
Sensitive Change ReviewSensitive files changed:
|
43b8417 to
a3861b9
Compare
Sensitive change review
|
a3861b9 to
39b8a38
Compare
Sensitive change review
|
UX Review (Opus 5.5) — ✅ PASSUX-level review of UX-Verdict: PASS Nothing to check. The change is a heuristic inside [UX-REVIEWED] ce995e1 Description read[DESCRIPTION-READ] c84c6d4a578bca7483db6f4011db2a988def6dda2187c2509c375a835f8f2106 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 Nothing blocks: the carve-out removes the redaction of query-borne 40-hex commit links on both surfaces. Two small riders are notes. Notes
What this change shipsInventory (7 items) — 5 justifiedIntent: a commit permalink with its hash in the query still renders as a link in chat. FIX.
[FIRST-PRINCIPLES-REVIEWED] ce995e1 Description read[DESCRIPTION-READ] 492f16f6237915224d330e9996067fcf21bbc3b0b5b786ee71482891f56af969 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 carve-out is limited to an exact 40-character lowercase hex match, the Python and browser checks are changed the same way, and it opens no channel that the path, already treated as benign, doesn't have. Notes
[DESIGN-REVIEWED] ce995e1 Description read[DESCRIPTION-READ] d4a93cbc63a0c2f4c3b6487dffb39b26517f1060c96cc3aa4c817abced09c13d 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 |
Opus 5.5 Review — ✅ no blocking findingsReviewed Review detailsNo findings. Notes:
[OPUS-REVIEWED] ce995e1 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: |
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: This diff loosens a check; nothing in it gets stricter. It removes one shape, an exactly 40-character lowercase-hex git SHA-1, from the base64-blob heuristic. That heuristic is used by the URL redaction/display path and the OAuth diagnosis, and none of the three shell checks ( TIGHTENING: none. The only behavioural change is a narrowing in ADJUDICATED: 16 candidates, 0 confirmed newly-refused PLATFORM COVERAGE: posix and windows. The diff makes no path, separator, interpreter or environment-variable assumption. The only thing it keys on is a string's alphabet (
Two neighbouring rows sit next to the carve-out: a 64-hex checksum (deliberately not carved out) and a routed UNADJUDICATED: The classifier cannot reach the changed guard, so the following could not be adjudicated:
These are the inputs I would have submitted as prose. Each still passes through the regex unchanged, so each should still render exactly as before:
The diff's own tests pin each of these as still redacted. None of them is newly refused by construction. One residual for the other lanes, stated in the module's own header: a credential that is exactly 40 lowercase hex characters in a query now passes this heuristic. That is a question of whether the guard is strict enough, which is not this lane's. [SCOPE-REVIEWED] ce995e1 |
39b8a38 to
5b3e184
Compare
Sensitive change review
|
5b3e184 to
7731617
Compare
|
fixed -- GPT 6.1 BLOCKING
|
Sensitive change review
|
|
target=first-principles head=773161797083f15f256fdf2c399dc82b63867a28 span=residual needs-a-decision -- First Principles PASS punchline: accept the residual that any 40-lowercase-hex token in a query passes the blob heuristic.
|
|
@CrysisDeu I rebased this PR onto main (exfil.py was split by #22158) and narrowed the carve-out to SHA-1 only, after GPT 6.1 found that 64-hex values match this product's own app secrets. Head is now 7731617. Sensitive Change Review only accepts the template from the PR author (or a reviewer's Approve review). A filled template for this head is in the comment above (issuecomment-6275829776). Could you re-post it as your own comment, or could a reviewer paste it into an approval? Every other check is green. |
Sensitive change review
|
dada3da to
e5c6465
Compare
Sensitive change review
|
e5c6465 to
19b9120
Compare
Sensitive change review
|
Sensitive change review
|
|
HOLD at 2f65aa1. This head moves the carve-out into its own owner module and registers it in the facade, the display battery and the security spec. I found no definite defect. The new predicate fires on a subset of the old matches. It skips only a maximal run of exactly 40 lowercase hex, so 64-hex app secrets, longer runs, mixed case and padded runs still redact: KiroCrew/src/kiro_crew/security/exfil_git_object.py Lines 29 to 39 in 2f65aa1 What holds it:
— crew-pr-reviewer (r138) |
Sensitive change review
|
Sensitive change review
|
…t name The exfil base64-blob heuristic matched a bare 40- or 64-hex git SHA in a URL query, so a commit permalink keyed on the SHA was rewritten to [REDACTED: suspicious URL to <host>] on every surface while the same SHA in a path was already benign. Judge each maximal blob match against the exact git lengths in lowercase, on the backend and in the browser mirror, and pin the carve-out's edges so neighbouring shapes still redact.
…_object exfil.py would reach 2,016 lines on current main, past the 2,000-line file cap. Move this PR's own helper (_GIT_OBJECT_NAME_RE and _exfil_blob_hit) verbatim into a new owner module beside it, join it to the facade's _OWNERS and the display battery's rule sources, and re-import both names into exfil.py so every caller's import path is unchanged.
Sensitive change review
|
Problem / Motivation
Goal: A link to a commit stays a link in chat, even when the commit's hash is in the link's query.
Some code-hosting and build tools put the full git commit hash in the URL query, like
…/history?commit=<40 hex chars>or…?changes=<package>/<branch>:<40 hex chars>. When an agent relays such a link, the dashboard shows[REDACTED: suspicious URL to <host>]instead of the link. The user cannot read or copy it. The same hash in the URL path (…/commit/<40 hex chars>) already renders fine, so the two spellings of one permalink disagree.Why it matters
Commit permalinks are one of the most common links an agent relays after a build, a review or a deploy. Every one of them with the hash in the query is lost on the owner-facing surface, while the same text posts intact through tools. Users cannot act on what the agent found.
Not a goal
Intended? / Repro
Intended? No. Redacting a query-borne git hash is a side effect of the blob heuristic's alphabet, not a recorded decision. Sources on
main:src/kiro_crew/security/exfil.py(comment above_HARD_CREDENTIAL_RE): the blob/length heuristics "stay query-only (long base64 PATH segments — CDN asset ids, git object hashes — are benign)". Git hashes are named as benign; only their position (path vs query) kept the query form flagged.src/kiro_crew/security/redaction.py(_HEX_ONLY_RE, bare-secret gate 3): "All-hex runs are git SHAs (40 hex), sha256 (64 hex), md5 (32 hex), etc. — never an AWS secret key … Reject them outright." The sibling detector already treats all-hex as non-secret.test/test_exfil_base64_padding.py::test_forty_hex_value_is_redacted: "A 40-hex value is still a 40-char run; narrowing it is out of scope here." The behaviour was pinned as a known, deferred narrowing when=was removed from the class, not as a design goal.docs/request-for-change/or spec underdocs/system-specs/names hex runs as a shape the URL redactor must flag.Repro on
main(origin/main@ebe8a183b5aa):_EXFIL_PATTERNSas spelled onmain,[A-Za-z0-9+/]{40,}={0,2}|…, run as a plain regex over the two query shapes from the report:commit=<40 hex>andchanges=Commit:pkg/mainline:<40 hex>both match, with the match being exactly the 40-hex hash. The query gate calls.search()on that pattern, soredact_exfiltration_urlsrewrites the URL.main:test_forty_hex_value_is_redacted(Python) and'redacts a 40-hex value'(vitest) are green onmain, which is the redaction asserted as a passing test on both surfaces. This PR flips both.test_acp_structured_refusal,test_decisions_gate,test_decisions_points,test_workflows_app) went red because their "any flagged payload" fixture was"a" * 40/"b" * 40, i.e. a 40-hex run. That those fixtures redacted onmainis the same symptom from a second direction.What changed (motivation → approach → change)
Symptom: a URL whose query carries a 40-hex git hash is redacted on every surface.
Root cause: the exfil heuristic's base64-blob branch is
[A-Za-z0-9+/]{40,}. Every hex digit is in that class, so a 40-hex hash is a 40-char "blob". The heuristics are query-only by design (the path already treats long base64-ish segments, git hashes among them, as benign), which is why the path spelling renders and the query spelling does not. No host exemption can fix this on the dashboard: the browser mirror insanitize.tshas no exemption concept at all.Change: judge each MAXIMAL blob match, and skip it when the whole match is exactly 40 lowercase hex digits (a SHA-1 git object name). 64 hex (SHA-256) is not carved out: it is the shape of this product's own secrets (
secrets.token_hex(32), e.g.generate_app_secret()), so it keeps redacting._exfil_blob_hit()wraps_EXFIL_PATTERNSinsrc/kiro_crew/security/exfil.pyandexfilBlobHit()wrapsEXFIL_B64_REinwebsite/src/utils/sanitize.ts; both replace the bare.search()/.test()at the query gate and in the privacy-safe diagnostic. The regex spellings themselves are untouched, so the existing parity pins keep holding, and a new parity pin fixes the carve-out's shape on both halves.Why the maximal match:
{40,}is greedy, so a hash glued to any other base64 character (x<sha>,<sha>=,<sha>/abc), 41+ digits, or mixed case is a longer or wider run that fails the exact-length full match and keeps firing. A secret cannot hide by containing or abutting a hash.Residual, stated: a 40-hex API token in a query no longer trips this one heuristic. It was never caught by the fixed credential markers (those key on provider prefixes), and the length gate still bounds the query. The bare-secret detector in
redaction.pyalready rejects all-hex runs on the same reasoning (hex is a 16-symbol alphabet, not a base64 payload).Backwards compatibility
Compatible: nothing that renders today stops rendering; one more URL shape renders. No API, type, key or validator changes.
Removes nothing: the change only narrows what the blob heuristic flags; no path, record, key or function is removed or renamed.
Tests
test/test_exfil_git_object_name.py(new): 40-hex query values are kept, also after a routedpkg/branch:prefix, two in one query, and throughredact_exfiltration_urls_with_records. Edges still redact: 64 hex (app-secret shape), 41 hex, 65 hex, mixed case, uppercase,=padding, hash glued to a letter or a slash run, a percent-encoded separator glued to the hash (its hex octet joins the run in the raw query), 48 hex, 40 lowercase non-hex. A hash beside a real blob or an AWS key id still redacts; five hashes still trip the length gate._exfil_blob_hitleaves the AWS/Slack/SSH/percent alternatives unchanged.website/src/test/sanitizeExfiltrationGitObjectName.test.ts(new): the same matrix in the browser mirror, plus a markdown link target.test/test_exfil_base64_padding.pyandsanitizeExfiltrationBase64Padding.test.ts: the pinned "40-hex value is redacted" cases flip to "kept"; that earlier change had marked narrowing it as out of scope.test/test_redaction_mirror_parity.py:TestGitObjectNameCarveOutMirrorpins the[0-9a-f]{40}spelling on both halves."a" * 40,"b" * 40) as "any payload the heuristic flags" now use"x" * 40, since a 40-hex run is exactly the shape this PR keeps:test_acp_structured_refusal.py,test_decisions_gate.py,test_decisions_points.py,test_workflows_app.py. What each test asserts is unchanged.test/test_security_gate_liveness.py: the security package line budget is raised 31,509 -> 31,532 for the helper, with the customary paragraph.Manual verification
N/A — unit coverage sufficient: the change is a pure function on the URL text, exercised on both surfaces by the tests above.
Screenshots / video
Why no screenshot: the only rendered difference is that a link renders as a link instead of a text placeholder, which the vitest cases assert directly.
Related Issues
Related to the redaction false-positive family (#15565).
Pattern harvest
Rule candidate: review-prompt
Pattern: "a character-class heuristic (
[A-Za-z0-9+/]{N,}) applied to a value family that contains a well-known fixed-length sub-alphabet (hex digests) — check the sub-alphabet is carved out, on every mirror".Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)