D
devmaxxx/shell-secrets
Catch secrets in shell commands and AI-agent tool calls (Claude Code, Codex) before they run
在 GitHub 查看 ↗链接已于 2026-11-12 核查 · HTTP 200 · 打开的是厂商自己的官网
安装与配置
客户端配置(取自该仓库的安装命令)
{
"mcpServers": {
"devmaxxx-shell-secrets": {
"command": "npx",
"args": ["shell-secrets"]
}
}
}解析自我们于 2026-10-27 抓取的该仓库 README;我们未执行过。
command/args 来自仓库写明的安装命令;不确定时请以该项目 README 为准。
VS Code(.vscode/mcp.json —— 键名是 servers)
{
"servers": {
"devmaxxx-shell-secrets": {
"command": "npx",
"args": ["shell-secrets"]
}
}
}VS Code 顶层键是 <code>servers</code>,其余与上面那份相同。
Claude Code(命令行)
claude mcp add --transport stdio devmaxxx-shell-secrets -- npx shell-secrets
Claude Code 不收 JSON 文件,用这条命令直接加。
配置项的键名以你的客户端为准:客户端与 CLI
- ★ 数取值
- 2 ★ · devmaxxx/shell-secrets · 取自 GitHub 搜索 API · (2026-11-13 20:00:50 核对)
- 来源明细
- 从该仓库的 GitHub 页面直接读取 · 条目类型:开源项目
- 收录与活跃
- 收录于 2026-10-27 · 最近见到 2026-11-14 · 共见到 20 次 · 被 1 个来源列出
- 评分构成
- 综合分 103 · 2 ★ · 1 个来源 · repo
- 安装
npx shell-secrets
常见问题(答案都来自我们的记录)
怎么安装?
该仓库给出的安装命令是
npx shell-secrets。我们的记录里它是仓库自己提供的;不保证在你的客户端上直接可用。它适合谁 / 用来做什么?
我们把它归在这些标签下: 开源项目。标签来自条目自身,不是我们强加的分类。
谁维护它、还在更新吗?
仓库
devmaxxx/shell-secrets;我们收录于 2026-10-27;最近见到 2026-11-14。这里没有"官方认证"或"质量评级"——我们只记录来源与时间。# shell-secrets
以下摘录自该仓库的 README(片段) · 在 GitHub 读完整 README →
Catch a secret in a shell command or an AI-agent tool call before it runs — written to a file, exported, or put in a commit message. Zero dependencies.
Install · Agent hooks · Quick start · Detected secrets · API · Recipes · Compared
Table of contents
Why
Features
Install
Agent hooks
Quick start
Detected secrets
API
findSecrets
findNewSecrets
findSecretsInCommand
onlyWritesTo
findCredentialSlots
Custom and disabled rules
Recipes
Compared with other scanners
Limits
Contributing
License
## Why
Coding agents and CI bots run shell commands, and that is where secrets leak now: echo "$KEY" > config.js, export GITHUBTOKEN=ghp… landing in a transcript, a token pasted into the message file of git commit -F msg.txt. Repository scanners like gitleaks and secretlint catch it after the fact, in files and history. Generic string scanners see the token but not what the command does with it.
findSecretsInCommand reads the command the way the shell would: it reports each secret, the variable it is exported or assigned to, the files the command writes through >, >> or tee, the message files git / gh would publish, and the files curl, scp or nc would send off the machine. It is a plain JavaScript function with no dependencies, so it fits in a pre-tool-use hook. It returns where the secret is and a masked preview, never the secret itself. findSecrets does the same for any plain string — a log line, a prompt, a staged diff.
## Features
Reads shell commands. findSecretsInCommand reports secrets assigned or exported (NAME=secret), the files a command writes through >, >> or tee, the message files git / gh would publish, and the files curl, scp or nc would send off the machine.
Built for agent tool calls. onlyWritesTo answers "does this command only write the secret into an allowed file, such as a gitignored .env?".
Catches credential slots. findCredentialSlots finds the other half of the problem: a command with a stand-in for the user to type a secret into (Authorization: Bearer , export APIKEY=your-key, --client-secret= , postgres://app: @db). The hook blocks one in a Bash call and sends back a reply that hands one to the user.
Zero runtime dependencies. ESM, fully typed, about 12 kB gzipped.
Tuned for precision. Placeholders (ghpxxxx…, , example), variable references (${DBPASSWORD}) and local dev credentials (postgres:postgres@localhost) are not reported, so a hit is worth stopping for. Classic GitHub tokens must carry a valid CRC32 checksum, so made-up ones in docs and tests pass.
Sees through base64. A blob that decodes to text, such as a Kubernetes Secret value or an echo … | base64 -d, is decoded and scanned, nested encodings included; the finding spans the encoded text.
Catches unnamed secrets too. A value under a secret-sounding name (APITOKEN=…, clientsecret: "…", --api-key …) is reported when a statistical test reads it as machine-generated, not a word, identifier, path or UUID.
Safe to log. A finding holds the rule, the offsets and a redacted preview such as ghp. It never holds the value.
Diff-aware. findNewSecrets reports only what an edit adds, not secrets the text already had.
Extensible. Add your own rules or drop built-in ones with a plain array.
Install · Agent hooks · Quick start · Detected secrets · API · Recipes · Compared
Table of contents
Why
Features
Install
Agent hooks
Quick start
Detected secrets
API
findSecrets
findNewSecrets
findSecretsInCommand
onlyWritesTo
findCredentialSlots
Custom and disabled rules
Recipes
Compared with other scanners
Limits
Contributing
License
## Why
Coding agents and CI bots run shell commands, and that is where secrets leak now: echo "$KEY" > config.js, export GITHUBTOKEN=ghp… landing in a transcript, a token pasted into the message file of git commit -F msg.txt. Repository scanners like gitleaks and secretlint catch it after the fact, in files and history. Generic string scanners see the token but not what the command does with it.
findSecretsInCommand reads the command the way the shell would: it reports each secret, the variable it is exported or assigned to, the files the command writes through >, >> or tee, the message files git / gh would publish, and the files curl, scp or nc would send off the machine. It is a plain JavaScript function with no dependencies, so it fits in a pre-tool-use hook. It returns where the secret is and a masked preview, never the secret itself. findSecrets does the same for any plain string — a log line, a prompt, a staged diff.
## Features
Reads shell commands. findSecretsInCommand reports secrets assigned or exported (NAME=secret), the files a command writes through >, >> or tee, the message files git / gh would publish, and the files curl, scp or nc would send off the machine.
Built for agent tool calls. onlyWritesTo answers "does this command only write the secret into an allowed file, such as a gitignored .env?".
Catches credential slots. findCredentialSlots finds the other half of the problem: a command with a stand-in for the user to type a secret into (Authorization: Bearer , export APIKEY=your-key, --client-secret= , postgres://app: @db). The hook blocks one in a Bash call and sends back a reply that hands one to the user.
Zero runtime dependencies. ESM, fully typed, about 12 kB gzipped.
Tuned for precision. Placeholders (ghpxxxx…, , example), variable references (${DBPASSWORD}) and local dev credentials (postgres:postgres@localhost) are not reported, so a hit is worth stopping for. Classic GitHub tokens must carry a valid CRC32 checksum, so made-up ones in docs and tests pass.
Sees through base64. A blob that decodes to text, such as a Kubernetes Secret value or an echo … | base64 -d, is decoded and scanned, nested encodings included; the finding spans the encoded text.
Catches unnamed secrets too. A value under a secret-sounding name (APITOKEN=…, clientsecret: "…", --api-key …) is reported when a statistical test reads it as machine-generated, not a word, identifier, path or UUID.
Safe to log. A finding holds the rule, the offsets and a redacted preview such as ghp. It never holds the value.
Diff-aware. findNewSecrets reports only what an edit adds, not secrets the text already had.
Extensible. Add your own rules or drop built-in ones with a plain array.
收录徽章(可选)
想把收录标记放进 README 就复制这行,可选,不影响收录。
[](https://anclum.com/zh/s/devmaxxx-shell-secrets/)
- 来源
- github · https://github.com/devmaxxx/shell-secrets
- 按领域浏览
- 开源项目
- Traction
- 2 ★
- 收录于
- 今天
同类推荐
所属领域与标签
每个标签都能点进去看同类的全部条目。数字是当前库里的真实条数。