跳到主要内容
    ↑↓ 选择↵ 打开esc 关闭
    中文English
    casonadams

    Secret Redactor

    v0.5.1模型接入
    opencode-secret-redactor

    OpenCode plugin that redacts secrets from LLM context and restores them for tool execution

    GitHub 星标

    3

    月装机量

    182

    近 7 天 67

    综合评分SCORE

    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"]
    }

    opencode 启动时会通过内嵌运行时自动加载 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

    1. After bash or read tool output, the plugin scans for secrets using pattern matching and stores any matches in an in-memory vault.
    2. The output sent to the LLM contains only redacted placeholders.
    3. Before bash, write, or edit tool execution, placeholders in the tool arguments are replaced with the original values so commands run correctly.

    License

    MIT