Skip to content

Redact secrets and personal data from prompts before they reach a cloud provider - #1695

Merged
currentbits merged 3 commits into
mainfrom
coder/privacy-gateway-pii-secret-redaction-bef-2f98bd
Oct 19, 2026
Merged

currentbits merged 3 commits into
mainfrom
coder/privacy-gateway-pii-secret-redaction-bef-2f98bd

Conversation

@currentbits

Copy link
Copy Markdown
Owner

Adds the privacy gateway from #295. It's a deterministic filter (not a prompt) on every prompt Solenta hands a provider CLI, with a separate level for each provider. It's off by default, so nothing changes until you opt in under Settings › Advanced › Privacy gateway.

Closes #295

Changes

  • Levels per provider, with an "every provider" fallback:
  • Where it applies: the final outbound prompt of every run, so it covers hand-off context, memory bootstrap, PDF text, folded queued messages, and turns started by worker forks and thread_send. It also covers steers, Ask, and /btw. Each match becomes [redacted:<rule>].
  • Logged per thread: each turn with redactions gets an event row, e.g. Privacy gateway (strict, grok) redacted 2 items before sending: github-token ×1, email ×1. The row has rules and counts, never values. The transcript keeps the raw prompt you typed.
  • The Export a thread as a self-contained, redacted bug report #394 bug-report export now uses the same redactor. Its rules and output are unchanged.

Verification

  • New electron/test/privacy-gateway.test.js:
    • unit tests for levels, rules, Luhn, secret cards, and settings validation
    • a store round-trip
    • a runner test through a fake grok CLI, which checks that the -p prompt is redacted while the transcript keeps the raw text and gets the event row
  • New renderer test in test/settingsModal.test.tsx for the editor's saves. The settings modal file passes 96/0.
  • Full electron suite with a CI-like env (inherited CODER_* removed): 4965 pass / 0 fail / 0 cancelled.
  • npm run typecheck and npx vite build are clean.
  • Not tested: clicking through it in the packaged app.

Notes for reviewers

  • Coverage limit (by design): the gateway only sees what Solenta puts together. Files and command output the agent reads itself go straight from the CLI to its provider. The settings note says this. Closing that gap would need an egress proxy in front of the CLI.
  • Not covered: Build-workflow runs (workflowEngine) build their own prompts and aren't filtered yet.
  • False positives at strict: a 13–19 digit number starting with 3–6 that passes Luhn still gets redacted as a card number. Millisecond timestamps start with 1, so they're safe.
  • The redacted copy goes only to the CLI. Hiding secrets in the rendered transcript (raised in the issue comments) is a separate follow-up.
  • About 650 changed lines, which is over the app's 400-line PR cap. Most of it is the new module, its tests, and the settings editor.

claude-opus-5-5 via Claude Code

🤖 Generated with Claude Code

Willem and others added 2 commits October 19, 2026 10:10
…ts (#295)

A deterministic filter on every prompt Solenta hands a provider CLI: normal
runs (prompt, hand-off, notes, PDF text, memory bootstrap), steers, Ask and
/btw. Per-provider level in Settings > Advanced: off (default), secrets, or
strict (adds emails, Luhn-valid card numbers, US SSNs and user regexes).
Each redacted turn gets an event row naming the rules and counts, never the
values. The #394 export redactor now shares the same rules.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 19, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-19T09:33:16.684111Z 41297a8 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 41297a8e02

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

onSaveSettings: (patch: Partial<AppSettings>) => Promise<AppSettings>;
}) {
const pg = settings?.privacyGateway ?? EMPTY;
const [patternsText, setPatternsText] = useState(() => pg.patterns.join("\n"));

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Synchronize the pattern draft after settings hydrate

If the Settings modal mounts before the asynchronous settings request completes (or while a retry is pending), this initializer permanently captures an empty pattern list even after settings.privacyGateway.patterns arrives. The textarea then displays blank, and merely focusing and blurring it compares that blank draft with the loaded patterns and saves patterns: [], silently deleting the user's custom redaction rules. Synchronize patternsText when the settings prop hydrates or changes.

Useful? React with 👍 / 👎.

@currentbits
currentbits merged commit b0e93a3 into main Oct 19, 2026
6 checks passed
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.

Privacy gateway: PII/secret redaction before context leaves the machine

1 participant