opencode-secret-redactorOpenCode plugin that redacts secrets from LLM context and restores them for tool execution
3
182
近 7 天 67
31.5
生态多维模型
4 个月前
2026-04-04
快速安装与配置
opencode.json写入当前项目的 opencode.json,只对这个仓库生效。
opencode.json
{
"$schema": "https://opencode.ai/config.json",
"plugin": ["opencode-secret-redactor@0.5.1"]
}写入 ~/.config/opencode/opencode.json,对所有项目生效。
~/.config/opencode/opencode.json
{
"$schema": "https://opencode.ai/config.json",
"plugin": ["opencode-secret-redactor@0.5.1"]
}若你要在本地改造这个插件,先装到项目里再从本地路径引用。
shell
pnpm add -D opencode-secret-redactoropencode 启动时会通过内嵌运行时自动加载 npm 依赖并缓存至本地目录,无需手动在全局环境执行安装。
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@0.5.1"]
}
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.