Repository navigation
feat(security): companion URL-prefix seam for token= redaction - #18287
Conversation
UX Review (Opus 5.5, fork) — ⏭️ skippedRevision |
Design Review (Opus 5.5, fork) — 🟡 CONCERNSDesign-level review of Design-Verdict: CONCERNS Pass 4 now has a ~175-line hand-written exemption parser in the redaction core, for one edition's link shape that the public build never turns on. Watch
Suggestions
[DESIGN-REVIEWED] 88c8815 Description read[DESCRIPTION-READ] 58bed5cab202c2b33f4d2b7afe8a45a9e6147b6dbb2ebc418a69bc3684a8f7fd 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 Nothing in the tree uses the new Not justified as shipped
What this change shipsInventory (7 items) — 6 justifiedIntent: let an edition keep a user-facing approval link clickable even though its URL carries
[FIRST-PRINCIPLES-REVIEWED] 88c8815 Description read[DESCRIPTION-READ] 18c261d48de882b089e4a3bac54676ea5491dee92bc4e1a8c29a5be4480ba50a That sha256 names the PR description this verdict read. Recompute it with |
|
Maintainer takeover needed: this fork PR changes Note for the rollup: the red PR Hygiene is from the 00:39 run, which read the original description. The current description passes |
GPT 6.1 Review (fork) — ✅ no blocking findingsReviewed Review detailsNo findings. |
Security Scope Review (fork) — 🟡 CONCERNSWhich legitimate operations does the reviewer's own judgement; no confirmed regression Scope-Verdict: CONCERNS TIGHTENING: The diff does not change the shell deny composite ( ADJUDICATED: 12 candidates, 0 confirmed newly-refused (no harness verdicts returned to this review; no row is reported as a regression) PLATFORM COVERAGE: Candidates cover posix (venv UNADJUDICATED: The guard that actually got stricter is output redaction, not the tool-call gate, so the classifier cannot give a verdict on it.
[SCOPE-REVIEWED] 88c8815Security scope review -- adjudicated candidates
No candidate flipped from allowed to refused. |
Opus 5.5 Review (fork) — ✅ no blocking findingsReviewed |
|
Context for why this seam is worth adding:
|
52ecb62 to
e4fd82e
Compare
|
|
e4fd82e to
fed97cf
Compare
|
self-added: yes
|
fed97cf to
48995a9
Compare
|
self-added: yes
|
|
Re Opus 5.5 advisory FINDING on fed97cf (live chat streaming bypasses the nested-destination guard): fixed in 48995a9 by the same change as the GPT finding above. |
|
|
|
|
|
This PR adds a CredentialPolicy.token_param_exempt_url_prefixes() hook. It lets a companion package exempt the ?token= value of approval links under listed https://host/path prefixes from pass-4 redaction. The public default is an empty set, so this repo's behaviour does not change, and streamed deltas defer the exemption. HOLD because it changes credential redaction, Sensitive Change Review is red, and all three current-head lanes (Design, First Principles, Security Scope) are CONCERNS. First Principles notes the hook has no consumer and no issue behind it. Design notes that the exemption turns off after any earlier URL, & or <, so a real approval link may still not be clickable. I tried to get past it. A host-only prefix is refused by the https://host/path grammar. "https://evil/x#https://host/approve?token=S" and nested-URL forms are refused by the "://" and destination-signal scan of the preceding text. The value must be one URL-safe run, so I found no bypass in the code I read. A maintainer needs to decide whether an unused redaction exemption seam belongs in core before the companion that uses it exists. — crew-pr-reviewer |
5909b4f to
188fc0a
Compare
|
Rebased onto main |
|
Rebased onto main 5052ddd to clear the merge conflict; head is now 129ed41. Only conflict was The reds on 188fc0a were not from this change: Dependency License Gate ("Dependency review is not supported on this repository", a repo setting), Internal Content Scan and Opus 5.5 Review (fork jobs "could not run"), and Backend Tests (Windows) (2) |
|
Rebased onto main |
|
Rebased onto current |
|
Rebased onto main |
|
Rebased onto main |
|
Rebased onto main |
|
Re-pushed as |
|
Rebased onto main |
|
Rebased onto main |
Pass 4 redacts every token= URL value by name with no host seam, so a one-time approval-workflow link a user must open is never clickable. Add CredentialPolicy.token_param_exempt_url_prefixes() (default empty). Pass 4 skips a value only when the literal ?token= directly follows a member https://host/path prefix and no earlier pass claimed any of the value. Read lazily via installed_context() with the exempt_exact_hosts degrade contract; the display memo key now covers the prefix set.
|
Rebased onto main |
Problem / Motivation
Goal: Let an edition keep a user-facing approval link clickable even though its URL carries a
token=parameter.Redaction pass 4 (
_credential_redaction_plan) replaces the value of everytoken=URL parameter with[REDACTED: credential]. That is the right default, but there is no seam around it. Some links the user must open carry a token that is a lookup key, not a bearer credential. A credential broker's one-time approval-workflow link is one: the agent hands it to the user, and the user has to click it before the agent can continue. Today it renders ashttps://<broker>/auth?token=[REDACTED: credential], so there is nothing to click.CredentialPolicy.exempt_exact_hosts()does not help: it only relaxes the exfiltration heuristics and never reaches pass 4.Why it matters
The agent stops and waits on an approval the user cannot reach. The only workarounds today are an edition monkey-patching the private
_credential_redaction_plan, or the user re-running the request outside the agent.Not a goal
https://host/pathprefix directly before?token=is exempt.website/src/utils/sanitize.ts) or the per-workspace "Allow for this host" list.&,<orscheme:disables the exemption for every later link in that message, so it is clickable only when it comes before them. This limit is accepted: it errs toward redaction, and a positive link-span parser to lift it is a separate design.What changed (motivation → approach → change)
CredentialPolicy.token_param_exempt_url_prefixes()inplatform/interfaces.py, default inplatform/defaults.pyfrozenset(). Returnshttps://host/pathprefixes. The companion also lists the host inexempt_exact_hosts(), since exfiltration redaction runs first.security/redaction.py_credential_redaction_plantoken=value alone only when all five hold: literal?token=right after a member prefix; the prefix's whitespace-delimited left context is empty, one of<"'`*, or exactly a markdown[label](opener; the text before it, with earlier exempt links blanked, holds no destination syntax (//,\,scheme:followed by non-space, any&, or any<other than the link's own autolink opener); the value is one run of URL-safe/base64/percent-encoded characters plus trailing closers; no earlier pass claimed any of it._token_param_exempt_prefixes()PEEK_CALLERSinplatform/context.py.StreamRedactorinsecurity/__init__.pychat_runner._redact_segment_text) and shows it clickable.redact_credentials(..., defer_token_param=True)at the one per-delta site indashboard/chat_runner.pytoken=value no earlier pass touched (a partly claimed value is redacted per delta as before), so a delta cut inside the link (ple.com/auth?token=...) cannot redact a value the whole text exempts; every other pass still runs per delta, the live wire still goes throughStreamRedactor, and with the empty default the output is byte-identical.dashboard/chat_utils.pyThe boundary and one-run rules matter: without them, a copy of the prefix nested in another URL (
https://redirect.example/?next=(https://host/path?token=...)) would carry the token to that URL, and a second URL glued after the value (...?token=k),[B](https://svc/cb?token=SECRET)) would come through in plaintext, because pass 4's value class admits),(,[,:and?. Either shape is redacted whole, as on main. Whitespace alone cannot prove the prefix starts a new destination, because URL parsing strips tabs and newlines and a space is not a terminator inside an HTML attribute, so any destination syntax earlier in the text disables the exemption. The scan reads raw text and never decodes: any&or<counts, because a renderer can decode a character reference such as/into a destination. A link that follows an unrelated URL is therefore redacted; that is the safe direction. The docs entry is indocs/system-specs/modules/platform-context.md.Backwards compatibility
Compatible: the default prefix set is empty, so pass 4 redacts exactly what it redacts on main unless a companion opts in.
Removes nothing: the change only adds a hook and an opt-in skip; no path, key, record or public function is hidden, renamed or removed.
Tests
test/test_security.py::TestTokenParamExemptUrlPrefixes:http, other path, sub-path, later parameter, case variant, HTML-entity separator, glued prefix, and the prefix nested in another URL after=,/,#,:,@,(,[,<, a quote, a backtick or*, including inside a markdown link, and nested behind a tab, newline, carriage return or space inside an HTML attribute or<...>destination, behind//host,https:\\hostorhttps:host, or spelled with character references (//,https://,//). Several approval links in one list all stay exempt.StreamRedactornever yields the token, a plain link streamed alone stays redacted in the stream, and the suspension resets after a redactor exception.),[B](...?token=SECRET),?token=k?token=SECRETand similar) stays redacted, and the redacted output is a fixed point.test/test_token_param_stream_deferral.pystreams the approval link through the real_run_chatper-delta path in 1, 6 and 40-char chunks: with a prefix installed the stored segment keeps the full link at every size while the live wire still redacts the value; with no prefix the stored segment stays redacted; a non-exempt?token=SECRETsplit across deltas is still redacted in the stored segment with the prefix installed; a value whose head pass 1 already claims (?token=AKIA...<opaque>) loses its opaque tail too, and a whole value after it in the same delta is still deferred; and the keyword alone is byte-identical to the plain call without a prefix set and still runs passes 1-3 with one.test/test_display_redaction_source_guard.pyallows exactly the two mutable readers the battery has.dashboard/chat_utils.pyadds the prefix set to the display-cache MAC input only when it is non-empty, so the default key is byte-identical to main.test/test_security_gate_liveness.pyre-pins thekiro_crew.securityline budget to the new total.Manual verification
Run locally on
96c00c10:pytest -n0 test/test_display_redaction_source_guard.py test/test_platform_cpp_seam_coverage.py test/test_security.py test/test_credential_prefilter.py: 2015 passed, 1 skipped; the 14 test files that exerciseStreamRedactor(Slack, messaging, side chat, composition contracts) pass too (1679 passed) (withtest/test_chat_utils.pyandtest/test_security_gate_liveness.pyadded).src/change reverted, the keep-value tests fail and the stay-redacted tests pass. With the boundary check reduced to the single preceding character, the 10 nested-URL regressions fail; with the preceding-text check removed, the 8 whitespace-nesting cases fail; with the stream suspension removed, the 2 split-stream cases fail.Related Issues
no linked issue: found while wiring an edition's approval link; no tracking issue exists.
Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)