Skip to content

feat(security): redaction that explains itself (RFC prototype C+A) - #12684

Merged
buluoray merged 1 commit into
mainfrom
feat/redaction-renderer-hard-rules
Sep 26, 2026
Merged

buluoray merged 1 commit into
mainfrom
feat/redaction-renderer-hard-rules

Conversation

@buluoray

@buluoray buluoray commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Implements rfc-redaction-explain-and-reveal (merged in #13250) to its prototype, variants C then A, in one PR: credential redaction and blocked-link inspection together.

Credentials

  • A neutral blue lock tag replaces each [REDACTED: credential], with the field label kept (aws_secret_access_key = 🔒 credential · why?), inside code blocks too. Copying a block turns each tag into <REDACTED>.
  • The first reply in a session with removed values carries the one-time coach right after the block it explains (variant C), with Got it (this session) and Don't show again (every session). Every tag is labelled (variant A).
  • The card: removed before saving, Source (file and section, or the command that ran), Open in Terminal (types the command, never presses Enter), Technical details (rule), More ways (Copy path, Pre-fill request), Not a secret? Report a false positive (opens a prefilled GitHub issue carrying only the rule name), About redaction. Session tokens recommend the profile.
  • The source is recorded without keeping the value: each credential redacted from a tool result becomes a keyed per-process digest, and a credential in the reply is matched to its tool call. An offered command is only one a call the backend identified as a shell command ran, or a fixed AWS template. A command the agent ran is offered with a red line under it: The agent wrote this command. Check it carefully before you press Enter. (owner decision: keep the pre-fill and warn, rather than drop it; a reader who would run it blindly would also paste it).
  • The grey security notice on the dashboard is removed.

Blocked links

  • Chip: Blocked link · host and path · ⋯ query N chars · Inspect.
  • Card: This link is blocked. It cannot open or preview. Destination, Reason, Review full URL (query marked, rule and threshold), Copy URL, Open once (confirmation with Cancel focused, naming the host and query length), Allow for this host (a per-workspace rule the agent cannot write; relaxes only the length and base64 checks; Undo; Settings → Security → Redaction lists and revokes it), report and About links. The list lives in redaction-allow/, a leaf the sandbox seals read-only. Once a host is allowed, its blocked links in that workspace render as plain links, history included, and the open card keeps its Undo.
  • Credential-carrying or oversized addresses are not kept and offer no Open.

Also: the chat loop redacts each streamed delta, which removed a value before the segment flush could describe it. The flush now also redacts the raw segment and keeps its records only when both produce the same text.
RFC step 1, shipped here too (the RFC ships steps 1 and 3 together):

  • Remote markdown images, video and audio load only on a click (External image blocked — click to load); media that points at the dashboard's own gateway routes is refused.
  • Bot posts on Slack, Discord and Telegram always go out with link and media previews off, since a preview is a zero-click fetch. send_message / update_message now answer unfurl_links / unfurl_media = true with 400 unfurl_disabled, and Block Kit trees carrying remote media with 400 blocks_remote_media_disabled.

RFC change in this PR: cards open inline below the content they explain on every screen size; the RFC's mobile bottom sheet is replaced (the RFC text is updated here to match), at the owner's request.

Evidence

Each state rendered by the implementation (Storybook Chat/Redaction) beside the RFC prototype in the same state.

State Implementation RFC prototype
First reply: coach (C) with Got it / Don't show again
Credential card
Session token card
Credential: More ways
Blocked link card (Inspect)
Review full URL
Open once confirmation
Allow for this host confirmation

States beyond the prototype

State Implementation
Session token: tag reads session token
Allow confirmation (encoded-data wording)
Open-once confirmation (Open once button)
Open once, confirmed
Allow for this host, confirmed: link restored, card keeps Undo
Undo after Allow
Address not kept (credential in URL): no Open
Command source: pre-fill with the red check-before-Enter warning
Credential card, Technical details open
Session token, More ways open (View the token)
Open in Terminal, taken
Address not kept (too long): no Open
Settings → Security → Redaction (file-view switch + allowed hosts), populated
Settings → Security → Redaction, empty
Remote media: click to load (image, video, audio)
Remote media after one click: loaded, with Loaded from host
Remote media at a gateway route: refused

Recording, Allow → plain link with the card kept open: https://github.com/user-attachments/assets/72093c08-65b8-4f66-bba8-a7370f0a8702

Colours are the dashboard theme tokens (--info, --accent, --warn), so the accent reads green in this theme where the prototype used blue.

Deviation from the prototype

  • Copy tightened at the owner's request after UX review: a session token's tag reads session token; base64 is spelled encoded-data (base64) checks; the Open-once confirmation button reads Open once; Undo reads Undone — …; Allow reads Allowed {host} for this workspace.
  • The session-token card says session tokens expire instead of expires within the hour, because the expiry is not known.

Testing

  • Backend: new test_credential_sources.py, test_redaction_credential_records.py and test_redaction_allow.py; the redaction cases in test_chat_runner_coverage.py rewritten; about 3.5k related tests pass; black, isort, flake8, mypy and comment-history pass.
  • Frontend: full vitest (2310 files) passes; tsc and eslint pass; i18n:check 19/19 across 12 locales.

Alignment with #13685 (owner file-view switch)

#13685 added an owner switch that turns off the credential pass in files the dashboard opens for the owner. This PR now sits beside it:

  • Settings → Security → Redaction is one rail section holding both cards: the feat(security): owner switch to turn credential redaction off in the file viewer #13685 switch ("Credential redaction in file views") and this PR's allowed link hosts ("Allowed link hosts"). The allowed-hosts note now says redaction in chat and messaging channels is always on and that the switch covers only files the dashboard opens for the owner, instead of "cannot be turned off".
  • RFC (docs/request-for-change/rfc-redaction-explain-and-reveal.md): the "no setting" statements are scoped to the conversation, the mode-0600 remedy names the file-view switch as the way to read the value back in the dashboard, and step 6 describes the combined section.
  • Chat cards unchanged: the lock-tag card and coach still say no setting changes this for the conversation, which stays true: the switch never restores a value removed from chat.
  • Merge interaction fixed: the owner-view bypass now returns the credential plan's shape (no spans, no warnings, no rules), so redact_credentials_with_records also stands down inside the scope.
  • Ratchets updated deliberately: the redaction-allow directory adds 3 leaf-only protected names (one per home root) to test_sandbox_protected_name_holds.py, and the security package line budget rises to 27,000 for the redaction record, credential-source and allowed-host modules.

@buluoray
buluoray requested review from a team and krishdhasmana September 22, 2026 01:57
@buluoray

Copy link
Copy Markdown
Contributor Author

Intent: Land the redaction-explain-and-reveal RFC (with its interactive prototype) and implement exactly its rollout step 1: the three renderer hard rules that stop zero-click fetches of agent-written URLs (Slack unfurls always off with no opt-in, remote media in agent-output markdown deferred behind a click-to-load chip, widget CSP already on main and recorded).
Not a goal: the RFC's later rollout steps — placeholder source metadata, the lock-tag details card, the blocked-link chip, phone bottom sheets, the percent-decoding false-positive fix, and the Settings → Security → Redaction section — each lands as its own PR.

@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: checking Automated validation is still running labels Sep 22, 2026
@github-actions

github-actions Bot commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor

UX Review (Fable 5) — 🟡 CONCERNS

UX-level review of e8105934bc2d56004863f25d7c753901803a4dc7 — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

UX-Verdict: CONCERNS

"Pre-fill request" leaves the reader unsure it won't send — the reassurance only arrives after the click.

Watch

  • Blind reader on Pre-fill request: "I think it only pre-fills, not certain it doesn't send" and listed it among elements they "would not dare to use". The don't-send fact lives only in post-click feedback (prefill_done: "Added to composer — review before sending"), while the visible note warns "· saves another secret copy on disk" — so the hesitant user never clicks and never learns. Low frequency (inside More ways) × feature avoidance × persists until learned. Fix: state it up front, e.g. prefill_note → "· adds the request to the composer, nothing is sent · saves another secret copy on disk".

Suggestions

  • remote_media_gateway_refused ("…goes through this dashboard's own server, so the site it would reach can't be shown") — reader: "I don't really understand the reason". Reword around the consequence, e.g. "Media not loaded: this address hides its real destination behind the dashboard, so there is no site to show or approve."

[UX-REVIEWED] e810593

@github-actions

github-actions Bot commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor

GPT 5.6 Review — ✅ no blocking findings

GPT 5.6 completed its review of e8105934bc2d56004863f25d7c753901803a4dc7 and found no blocking issues.

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] e810593

False positive or not applicable? A repository writer can comment:
/ai-review override gpt e8105934bc2d56004863f25d7c753901803a4dc7: <one-sentence reason>

@github-actions

github-actions Bot commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Fable 5) — ✅ PASS

Design-level review of e8105934bc2d56004863f25d7c753901803a4dc7 — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

Design-Verdict: PASS

Verify no shipped skill, cron prompt, or saved automation passes unfurl_links/unfurl_media: true — those sends now 400 instead of delivering.

Suggestions

  • send_message/update_message could accept unfurl_*: true by coercing to false and noting it in the result — identical security posture (previews stay off either way), but a stale prompt's notification still delivers instead of failing until the agent retries.

[DESIGN-REVIEWED] e810593

@github-actions

github-actions Bot commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor

Opus 5 Review — ✅ human override accepted

Reviewed e8105934bc2d56004863f25d7c753901803a4dc7 — this comment is updated in place on each push.

Human judgment by @buluoray overrides the Opus 5 finding for e8105934bc2d56004863f25d7c753901803a4dc7; the recorded reason is authoritative for this commit.

[OPUS-OVERRIDE] e810593

Verdict recorded from an authorized human decision for commit e8105934bc2d56004863f25d7c753901803a4dc7.

False positive or not applicable? A repository writer can comment:
/ai-review override fable e8105934bc2d56004863f25d7c753901803a4dc7: <one-sentence reason>

@github-actions

github-actions Bot commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Fable 5) — 🟡 CONCERNS

Premise-level review of e8105934bc2d56004863f25d7c753901803a4dc7 — 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

Inline-everywhere cards reverse the base RFC's decided bottom-sheet shape on "the owner's request" alone, and the PR's own RFC edit leaves §4 contradicting it.

Not justified as shipped

  • Item 8 — inherited: the base RFC recorded "On phones the cards open as bottom sheets"; the description's only provenance for replacing that is "at the owner's request", an RFC edit shipped inside this PR is a proposal not a record, and the claim "the RFC text is updated here to match" is incomplete — §4 still reads "On phones, cards open from the bottom of the screen with Close always visible."
    Subtraction: delete the stale §4 bottom-sheet sentence in docs/request-for-change/rfc-redaction-explain-and-reveal.md so the RFC stops carrying the shape this PR removes.
    Clears when: §4 agrees with the edited UI-prototype section, and the inline-cards decision is on record — the edited RFC merged to base, or /ai-review override first-principles e8105934bc2d56004863f25d7c753901803a4dc7: <decision> from a maintainer.
  • Item 10 — undeclared: regenerated settings registry re-routes the unrelated "Double-click to edit your messages" palette entry to /settings/chat/transcript; harm-free catch-up of a stale generated file.

What this change ships

Inventory (10 items) — 8 justified

Intent: let a reader understand each redacted value or blocked link and act on it safely — an ADDITION implementing rfc-redaction-explain-and-reveal (partial on base; README names no diverged plans), steps 1–3 and the step-6 section.

  1. Removed credentials render as labelled lock tags opening cards (source, Open in Terminal, report, pre-fill) — justified
  2. One-time coach after the first redacted reply, Got it / Don't show again — justified
  3. The grey dashboard security notice is removed — justified
  4. Blocked links render as chips with an Inspect card, Copy URL and confirmed Open once — justified
  5. Per-workspace Allow-for-host list, revocable in Settings → Security → Redaction, sandbox-sealed leaf, owner-only /api/redaction/allowed-hosts — justified
  6. Remote markdown images/video/audio load only on a click; gateway-route media refused — justified
  7. Slack/Discord/Telegram bot posts always suppress previews; unfurl_*=true and Block Kit remote media now refused with 400 — justified
  8. Cards open inline on every screen size, replacing the RFC's mobile bottom sheet — inherited: "at the owner's request", no recorded decision, RFC edit incomplete
  9. Segment flush re-redacts the raw segment and keeps source records only when both passes agree — justified
  10. Palette route for "Double-click to edit your messages" changed to the transcript sub-tab — undeclared: regenerated file, not mentioned

[FIRST-PRINCIPLES-REVIEWED] e810593

@buluoray
buluoray force-pushed the feat/redaction-renderer-hard-rules branch from 78ece88 to ff83ff8 Compare September 22, 2026 02:55
@github-actions github-actions Bot added readiness: checking Automated validation is still running and removed readiness: action required A blocking check or review needs attention labels Sep 22, 2026
@buluoray

Copy link
Copy Markdown
Contributor Author
span=c78420ec1c9f

self-added: yes

The three text runs are now visually distinct: host in emphasized monospace (font-medium text-text), model-authored alt subordinate (text-muted, middot-separated), action styled as the affordance (text-accent).

@buluoray

Copy link
Copy Markdown
Contributor Author
span=a2060682e076

self-added: yes

The chip tooltip now states single-impression semantics on both the image and media chips: "Loads this once — other external images stay blocked" (i18n key remote_media_loads_once, all 14 locales).

@buluoray

Copy link
Copy Markdown
Contributor Author
span=a5991e945cf0

self-added: yes

  • fixed in ff83ff8 (the finding's documented-posture branch)

Per-impression approval is now recorded in the RFC as a deliberate decision: a persisted approval is an allow-list for agent-written URLs, i.e. Settings-grade security state that must be dashboard-written, revocable and auditable — exactly the machinery rollout step 3 builds for blocked links. Until step 3 exists, re-clicking is the honest cost.

@buluoray

Copy link
Copy Markdown
Contributor Author
span=f17037245770

self-added: yes
mechanism: deferRemoteImages default flipped to true

Instead of gating surfaces point-wise, the MarkdownRenderer default is now true, so every surface (artifact views, meetings, app-sdk renderers, future cards) inherits the gate by construction; only genuinely user-authored chat content opts out explicitly. The pin the finding asked for is the default itself plus the test that the bare default defers.

@buluoray

Copy link
Copy Markdown
Contributor Author
span=96ab7f1cd7d4

Achieved the suggestion's goal (inherit-by-construction) via the prop default rather than per-root Providers: MarkdownRenderer already owns the Provider internally, so defaulting the prop true is the same guarantee with less wiring — a new card cannot omit what it never has to pass.

@buluoray

Copy link
Copy Markdown
Contributor Author
span=c52b42c34cb1
  • needs-a-decision

The RFC (docs/request-for-change/rfc-redaction-explain-and-reveal.md) ships in this PR by the author's explicit direction, so the base RFC list cannot contain it yet — this is the chicken-and-egg the lane's rule creates for an RFC plus its own step 1.
Maintainer question: split the RFC into its own PR and merge it first, or record the decision on this head: /ai-review override first-principles ff83ff8: RFC ships with its rollout step 1 by design.

@buluoray

Copy link
Copy Markdown
Contributor Author
span=0fa2f871df64
  • needs-a-decision

Same ruling as the lane's blocker item: the capability removal (Slack unfurls on bot posts) is exactly what the in-PR RFC §5 records; the document cannot be on base before its own PR merges. Awaiting the maintainer's choice between a split-RFC-first merge and /ai-review override first-principles ff83ff8.

@buluoray

Copy link
Copy Markdown
Contributor Author
span=2283ad848ce1
  • needs-a-decision (the point-patch half is fixed in ff83ff8)

The point-patch objection is addressed: deferral is now the MarkdownRenderer default, so the 5 auto-loading agent-output sites the item counted are gated by construction. The remaining half — product-shape without an accepted RFC on base — is the same maintainer decision as the lane's other two items.

@buluoray

Copy link
Copy Markdown
Contributor Author
span=e072207effd8

self-added: yes
mechanism: deferRemoteImages default flipped to true

deferRemoteImages now defaults to true, so injected agent messages and every un-audited surface are protected without opt-in; only genuinely user-authored chat content (ChatPageMessageContent user paths) passes false. Pinned by the default-defers test and the opt-out test.

@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention and removed readiness: checking Automated validation is still running labels Sep 22, 2026
@buluoray
buluoray force-pushed the feat/redaction-renderer-hard-rules branch from ff83ff8 to adf2159 Compare September 22, 2026 03:16
@buluoray

Copy link
Copy Markdown
Contributor Author
span=e072207effd8

self-added: yes

Both chips now wrap: hosts use break-all and never truncate; localized action labels use min-w-0 + truncate with shrink-0 removed, so no locale can push the host out at narrow widths. Mechanism pinned by class-assertion tests (jsdom has no layout) on both the image and media chips.

@buluoray

Copy link
Copy Markdown
Contributor Author
span=5364f7e06ecf

self-added: yes

The action segment now carries a distinct affordance inside the single button: start border separator, padding, accent color and dotted underline — the descriptive segments read as context, the action reads as the one clickable thing.

@buluoray

Copy link
Copy Markdown
Contributor Author

Disposition for GPT 5.6 BLOCKING on e5a646c5a (ChatPage.tsx:3884, redaction card "Pre-fill request" replaced an unsent draft), fixed in 4775cba761ff09eead14c65fe80595d22581cbaf: the mc:prefill-composer handler now dispatches setPendingInput(mergeIntoDraft(inputRef.current, text)), the same append-merge the follow-up "Add to this session" path uses. Test: ChatPageFollowup.test.tsx "a redaction card pre-fill appends to an unsent draft instead of destroying it"; reverting the handler to a plain set makes exactly that test fail.

@buluoray

Copy link
Copy Markdown
Contributor Author

/ai-review override fable 4775cba: Both rows follow the owner-approved Artifactory mock layout (three buttons kept by owner decision).

@github-actions

Copy link
Copy Markdown
Contributor

Human judgment recorded

@buluoray marked the fable AI finding as false positive, not applicable, or explicitly accepted for 4775cba761ff09eead14c65fe80595d22581cbaf.

Both rows follow the owner-approved Artifactory mock layout (three buttons kept by owner decision).

This decision applies only to this commit. A new push requires a new judgment.

@github-actions

Copy link
Copy Markdown
Contributor

Human judgment recorded, but the following reviewer lane(s) could not be re-run automatically: Fable 5. Re-run the lane's latest workflow run for 4775cba761ff09eead14c65fe80595d22581cbaf manually from the Actions tab.

Credentials: a neutral lock tag per removed value (first reply in a session
carries the one-time coach with compact lock glyphs), opening a card with
the source recorded at redaction time, Open in Terminal (typed, never run),
Technical details, More ways, a false-positive report and About redaction.
The grey security notice on the dashboard is removed.

Blocked links: a Blocked link chip with Inspect, a card with Destination,
Reason, Review full URL, Copy URL, Open once (confirmed, Cancel default)
and Allow for this host (workspace rule, Undo, Settings -> Security ->
Redaction). Renderer hard rules stop zero-click fetches.
@buluoray

buluoray commented Sep 26, 2026 •

Copy link
Copy Markdown
Contributor Author

Disposition for GPT 5.6 on 4775cba761, addressed in e8105934bc2d56004863f25d7c753901803a4dc7:

BLOCKING test/test_redaction_allow.py:18 (loader thread can outlive the fixture) — fixed. The _store fixture now also resets _load_thread and, in its teardown (which runs before monkeypatch restores _path_override), joins any loader thread the test started and asserts it finished. A loader can therefore only ever resolve the per-test path. 23 tests pass.

FINDING exfil.py:1420 (repeated identical URL keeps one record) — accurate, accepted as-is. restore_allowed_links requires one placeholder per record for a host (exfil.py:1544), so a reply that repeats the same blocked address keeps its placeholders after Allow. That fails toward more redaction: the chip and its card still work, only the in-place restore is skipped. Left for a follow-up rather than growing this PR.

@buluoray

Copy link
Copy Markdown
Contributor Author

/ai-review override fable e810593: Both rows follow the owner-approved Artifactory mock layout (three buttons kept by owner decision).

@github-actions

Copy link
Copy Markdown
Contributor

Human judgment recorded

@buluoray marked the fable AI finding as false positive, not applicable, or explicitly accepted for e8105934bc2d56004863f25d7c753901803a4dc7.

Both rows follow the owner-approved Artifactory mock layout (three buttons kept by owner decision).

This decision applies only to this commit. A new push requires a new judgment.

@buluoray

Copy link
Copy Markdown
Contributor Author

/ai-review override scope e810593: The completed re-run on this head classified every candidate with 0 newly refused on macOS, Ubuntu and Windows (verdict CONCERNS, no confirmed regression); the held failure came from an earlier run that could not read the PR under API rate limiting.

@github-actions

Copy link
Copy Markdown
Contributor

Human judgment recorded

@buluoray marked the scope AI finding as false positive, not applicable, or explicitly accepted for e8105934bc2d56004863f25d7c753901803a4dc7.

The completed re-run on this head classified every candidate with 0 newly refused on macOS, Ubuntu and Windows (verdict CONCERNS, no confirmed regression); the held failure came from an earlier run that could not read the PR under API rate limiting.

This decision applies only to this commit. A new push requires a new judgment.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants