client-secret-exposure-audit
它能做什么
这个工具会检查网站,看看密码或 API 密钥等敏感信息是否被意外暴露在浏览器可以看到的代码中。它会在 JavaScript 文件、HTML 以及不应公开的配置文件中查找这些泄露。
适用场景
- ✓在上线网站之前,确保没有密码或密钥暴露在外。
- ✓检查现有网站,查找可能的数据泄露。
- ✓确认重要的配置文件或源代码文件没有被公开访问。
技能链接
https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/client-secret-exposure-audit/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“检查网站 example.com 是否暴露了敏感信息。”
每周 5 个新技能,1 分钟读完。
工作原理
这个工具会下载网站通常会向所有访问者显示的文件,然后在这些文件中搜索密码、API 密钥或其他敏感数据的特征,包括 JavaScript 代码、HTML 注释和配置文件。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Client-Side Secret & Sensitive-File Exposure Audit
Overview
Modern web apps ship a lot of code and config to the browser. When credentials
leak into that client-visible surface — hardcoded in JavaScript, tucked into HTML
meta/data-* attributes or comments, or served as raw source/config/deploy
files that were never meant to be public — anyone can read them with curl and a
browser. This skill is a defensive, read-only workflow for finding that class
of exposure on a web app you are authorized to assess.
It maps to OWASP A02:2021 Cryptographic Failures (sensitive data exposure), A05:2021 Security Misconfiguration, and CWE-798 (hardcoded credentials), CWE-200 (sensitive information exposure), CWE-540 (source code in a production build). It only fetches resources the server already hands to any anonymous visitor — it does not exploit, brute-force, or mutate anything.
When to Use This Skill
- Use when you need to check whether a deployed site leaks API keys, tokens, or passwords in its client-side bundle before shipping or during a review.
- Use when working with a static/SPA deployment (Vercel, Netlify, Nginx, S3, GitHub Pages) and you want to confirm no source/config/deploy files are publicly reachable.
- Use when the user asks to "find secrets," "audit exposed files," "check the JS/HTML for credentials," or run a lightweight sensitive-data-exposure pass on a URL they own or are authorized to test.
- Do not use this to attack third-party sites. See Security & Safety Notes.
How It Works
Set the target once. Every command below reads only what the server serves publicly.
BASE="https://TARGET.example" # authorized target, no trailing path
WORK="$(mktemp -d)"; cd "$WORK"
Step 1: Fetch the page and inspect response headers
curl -s -D headers.txt -o body.html "$BASE/"
cat headers.txt
Flag on the headers:
access-control-allow-origin: *— permissive CORS (worse when paired with credentials).- Missing
Content-Security-Policy,X-Frame-Options/frame-ancestors,X-Content-Type-Options: nosniff,Referrer-Policy,Permissions-Policy. - Missing/weak
Strict-Transport-Security. Server/framework version banners that fingerprint the stack.
Step 2: Grep the HTML for secrets and sinks
grep -inE "secret|passwd|password|api[_-]?key|apikey|token|bearer|authorization|\
akia|sk_live|sk_test|pk_live|whsec_|ghp_|aiza|private[_-]?key|mongodb(\+srv)?://|\
data-[a-z-]*(secret|token|key|access)" body.html
grep -inE "<!--" body.html # read every HTML comment
grep -ioE '<meta[^>]+>' body.html # meta tags often carry keys/ids
grep -ioE '<script[^>]+src="[^"]+"' body.html # enumerate JS bundles
Secrets hide in data-* attributes, <meta> tags, hidden <div>s, and
<!-- comments --> at least as often as in scripts.
Step 3: Pull every JavaScript bundle and scan it
# extract script srcs, resolve relative paths against $BASE, fetch and scan
grep -ioE 'src="[^"]+\.js"' body.html | sed -E 's/^src="//; s/"$//' \
| while read -r p; do
u="$p"; case "$p" in http*) ;; /*) u="$BASE$p";; *) u="$BASE/$p";; esac
f="js_$(echo "$p" | tr '/:' '__')"
curl -s "$u" -o "$f" && echo "== $u =="
done
grep -rinE "secret|password|api[_-]?key|token|bearer|sk_(live|test)|pk_(live|test)|\
whsec_|akia|aiza|jwt|signing[_-]?key|admin[_-]?token|mongodb|redis://" js_* 2>/dev/null
Also scan any sourcemaps (*.js.map) — they can rebuild original source with
comments intact.
Step 4: Probe for publicly reachable source / config / deploy files
SPAs often have a catch-all rewrite that returns index.html for unknown paths,
so compare response sizes — a path whose size differs from the SPA fallback
is a real, distinct file.
FALLBACK=$(curl -s "$BASE/____nope____$RANDOM" | wc -c) # SPA fallback size
for p in /.env /.env.local /.env.production /.git/config /.git/HEAD \
/package.json /package-lock.json /vercel.json /.vercel/project.json \
/Dockerfile /docker-compose.yml /wrangler.toml /.gitignore \
/server/index.js /src/config/app.config.js /config.js \
/src/services/payment.service.js /webpack.config.js /next.config.js; do
read -r code size < <(curl -s -o /dev/null -w "%{http_code} %{size_download}" "$BASE$p")
[ "$code" = "200" ] && [ "$size" != "$FALLBACK" ] && echo "REAL FILE $code $size $p"
done
…
常见问题
这个工具可以用来攻击其他网站吗?
不可以。这个工具只适用于检查你有权测试的网站。它不会尝试利用漏洞,也不会修改任何内容。
什么是“暴露的敏感信息”?
指的是密码、API 密钥或令牌等机密信息,它们出现在客户端代码(即浏览器能看到的内容)中,任何人都能读取。
它会检查哪些类型的文件?
它会检查 JavaScript 文件、HTML 标签(包括 meta 标签和注释),并尝试访问常见的配置文件,例如 .env、package.json、Dockerfile 等。
详情
作者的原始描述
Audit a deployed web app for secrets exposed to the browser: hardcoded API keys/tokens in JS, secrets in HTML meta/attributes/comments, publicly reachable source/config/deploy files, and header/CORS misconfig.
热度
- GitHub 星标
- 48k
- 排名
- #4154
- 许可证
- MIT
- 更新时间
- 2026/10/15
评论
- …
同一仓库的更多技能
00-andruia-consultant
48k帮你的智能体启动或改进 AI 项目。它可以分析代码、推荐工具,并用西班牙语制定行动计划。
007
48k让你的智能体执行安全审计和威胁建模。它有助于保护项目免受攻击和漏洞的威胁。
10-andruia-skill-smith
48k帮你的智能体创建或改进 AI 工具。它可以定义工具的工作方式、编写文档,并验证其结构。
20-andruia-niche-intelligence
48k让你的智能体创建某个特定行业的摘要。它有助于借助可靠的信息来源,了解项目的背景、规则、使用模式和风险。