360 Secure SkillHub
360 安全技能中心

secret-leak-scan-lite

该 Skill 调用随附的 Node 脚本静态扫描用户授权目录中的 AWS 访问密钥、GitHub PAT、Slack 令牌和私钥块,输出含脱敏指纹的 JSON 报告,并指导确认、轮换和防止再次提交。零结果仅表示已知模式未命中。

nenadzivotic
nenadzivotic
热度 16.02
最近更新 2026-10-17 23:19:46
分类:安全依赖:代码执行 / 读写文件应用场景:代码审查 / DevOps / 报告撰写

安装技能

复制下面的话术发给你的 Agent,它会通过 secure-skills 检索并安装该技能。

执行命令安装此 skill: npx secure-skills-cli add nenadzivotic/secret-leak-scan-lite
Metadata
name
secret-leak-scan-lite
description
Statically scan a project directory for leaked credentials (AWS access keys, GitHub PATs, Slack tokens, private-key blocks) before committing. Prints a JSON report with masked fingerprints only — raw secret values are never emitted. Use when the user asks to check a folder for leaked secrets, exposed keys, or committed credentials.

Secret Leak Scan (Lite)

Scan files the user owns or is authorized to analyze for accidentally committed credentials, using the bundled scripts/scan.mjs, and turn the JSON report into a remediation list.

Scope and rules

  • Only scan paths the user supplied or confirms they are authorized to inspect. If authorization is unclear, ask before running anything.
  • The scanner is static: it reads files and matches patterns. It never executes the scanned code and never follows symlinks.
  • Never try to recover, print, or reuse a detected secret. Report findings only by the type, file, line, and masked fingerprint the tool provides, and recommend rotation.
  • Do not overclaim. Zero findings means none of the known patterns matched — it does not prove the tree is secret-free.

1. Run

Requires Node 18 or later. The script is bundled with this skill:

node <skill-dir>/scripts/scan.mjs <directory>
  • Stdout is the JSON report (safe to pipe to a file); diagnostics go to stderr.
  • Exit codes: 0 no findings, 1 findings present, 2 usage/read error.

2. Read the JSON report

  • summary: filesScanned, filesSkipped (over 5 MB or unreadable), findings count, and byType breakdown.
  • findings[]: type (aws-access-key-id, github-personal-access-token, slack-token, private-key-block), file, line, fingerprint (ABCD… (len=N, sha256:xxxxxxxx)).
  • notes: skipped files and suppressed matches (per-file cap of 20).

3. Triage

Treat every finding as a potentially live credential. For each one:

  1. Open file:line and confirm the match is a real credential, not a documented example (e.g. AWS's AKIAIOSFODNN7EXAMPLE).
  2. Recommend rotation, not just deletion: revoke the key or token at the provider. Assume anything committed is compromised — it also stays in git history until purged.
  3. Prevent recurrence: move the value to environment variables or a secrets manager, and add the file to .gitignore.

4. Deliver

Secret scan: <input path>   (<filesScanned> files, <filesSkipped> skipped)

Findings (<n>)
- <type> — <file>:<line> — fp: <fingerprint> — action: <rotate at X>

Notes
- <skipped/unreadable items, or "none">

Rules for the review:

  • Quote the fingerprint so the user can correlate findings without exposing values.
  • Never state the tree is "clean" or "secure"; say which patterns were checked.

Full version

This is the lite edition — directory scans and the four most common credential types. The full secret-leak-scan skill adds .asar bundle scanning, Stripe/Google/fine-grained-PAT patterns, a complete triage-and-rotation workflow, git-history cleanup steps, and a CI gate recipe.