Skip to content

fix(plugins): widen secret-scrub to bare-KEY and credentialed URLs - #1476

Merged
TheGreatAxios merged 2 commits into
mainfrom
cl-10756-secret-scrub-key-class
Oct 17, 2026
Merged

TheGreatAxios merged 2 commits into
mainfrom
cl-10756-secret-scrub-key-class

Conversation

@TheGreatAxios

Copy link
Copy Markdown
Collaborator

Summary

  • The secret-scrub classifier redacts bare-KEY env assignments (OPENAI_KEY, STRIPE_KEY) with a word-boundary guard so plain words like MONKEY stay readable
  • Credential-bearing connection strings (DATABASE_URL and friends) redact only when the value carries credentials, leaving benign sqlite paths untouched

Verification

  • Scrub suite: 23/23 pass (bun test src/plugins/tool-result-secret-scrub.test.ts)
  • Consumer sweep: 121 pass (prior review verification)
  • Typecheck note: repo tsc --noEmit reports a pre-existing vendor/intx-types semver-module error unrelated to this diff; no type errors in the touched plugin files

Merge before #1471 (that PR's JSON coverage builds on this ENV coverage).

Fixes CL-10756

@linear-code

linear-code Bot commented Oct 17, 2026

Copy link
Copy Markdown

CL-10756

@corbits-triage

corbits-triage Bot commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

Triage: Pass

No changes needed from you. A maintainer will review this pull request.

@TheGreatAxios TheGreatAxios left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Review · Request changes

Env assignment scrubbing is one change, and it does not duplicate the JSON key scrub. Two holes in the new matcher.

Findings

  • src/plugins/tool-result-secret-scrub.ts:41 — any @ after :// counts as userinfo. REGISTRY_URL=https://registry.npmjs.org/@scope/pkg and SUPPORT_URL=https://example.com/help?email=dev@example.com are wiped. The comment says only scheme://user:pass@host and password= should match.
  • src/plugins/tool-result-secret-scrub.ts:94 — the replacer searches for the key from the right. OPENAI_KEY=proj-OPENAI_KEY-live-value-9z keeps the prefix through the second key. Redact the captured value.
  • src/plugins/tool-result-secret-scrub.ts:42 — password= is never reached when the value has no ://. DATABASE_URL=Server=db;Password=s3cret; stays in the clear.

@TheGreatAxios TheGreatAxios left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Review · Approve

Env assignment scrubbing redacts scheme://user:pass@host and Password= DSNs, and leaves scoped npm URLs and email-query URLs alone. A value that contains its own key is fully redacted.

No findings.

@TheGreatAxios
TheGreatAxios merged commit 170480e into main Oct 17, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant