Skip to content

feat(security): companion URL-prefix seam for token= redaction - #18287

Merged
bolichen97 merged 1 commit into
kirodotdev:mainfrom
rkeely:feat/token-param-exempt-prefixes
Oct 14, 2026
Merged

bolichen97 merged 1 commit into
kirodotdev:mainfrom
rkeely:feat/token-param-exempt-prefixes

Conversation

@rkeely

@rkeely rkeely commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

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 every token= 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 as https://<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

  • Exempting a whole host from pass 4. Only a https://host/path prefix directly before ?token= is exempt.
  • Relaxing passes 1-3. A real credential inside an exempt value is still redacted.
  • Changing the dashboard frontend sanitizer (website/src/utils/sanitize.ts) or the per-workspace "Allow for this host" list.
  • Naming any host in the public core. The default prefix set is empty.
  • Keeping the link clickable after other destinations in the same message. Any earlier URL, &, < or scheme: 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.
  • Streamed output and messaging channels (Slack, Discord, Telegram, Webex). Streamed windows never exempt, so the link is clickable where whole text is redacted: the saved dashboard message. Making it clickable on channels would need a host-rendered action from the tool result, a separate design.

What changed (motivation → approach → change)

Piece What it does
CredentialPolicy.token_param_exempt_url_prefixes() in platform/interfaces.py, default in platform/defaults.py New companion hook, default frozenset(). Returns https://host/path prefixes. The companion also lists the host in exempt_exact_hosts(), since exfiltration redaction runs first.
Pass 4 in security/redaction.py _credential_redaction_plan Leaves a token= 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() Reads the hook lazily, on the first pass-4 match only. No context, an older adapter, an exception, or a malformed member all give an empty set, which means more redaction. Registered in PEEK_CALLERS in platform/context.py.
StreamRedactor in security/__init__.py Suspends the exemption for every streamed window, since a window cannot see the text before it. The live stream shows the link redacted; the stored message is redacted whole (chat_runner._redact_segment_text) and shows it clickable.
redact_credentials(..., defer_token_param=True) at the one per-delta site in dashboard/chat_runner.py While the prefix set is non-empty, the per-delta redaction of the text accumulated for the stored message leaves pass 4 to that whole-segment run for any token= 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 through StreamRedactor, and with the empty default the output is byte-identical.
dashboard/chat_utils.py The display-redaction cache key folds in the prefix set, so a changed set is never served a stale answer.

The 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 &sol; into a destination. A link that follows an unrelated URL is therefore redacted; that is the safe direction. The docs entry is in docs/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:

  • Default policy still redacts the value.
  • An exempt prefix keeps the value, bare and inside a markdown link, with no warning.
  • Look-alike shapes stay redacted: suffix host, subdomain, userinfo, 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:\\host or https:host, or spelled with character references (&sol;&sol;, &#104;ttps&#58;&#47;&#47;, &#x2F;&#x2F;). Several approval links in one list all stay exempt.
  • Streaming the reviewers' split examples chunk by chunk through StreamRedactor never yields the token, a plain link streamed alone stays redacted in the stream, and the suspension resets after a redactor exception.
  • A second token glued after the exempt value (),[B](...?token=SECRET), ?token=k?token=SECRET and similar) stays redacted, and the redacted output is a fixed point.
  • Pass 4 stays linear: deterministic work accounting (no wall-clock bounds) caps the characters the guards examine at a small multiple of the input for 20k repeated links and long letter, digit and colon runs, and a differential test pins the incremental guards to the whole-prefix reference algorithm.
  • Trailing sentence and link closers after the exempt value keep it exempt.
  • A value an earlier pass claimed stays redacted as a whole.
  • 7 malformed or failing hook results, and an adapter without the method, all fall back to redaction.
  • The display cache key changes when the prefix set changes.

test/test_token_param_stream_deferral.py streams the approval link through the real _run_chat per-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=SECRET split 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.py allows exactly the two mutable readers the battery has. dashboard/chat_utils.py adds 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.py re-pins the kiro_crew.security line 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 exercise StreamRedactor (Slack, messaging, side chat, composition contracts) pass too (1679 passed) (with test/test_chat_utils.py and test/test_security_gate_liveness.py added).
  • Negative controls: with the 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.
  • comment-history, black, flake8, feature-map, testpaths-coverage, docs_lint and brand-name gates pass.

Related Issues

no linked issue: found while wiring an edition's approval link; no tracking issue exists.

Checklist

  • At most two commits (one is the norm), with a Conventional Commits title (feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)
  • Existing tests pass and new tests added for new functionality
  • Self-review completed; code follows project style guidelines
  • Documentation updated (if applicable)
  • No secrets, credentials, or internal references in the diff

@github-actions github-actions Bot added fork Pull request from a fork (external contributor) readiness: action required A blocking check or review needs attention labels Oct 9, 2026
@rkeely
rkeely marked this pull request as ready for review October 9, 2026 01:02
@rkeely
rkeely requested review from a team and KiroCrewCaptain as code owners October 9, 2026 01:02
@rkeely
rkeely requested a review from cruisercohen October 9, 2026 01:02
@github-actions

github-actions Bot commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5, fork) — ⏭️ skipped

Revision 88c881585d0b6114844a5825bca8f066eb9aed21 touches no user-facing surface (no changes under website/ or committed screenshots), so the UX review was skipped. Advisory — does not block merge.

@github-actions

github-actions Bot commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5, fork) — 🟡 CONCERNS

Design-level review of 88c881585d0b6114844a5825bca8f066eb9aed21 via the fork AI-review pipeline — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

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

  • The exemption logic will keep growing with every new bypass. The patch makes pass 4 skip a value only when five hand-built guards all pass (_TokenParamExemptScan.boundary, preceding_context, _TOKEN_PARAM_DESTINATION_SIGNAL_RE, the one-run value check, the trailing-closer set). The tests list about 40 look-alike spellings that must stay redacted. The line-budget comment records four separate raises (+128, +20, +21, +4), one per review round. AGENTS.md calls this pattern a "regex spelling-chase … review smell": each newly found nesting form adds another guard to the module every redaction caller depends on. The public default is an empty set, so it never runs or gets exercised in this build. The edition that does turn it on would only find a missed spelling in production, as a leaked token.
    Clears when: the description names the guard set as closed, with a rule that a missed shape gets redacted rather than another guard added. Or the edition's real link format (only prefix?token=<run>, wrapped or bare) is pinned in one positive whole-token match that replaces the negative scanner.
  • The core can't check the edition's claim that the token is safe to show. "A lookup key, not a bearer credential" is the companion's statement. Once exempt, the value is saved in plaintext in stored chat history. If the broker's link approves for whoever opens it, then whoever can read that history can approve.
    Clears when: platform-context.md states that a companion may list a prefix only when its token gives no authority to someone who opens the link (lookup or one-time use, bound to the user's session).

Suggestions

  • Have the tool result return the approval link as a separate action the host renders, instead of exempting it from text redaction. That design (already in "Not a goal") also fixes streamed output and the messaging channels, and leaves pass 4 untouched.

[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 .github/scripts/pr-description-capture.sh over the same inputs; if it differs, the description or that evidence changed after this verdict was formed and any finding drawn from either is unproven.

@github-actions

github-actions Bot commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5, fork) — 🟡 CONCERNS

Premise-level review of 88c881585d0b6114844a5825bca8f066eb9aed21 via the fork AI-review pipeline — why this exists and whether the shipped surface is the smallest honest version. Updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

First-Principles-Verdict: CONCERNS

Nothing in the tree uses the new token_param_exempt_url_prefixes() hook, and no issue or named edition shows that the defect it fixes exists, yet it adds 226 package lines to redaction pass 4.

Not justified as shipped

  • Item 1 — inherited: the description asserts the need ("A credential broker's one-time approval-workflow link is one") but links no issue and names no edition. I grepped token_param_exempt and exempt_exact_hosts\( under src/ on base and found 0 non-default implementers, so this surface has zero in-tree consumers. It is a permanent hook on the platform seam, and the line-budget comment shows what it costs: "Raised again, from 28,939 … _PACKAGE_LINE_BUDGET = 29_165".
    Subtraction: until an edition that calls the hook exists, defer the whole seam (token_param_exempt_url_prefixes, _TokenParamExemptScan, _token_param_exempt*, defer_token_param, _TOKEN_PARAM_EXEMPT_SUSPENDED).
    Clears when: the PR links an issue or names the companion edition whose approval link is redacted today and that implements this hook.

What this change ships

Inventory (7 items) — 6 justified

Intent: let an edition keep a user-facing approval link clickable even though its URL carries token=. This is an ADDITION.

  1. Editions can name https://host/path prefixes whose token= value stays readable — inherited
  2. Pass 4 keeps the value only behind boundary and preceding-destination guards — justified
  3. The live stream still redacts the link — justified
  4. Per-delta dashboard redaction leaves pass 4 to the whole-segment run — justified
  5. The display-redaction cache key folds in the prefix set — justified
  6. The prefix reader is registered in PEEK_CALLERS — justified
  7. The spec and the package line budget are updated — justified

[FIRST-PRINCIPLES-REVIEWED] 88c8815

Description read

[DESCRIPTION-READ] 18c261d48de882b089e4a3bac54676ea5491dee92bc4e1a8c29a5be4480ba50a

That sha256 names the PR description this verdict read. Recompute it with .github/scripts/pr-description-capture.sh; if it differs, the description changed after this verdict was formed and any finding drawn from the description is unproven.

@rkeely

rkeely commented Oct 9, 2026

Copy link
Copy Markdown
Contributor Author

Maintainer takeover needed: this fork PR changes src/kiro_crew/security/redaction.py, so Sensitive Change Review cannot pass from a fork. Please carry it on a branch of this repository (Co-authored-by: the author, Supersedes #18287) and run the real sandbox there.

Note for the rollup: the red PR Hygiene is from the 00:39 run, which read the original description. The current description passes .github/scripts/pr-description-check.sh; the re-run triggered by the edit was cancelled, and fork contributors cannot re-run it.

@github-actions

github-actions Bot commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

GPT 6.1 Review (fork) — ✅ no blocking findings

Reviewed 88c881585d0b6114844a5825bca8f066eb9aed21 via the fork AI-review pipeline; updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] 88c8815

@github-actions

github-actions Bot commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

Security Scope Review (fork) — 🟡 CONCERNS

Which legitimate operations does 88c881585d0b6114844a5825bca8f066eb9aed21 newly refuse? Model proposes, scripts/deny_diff.py decides — updated in place on each push. A script-confirmed regression blocks PR readiness.

the reviewer's own judgement; no confirmed regression

Scope-Verdict: CONCERNS

TIGHTENING: The diff does not change the shell deny composite (sensitive-bash, exfil, deny-rules). Its main effect loosens output redaction: pass 4 can now leave a ?token= value alone after a companion-supplied prefix. The one part that gets stricter is in StreamRedactor. Every context-incomplete streaming window now runs with the exemption turned off: suspension = redaction._TOKEN_PARAM_EXEMPT_SUSPENDED.set(True) in _redact_window, which replaces self._redact(commit) in feed/flush. The one threat it refuses is a streamed window that hides an enclosing destination such as https://evil.example/?next=( before an approval link, which the window cannot see, so the exemption could otherwise be granted wrongly (test_stream_windows_never_apply_the_exemption).

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 bin/python pytest runs, grep/rg, git diff, mypy, a python3 -c redaction probe), windows (.venv\Scripts\python.exe with \ test paths, PowerShell Select-String) and any (gh pr view). The diff makes no path, separator, interpreter or environment-variable assumption. Its only syntax assumptions are URL forms (https://host/path, \ treated as a destination signal) and the whitespace set " \t\r\n", all checked on redacted text rather than on argv. Testing commands on both hosts covers the maintainers' own operations in the touched area. No platform the diff assumes is left without a candidate.

UNADJUDICATED: The guard that actually got stricter is output redaction, not the tool-call gate, so the classifier cannot give a verdict on it.

  • Guard: StreamRedactor._redact_window → _credential_redaction_plan with _TOKEN_PARAM_EXEMPT_SUSPENDED=True. It forces the prefix set to empty, so every window redacts every ?token= value. The separate redact_credentials(..., defer_token_param=True) path in chat_runner._run_chat changes what gets redacted per delta.

  • Call path: an agent EVENT_TEXT_CHUNK goes to _run_chat. That chunk goes through redact_exfiltration_urls → redact_credentials(defer_token_param=True) before being added to the slot segment, then _redact_segment runs over the whole text before it is stored. Separately, the live chat_chunk wire goes through _wsred/StreamRedactor.feed/flush, where the exemption never applies.

  • Inputs I would have submitted, in prose:

    • A standalone approval link Approve: https://approve.example.com/auth?token=<b64> streamed in 6- and 40-char deltas with a companion prefix installed. Per the diff's own tests it is intentionally withheld on the live wire and kept only in the stored message, so a user watching the stream cannot click it until the message is stored.
    • The same link inside a markdown list or an <...> autolink.
    • A link after earlier prose containing &, <, \, // or word:x. Examples: "Q&A: approve here https://…", "see
      Details then https://…", or a Windows path like C:\work earlier in the message. The raw destination-signal check //|\\|&|<|:(?=\S) is sticky, so any one of these anywhere before the link turns the exemption off for the rest of the message.

    The Windows-path case is a narrowing I can argue but not confirm: an agent message that echoes C:\Users\... before the approval link loses the exemption. That direction means more redaction, so it is safe, but the companion feature then silently fails for Windows users' messages.

  • No PASS is claimed for any of this; the redaction-side guards got no verdict.

[SCOPE-REVIEWED] 88c8815

Security scope review -- adjudicated candidates

  • macos-latest (platform posix): 9 classified, 0 newly refused, 8 still allowed.
  • ubuntu-latest (platform posix): 9 classified, 0 newly refused, 8 still allowed.
  • windows-latest (platform windows): 4 classified, 0 newly refused, 4 still allowed.

No candidate flipped from allowed to refused.

@github-actions

github-actions Bot commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

Opus 5.5 Review (fork) — ✅ no blocking findings

Reviewed 88c881585d0b6114844a5825bca8f066eb9aed21 via the fork AI-review pipeline; updated in place on each push.

Review details

No findings.

[OPUS-REVIEWED] 88c8815

@rkeely

rkeely commented Oct 9, 2026

Copy link
Copy Markdown
Contributor Author

Context for why this seam is worth adding:

  • An edition hands the user an approval link from a credential broker; the agent cannot continue until the user opens it. The link's token= value is a workflow lookup key, not a bearer credential: approving still requires the user's own sign-in.
  • Pass 4 redacts that value by name, so the user sees /auth?token=[REDACTED: credential] and has nothing to click. exempt_exact_hosts() and the per-workspace allowed-hosts list only relax the exfiltration heuristics, so neither reaches it.
  • Without a seam, the only fix is a downstream monkey-patch of the private _credential_redaction_plan. That edition is carrying one now as a stopgap: it skips pass 4 for one exact URL prefix under the same rules as this PR (literal ?token=, delimiter before the prefix, nothing claimed by passes 1-3, fail closed). It has a tripwire test that fails once core stops redacting the link, so it is deleted when this lands and is replaced by a one-line token_param_exempt_url_prefixes() return.

@rkeely
rkeely force-pushed the feat/token-param-exempt-prefixes branch from 52ecb62 to e4fd82e Compare October 9, 2026 01:57
@rkeely

rkeely commented Oct 9, 2026

Copy link
Copy Markdown
Contributor Author
  • Embedded attacker URLs inherit the token exemption

fixed in e4fd82e: the one-character left check is replaced by _token_param_exempt_boundary.
The whitespace-delimited left context of the prefix must be empty, one of < " ' ` *, or exactly a markdown [label]( opener, and must not contain ://.
So ?next=(<prefix>...), ?next=[...], /<prefix>, #<prefix>, x:<prefix>, x@<prefix> and [x](//evil/?next=[y](<prefix>...)) all keep pass-4 redaction.
Regression tests cover the reviewer's example and 9 sibling nesting shapes; with the old one-character check they fail (10 failures), with the fix they pass.

@rkeely

rkeely commented Oct 9, 2026

Copy link
Copy Markdown
Contributor Author
  • a trusted-prefix link exempts the whole greedy token= value

fixed in e4fd82e: the exemption applies only when the value is ONE run of [A-Za-z0-9._~%+/=-] followed by nothing but closers )].,;:!?*.
Any other value, such as k),[B](https://svc/cb?token=SECRET) or k?token=SECRET, gets no exemption and is redacted whole, as on main.
Whole-value redaction was chosen over redacting only the remainder because it is a re-redaction fixed point; tests assert redact_credentials(out) == (out, []).
7 regression shapes leaked under 52ecb62 and are redacted on e4fd82e.

@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention and removed readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running labels Oct 9, 2026
@rkeely
rkeely force-pushed the feat/token-param-exempt-prefixes branch from e4fd82e to fed97cf Compare October 9, 2026 02:29
@rkeely

rkeely commented Oct 9, 2026

Copy link
Copy Markdown
Contributor Author

self-added: yes
mechanism: preceding-text destination guard for the pass-4 URL-prefix exemption

  • A tab hides the enclosing attacker URL from the exemption check

fixed in fed97cf for the whole class, not the tab: whitespace cannot prove the prefix starts a new destination (URL parsing strips TAB/LF/CR; a space does not end an HTML attribute or <...> destination).
The exemption now also requires that the text before the prefix, with earlier exempt links blanked, contains no destination syntax: //, \, scheme: followed by non-space, or an HTML tag opener.
Regression tests: the reviewer's tab example plus LF, CR, space-in-attribute, <...> destination, //host, https:\\host, https:host; all fail with the new check removed and pass with it. A list of several approval links stays exempt.
Tradeoff: a link that follows an unrelated URL in the same text is redacted (fail closed).

@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention and removed readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running labels Oct 9, 2026
@rkeely
rkeely force-pushed the feat/token-param-exempt-prefixes branch from fed97cf to 48995a9 Compare October 9, 2026 02:58
@rkeely

rkeely commented Oct 9, 2026

Copy link
Copy Markdown
Contributor Author

self-added: yes
mechanism: StreamRedactor windows suspend the pass-4 URL-prefix exemption

  • Streaming discards the context needed to reject nested destinations

fixed in 48995a9: StreamRedactor wraps every per-window redaction (feed commits and flush) in a context-local _TOKEN_PARAM_EXEMPT_SUSPENDED, and _credential_redaction_plan grants no exemption while it is set, so a window that cannot see the preceding text never exempts.
The suspension is reset in finally, covers a caller-supplied redactor, and has a test for the exception path.
The durable row is redacted whole (chat_runner._flush_segment -> _redact_segment_text, then chat_utils._redact_for_display), so the link becomes clickable only once the full text is available to both guards.
Regression tests stream the reviewer's split example chunk by chunk; they fail with the suspension removed and pass with it.

@rkeely

rkeely commented Oct 9, 2026

Copy link
Copy Markdown
Contributor Author

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. StreamRedactor suspends the URL-prefix exemption for every window, so the live chat_chunk stream always shows the value redacted; only the whole-segment stored row can exempt it. Test: the <a href="...?next= split example streamed chunk by chunk never yields the token.

@github-actions github-actions Bot added readiness: passed Eligible automated validation passed for the current revision and removed readiness: action required A blocking check or review needs attention labels Oct 10, 2026
@rkeely

rkeely commented Oct 10, 2026

Copy link
Copy Markdown
Contributor Author
  • the link is clickable only when it is the first URL in the message

accepted and now documented: the description's "Not a goal" section states the limit. It is deliberate fail-closed behavior, already noted in preceding_context ("Unrelated earlier destinations may over-redact; that is the safe direction"). The destination guard cannot tell an unrelated earlier URL from one that encloses the prefix without a positive link parser (suggestion 4cc3ccc5ed22). In the approval flow this targets, the tool result's link is normally the first destination the agent repeats.

@rkeely

rkeely commented Oct 10, 2026

Copy link
Copy Markdown
Contributor Author
  • streamed assistant_text carries non-exempt token= values unredacted

same ruling as d747c91bcc71: every publisher of assistant_text was audited and either redacts the whole text again (_redact_segment on every flush path) or uses it only as a predicate. The live wire is StreamRedactor, which never exempts. test_token_param_stream_deferral.py pins the stored segment through the real _run_chat path. With no prefix installed, the deferral is inert.

@rkeely

rkeely commented Oct 10, 2026

Copy link
Copy Markdown
Contributor Author
  • positively parse the link span instead of a negative scan

acknowledged as the better long-term shape, and it would also lift the first-link limit (2940a229a5e6). Deferred: it would replace the guard that GPT and Opus have now reviewed clean through several rounds, so it belongs in a follow-up the maintainer can scope. Same ruling as a51299b7bd65 for the current guard.

@rkeely

rkeely commented Oct 10, 2026

Copy link
Copy Markdown
Contributor Author
  • zero consumers in the repo

same ruling as 6f0a966edb3d, 7e031a3d070f and 2c2f7dc2836e: by design the consumer is a downstream edition's companion, so the public default is empty. The approval-link shape and an end-to-end reproduction (redacted today, kept with a companion prefix) are in the evidence comment. Confirming that an edition ships it falls to the maintainer taking the PR over.

@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention readiness: passed Eligible automated validation passed for the current revision and removed readiness: passed Eligible automated validation passed for the current revision readiness: action required A blocking check or review needs attention labels Oct 10, 2026
@iamwhatever

Copy link
Copy Markdown
Contributor

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

@github-actions github-actions Bot added the merge conflict Branch has merge conflicts with its base — author must resolve before merge label Oct 10, 2026
@rkeely
rkeely force-pushed the feat/token-param-exempt-prefixes branch from 5909b4f to 188fc0a Compare October 10, 2026 19:36
@rkeely

rkeely commented Oct 10, 2026

Copy link
Copy Markdown
Contributor Author

Rebased onto main bf1723d3f to clear the merge conflict; new head 188fc0ae6. The only conflict was _PACKAGE_LINE_BUDGET in test/test_security_gate_liveness.py: main's PlantUML route raised it 28,665 -> 28,740, and this PR's +226 now sits on top (28,966). No code change vs 5909b4f63. Locally: 9,890 redaction/security/chat_runner tests pass (including main's new test_plantuml_link_redaction.py), plus flake8, black, docs lint and the comment-history gate.

@github-actions github-actions Bot removed the readiness: passed Eligible automated validation passed for the current revision label Oct 10, 2026
@rkeely

rkeely commented Oct 10, 2026

Copy link
Copy Markdown
Contributor Author

Rebased onto main 5052ddd to clear the merge conflict; head is now 129ed41. Only conflict was _PACKAGE_LINE_BUDGET in test/test_security_gate_liveness.py: kept main's +1 (28,741) and restated this PR's +226 on top (28,967). Code unchanged vs 46ce9f4. Local: 6037 security/redaction tests pass; comment-history, flake8, black clean.

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) test_runtime_cleanup_regression.py::test_session_start_persists_new_descendants[load] TimeoutError (process-cleanup test; this PR touches no runtime/sandbox code).

@rkeely

rkeely commented Oct 11, 2026

Copy link
Copy Markdown
Contributor Author

Rebased onto main a84f61655 (head cb55f18c5) to clear the merge conflict. The only conflict was _PACKAGE_LINE_BUDGET in test/test_security_gate_liveness.py: kept main's raise to 28,827 for _credential_search and restated this PR's +226 on top (29,053). No code change versus 46ce9f408. This also picks up main's regenerated ui-index.generated.json, which should clear the stale-index reds from the previous base. Local: 2,157 security/redaction tests pass; comment-history, flake8, black clean.

@rkeely

rkeely commented Oct 11, 2026

Copy link
Copy Markdown
Contributor Author

Rebased onto current main (64e1cbb9df) to clear the merge-conflict label; new head 6cc6d48608. The only conflict was the package line budget in test/test_security_gate_liveness.py: main raised it to 28,844 for denied_rules._exception_applies; I kept that and put this PR's +226 on top, so the budget is now 29,070. Code is unchanged from the version GPT and Opus passed clean. Local checks pass (security/redaction + stream-deferral suite, comment-history gate, flake8, black). Fork CI will need maintainer approval again.

@rkeely

rkeely commented Oct 12, 2026

Copy link
Copy Markdown
Contributor Author

Rebased onto main 153c3c119 (merge conflict). New head 2605269cd. Only conflict was _PACKAGE_LINE_BUDGET in test/test_security_gate_liveness.py: kept main's raise to 28,857 and restated this PR's +226 from it, so 29,083. Code unchanged from 46ce9f408.

@rkeely

rkeely commented Oct 13, 2026

Copy link
Copy Markdown
Contributor Author

Rebased onto main 365d87c23 (merge conflict). New head 75e37c9f8. The only conflict was _PACKAGE_LINE_BUDGET: kept main's 28,864 paragraph and restated this change from it (+226 = 29,090). Code unchanged. The base now includes #19495, which clears the wait-discipline ratchet reds on test_surface_deny_notice_sites.py / test_webhook_permission_requests.py inherited from #19259.

@rkeely

rkeely commented Oct 13, 2026

Copy link
Copy Markdown
Contributor Author

Rebased onto main 1f6f5af03 (merge conflict). New head c2fee597f. Only conflict was _PACKAGE_LINE_BUDGET: kept main's 28,872 paragraph and restated this change from it (+226 = 29,098). Code unchanged. The previous Dependency License Gate failure ("Dependency review is not supported on this repository") and the GPT 6.1 "could not run" (installation API rate limit) were both repo-wide transient failures around 01:30-02:00Z; this push re-runs them.

@rkeely

rkeely commented Oct 13, 2026

Copy link
Copy Markdown
Contributor Author

Re-pushed as 7a5b3a7af: same tree as c2fee597f (commit re-stamped only, no code change), to re-run the fork review lanes. On c2fee597f, GPT 6.1, Opus 5.5 and Security Scope all hit API rate limit exceeded for installation between 06:42 and 06:47Z (runs 38357532430, 38357532346, 38357532328), so their verdicts were withheld or never completed. The limit has cleared since 07:00Z.

@rkeely

rkeely commented Oct 13, 2026

Copy link
Copy Markdown
Contributor Author

Rebased onto main 4eb75d7e2 (merge conflict). New head 38fc2698e. The only conflict was _PACKAGE_LINE_BUDGET in test/test_security_gate_liveness.py: kept main's _deny_pattern_passes paragraph (28,906) and restated this PR's +226 from it, so 29,132. Code unchanged.

@rkeely

rkeely commented Oct 13, 2026

Copy link
Copy Markdown
Contributor Author

Rebased onto main a83ad39f6 (merge conflict). New head 2940df339. Only conflict was _PACKAGE_LINE_BUDGET in test/test_security_gate_liveness.py: kept main's paragraph (28,939) and restated this PR's +226 on top (29,165). Code unchanged.

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.
@rkeely

rkeely commented Oct 14, 2026

Copy link
Copy Markdown
Contributor Author

Rebased onto main 9ed3c0481 (merge conflict). New head 88c881585. Only conflict was the streamed-delta redaction line in chat_runner.py: kept main's new segment_message_id lines from #19852 and this PR's defer_token_param=True on the redact_credentials call. Code otherwise unchanged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fork Pull request from a fork (external contributor)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants