Vaultshell

io.github.SoWhatI由 GitHub 账号 SoWhatI 发布v0.1.2更新于 Oct 24, 2026

Injects secrets into shell commands at exec time; plaintext never reaches the LLM context

已验证STDIO仅桌面开发者工具安全与监控

概览

AI 生成的概览

本地 MCP 服务器,将密钥保存在本机,并在执行时注入到 shell 命令中,确保明文不进入模型上下文。

可以做什么
  • 按规则注入密钥执行一次性 shell 命令,支持 dryRun 预览、超时与输出截断
  • 打开、发送、列出、关闭和撤销持久 shell 会话,密钥随进程结束而消失
  • 启动和停止仅监听本机的凭据注入反向代理,仅在内存中附加认证头
  • 列出、写入、删除和探测密钥,后端包括加密文件、钥匙串、环境变量、文件、1Password、Vault、Infisical 与 Doppler
  • 列出并静态校验注入规则,提示未知密钥、不可达规则或全局注入
  • 查询经过脱敏的审计日志,含命令、注入名称与标记
适用场景
适合助手需要执行依赖 API 密钥或令牌的 shell 命令,但密钥不能出现在对话、日志或审计记录中的场景。也适合希望按命令注入、使用短时会话或本地代理,而不是把凭据导出到环境变量的工作流。
运行要求
以本地进程运行;npm/git 安装需 Node.js 20+,也可使用已发布的容器镜像。加密文件后端需要 MASTER_KEY 环境变量(64 位十六进制),或使用 macOS 钥匙串。需在数据目录下准备配置与规则文件,可用 VAULTSHELL_HOME 覆盖。真实 PTY 会话需可选的原生 node-pty 构建;外部 CLI 后端需各自已登录的 CLI。仅支持桌面端。
安装前请注意
它会在你的机器上执行任意 shell 命令,规则与确认机制很关键。它持有主密钥与密钥库;同一用户账户下的本地进程可读取进程环境变量,README 将其列为明确的边界。Web 配置界面仅限本机回环,切勿端口转发。凭据代理的客户端一段在 127.0.0.1 上是明文。全局注入规则或内联明文密钥会削弱防护,内联默认关闭。

安装

在 SourceWeft 中

  1. 打开 控制台中的 Vaultshell,将其添加到工作区。
  2. 为需要使用其工具的对话启用该服务。

Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。

其他 MCP 客户端

参照 仓库 中的启动说明。

README

vaultshell

English | 简体中文

[CI] [npm] [License: MIT]

Available on the official MCP Registry: io.github.SoWhatI/vaultshell

An MCP server that stores secrets in local secure storage, injects them into shell child processes at exec time based on rules, and guarantees secret plaintext never reaches the model context — not in tool responses, not in logs, not in audit records.

The closed loop: reference-based storage + conditional injection + mandatory output redaction.

Status: M3 — one-shot commands + persistent sessions + credential proxy + external CLI backends. See CHANGELOG and docs/design-spec.md.

The iron rule

  • No MCP tool returns secret plaintext — ever. Responses contain only names, masks ([REDACTED:NAME]), and redacted output.
  • Resolvers are only invoked inside the launcher; values go straight into the child process env and never pass through the tool layer.
  • shell_exec has no free-form env parameter. Secrets enter by rule reference only.
  • Redactor failures are fail-closed: output is discarded, never returned raw.

Quick start

Requires Node.js 20+.

Install from GitHub (no npm registry account needed)

bash
# Run on demand directly from the repo (npm installs devDependencies and# builds dist/ via the `prepare` script):npx -y github:SoWhatI/vaultshell
# Or install globally:npm i -g github:SoWhatI/vaultshell

This is the same code as the npm registry package, installed from git — npm clones the repo, runs prepare (→ npm run build) and links the vaultshell bin. Pin a tag for reproducibility: npx -y github:SoWhatI/vaultshell#v0.1.1.

Docker (ghcr.io)

bash
docker run -i --rm \  -e MASTER_KEY=<64 hex chars> \  -v ~/.vaultshell:/home/node/.vaultshell \  ghcr.io/sowhati/vaultshell:latest

MCP client config using Docker:

json
{  "mcpServers": {    "vaultshell": {      "command": "docker",      "args": [        "run", "-i", "--rm",        "-e", "MASTER_KEY=<64 hex chars>",        "-v", "~/.vaultshell:/home/node/.vaultshell",        "ghcr.io/sowhati/vaultshell:latest"      ]    }  }}

The image runs as the non-root node user (HOME=/home/node), so the data volume mounts at /home/node/.vaultshell. node-pty is excluded from the image — sessions automatically fall back to pipe mode (pty: false) in containers; injection and redaction are unchanged. The web subcommand passes through (docker run … ghcr.io/sowhati/vaultshell web — loopback inside the container, of limited use).

No Smithery distribution: Smithery has gone hosted-only (it only accepts servers deployed to its own infrastructure). vaultshell's secrets must stay on the user's machine by design — third-party hosting is incompatible with its threat model, so we deliberately do not publish there.

From source

bash
# Run via npx (after publish) or from source:npm install && npm run build
# 1. Create a master key for the encrypted-file backendexport MASTER_KEY=$(openssl rand -hex 32)
# 2. Create ~/.vaultshell/config.yaml and ~/.vaultshell/rules.yaml#    (full annotated examples: docs/user-guide.md)
# 3. Store a secret (never echoed back) and run with injection#    via your MCP client's tools: secret_set, then shell_exec

Claude Desktop (claude_desktop_config.json):

json
{  "mcpServers": {    "vaultshell": {      "command": "npx",      "args": ["-y", "vaultshell"],      "env": { "MASTER_KEY": "<64 hex chars>" }    }  }}

Full setup, configuration reference, rule-writing guide, client integration, and FAQ: docs/user-guide.md.

MCP tools

ToolPurposeReturns
shell_execRun a one-shot command with per-rule injection. Params: command, cwd?, profile?, extraEnv? (allowlist), dryRun?, timeoutSeconds? (≤3600){exitCode, stdout, stderr} (redacted), injected:[names], ruleId, redactedCount, timedOut, truncated, warnings; dryRun → {dryRun:true, ruleId, injected, envKeys, denied}
shell_session_openOpen a persistent session; secrets injected once at creation{sessionId, cwd, injected:[names], pty, ttlSeconds}
shell_session_sendSend a command to a session{output} (merged, redacted), exitCode, redactedCount
shell_session_closeKill a session; secrets die with the process{ok}
shell_session_listList live sessionsmetadata only
shell_session_revokeKill and rebuild the session without secrets{sessionId} (new)
shell_proxy_startStart a credential-injecting reverse proxy on 127.0.0.1{proxyId, port, expiresAt, upstreamHost}
shell_proxy_stopStop a proxy{ok}
shell_proxy_listList running proxiesmetadata only (incl. secret name, never value)
secret_listList names + metadata (backend ref, resolvable)never values
secret_setWrite to backend; persisted, never echoed{name, ok}
secret_deleteDelete and unregister{name, ok}
secret_probeCheck a ref resolves{ok, masked:"****"}
rule_listRules + static warnings (e.g. inject-everywhere)—
rule_validateStatic findings: unknown secrets, unreachable rules, inject-everywhere, union risk, requireConfirm capability{ok, findings[]}
audit_queryRead audit entriesnames + redacted commands only

Execution limits (M3)

  • dryRun: true on shell_exec reports the would-be ruleId, injected names, final env key list (never values) and the deny-list verdict — without executing anything.
  • timeoutSeconds (default defaults.execTimeoutSeconds = 120, capped at 3600) kills the command and returns timedOut: true.
  • defaults.maxOutputBytes (default 1 MiB) truncates each output stream and sets truncated: true. Truncation happens after the Redactor — it can never bypass redaction.
  • defaults.maxConcurrentExecs (default 8) rejects excess concurrent shell_exec calls with a clear error (no queue).
  • All of the above are recorded in the audit log (dryRun / timedOut / truncated flags).

Web config UI

bash
vaultshell web            # loopback-only HTTP UI on a random portvaultshell web --port 5317

Prints a one-time-token URL like http://127.0.0.1:5317/?token=… — open it to manage secrets (write-only), edit rules with live static-validation warnings and a matcher dry-run, edit config, and browse the redacted audit log. The token dies with the process; every API call needs it, mutations require same-origin application/json requests, and no endpoint can ever return a secret value. Do not port-forward it. Design & threat model: docs/web-config-ui-design.md.

Credential proxy (M3)

For high-sensitivity API tokens, prefer not landing the secret in env at all. Declare a proxy in config.yaml:

yaml
proxies:  - id: stripe    upstreamHost: https://api.stripe.com    secretRef: STRIPE_KEY                          # registry name or full ref    headerTemplate: "Authorization: Bearer ${value}"

Then shell_proxy_start { "id": "stripe" } → { port, expiresAt }, and commands call http://127.0.0.1:<port>/v1/charges instead of https://api.stripe.com/v1/charges. The proxy injects the header in memory only and auto-stops after its TTL (default 300s). Audit records the host and secret name, never the header value.

Boundaries: http:///https:// upstreams only (proxy→upstream TLS is properly validated; no CONNECT tunneling, no TLS termination); the client→proxy leg is plaintext on 127.0.0.1, which inherits the same-UID local-process boundary from the threat model.

Persistent sessions (M2)

shell_session_open spawns a long-lived shell with the matched rule's secrets injected at creation. The session is recycled after an idle TTL (defaults.sessionTtlSeconds, default 900s, overridable per rule via ttlSeconds or per call) — when the process dies, the secrets die with it. shell_session_revoke kills a possibly-compromised session immediately and rebuilds one without any secrets.

Sessions use a real PTY via node-pty (an optional dependency — native build, needs Xcode CLT on macOS / build-essential + python3 on Linux). If node-pty cannot be loaded or spawned, vaultshell automatically falls back to a plain child_process shell and the shell_session_open response says pty: false; injection and redaction behave identically, only interactivity is degraded. Session output merges stdout/stderr (PTY semantics) and passes through the same Redactor.

Backend support matrix

BackendRef schemeStatusPlatformsNotes
Encrypted fileencfile://NAME✅ ImplementedallAES-256-GCM; master key from env:MASTER_KEY or macOS keychain; default
Local keychainkeychain://svc/acct⚠️ macOS onlymacOSspawns security CLI; Linux/Windows give a clear error
Process envenv://NAME✅ Implementedallread-only; good for CI
Filefile://path✅ Implementedallfirst line; refuses permissions > 0600
Inlineinline:⚠️ Restrictedallplaintext in config; disabled by default, startup warning when enabled
1Passwordop://vault/item/field✅ via CLIallneeds authenticated op CLI; read-only
Vaultvault://path#field✅ via CLIallneeds authenticated vault CLI; read-only
Infisicalinfisical://proj/env/KEY✅ via CLIallneeds authenticated infisical CLI; read-only
Dopplerdoppler://proj/config/KEY✅ via CLIallneeds authenticated doppler CLI; read-only

Details, per-backend setup, and how to register a plugin resolver: docs/backends.md.

Threat model

ThreatMitigation
Model-context leakageStructural: values never cross the tool layer; only names and masks
Command output echoing secretsMandatory redaction (exact + URL/Base64 variants + generic patterns), fail-closed
Agent dumping env (env, printenv, /proc/*/environ, …)Hard-blocked deny-list (configurable via security.dangerousCommands: extra patterns, or mode: warn to allow-with-audit) + shell_exec_blocked audit events
Same-UID local process reading /proc/PID/environOS-level limit, cannot be fully fixed; per-command injection shrinks the window. Explicit boundary.
Long secret residencyPer-command injection by default; sessions have idle-TTL recycling + instant revoke
Misconfigured rule causing inject-everywhererule_validate / rule_list static warnings; mergeStrategy defaults to override; requireConfirm rules demand interactive approval (fail-closed without elicitation)
Config files leakingConfig stores refs only, never values; inline: disabled by default; store files forced to 0600

Full discussion: docs/design-spec.md §7. Report vulnerabilities privately per SECURITY.md.

Data layout

~/.vaultshell/  config.yaml     # main config  rules.yaml      # injection rules + secret refs (refs only, never values)  secrets.enc     # encrypted-file backend (0600)  audit/          # JSONL audit, redacted

VAULTSHELL_HOME overrides the data directory (used by tests).

Development

bash
npm run build   # tscnpm test        # vitest — redactor property tests, backend round-trips,                # rule matching, shell_exec end-to-end

See CONTRIBUTING.md — including the security red lines every PR must respect.

License

MIT © 2026 vaultshell contributors

来源:README.md,提交 b4a2017

工具

0
SourceWeft 尚未在沙箱中启动过该软件包,因此其工具未知。

版本历史

1
  1. v0.1.2最新Sep 30, 2026

评分

已满足适用检查项的 50%

该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。

  • 近 30 天内可连通25 分

    请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。

  • 已声明认证方式10 分

    请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。

  • 已列出工具15 分

    请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。

  • 描述必需15 分
  • 图标10 分
  • 文档15 分
  • 许可证10 分