opencode-secret-redactor
v0.5.1
Published
OpenCode plugin that redacts secrets from LLM context and restores them for tool execution
Maintainers
Readme
opencode-secret-redactor
An OpenCode plugin that prevents secrets from leaking
into LLM context. Secrets detected in tool output are replaced with
🔒label🔓 tokens before the model sees them, then transparently
restored when a tool needs the real value for execution.
Detected secret types
AWS keys, GitHub/GitLab tokens, OpenAI/Anthropic keys, Google Cloud
credentials, Stripe keys, Slack tokens, JWTs, private keys, database
connection strings, and many more. See
src/patterns.ts for the full list.
Setup
Add the plugin to your opencode.json:
{
"plugin": ["opencode-secret-redactor"]
}The plugin hooks into tool execution automatically -- no further configuration is required.
How it works
- After
bashorreadtool output, the plugin scans for secrets using pattern matching and stores any matches in an in-memory vault. - The output sent to the LLM contains only redacted placeholders.
- Before
bash,write, oredittool execution, placeholders in the tool arguments are replaced with the original values so commands run correctly.
