redact-secrets-from-model-context
Use when files, logs, or tool output you are about to send to a model may contain credentials. Scan and replace secrets with placeholders before they enter context, then verify nothing sensitive remains.
- License 许可
- MIT
- 最近更新
- 2026-11-13
- Stars
- ★ 81
- Forks
- 17
01 前言 Front Matter
- name
- redact-secrets-from-model-context
- description
- Use when files, logs, or tool output you are about to send to a model may contain credentials. Scan and replace secrets with placeholders before they enter context, then verify nothing sensitive remains.
02 资源文件 3
- 许可证LICENSE1.0 KB
- 参考文档SOURCE.md359 B
- 参考文档TRUST.auto.yaml2.1 KB
03 SKILL.md 正文
Redact secrets from model context
Once a credential is in a prompt it is out of your control — it may be logged, cached, or echoed back. This skill scans candidate content for secret shapes and swaps them for placeholders before the content is ever sent.
Procedure
-
Scan content before it enters context, not after. Run a pattern pass over every file you intend to include.
grep -rEn '(AKIA[0-9A-Z]{16}|ghp_[A-Za-z0-9]{36}|sk-[A-Za-z0-9]{20,}|-----BEGIN [A-Z ]*PRIVATE KEY-----|xox[baprs]-[A-Za-z0-9-]+)' incoming/ -
Broaden to assignment shapes, which catch keys you have no pattern for:
grep -rEn '(api[_-]?key|secret|token|password|passwd|bearer)[":= ]+[A-Za-z0-9._-]{12,}' incoming/ -i -
Replace each hit with a stable placeholder that preserves structure for reasoning, e.g.
sk-REDACTED-4f2a, and keep the real value only in a local vault outside the prompt. -
Redact by parsing, not by regex alone, for structured files: load
.env/YAML as key-value and mask the values of sensitive keys; regex misses multi-line PEM blobs. -
Handle encoded secrets too: decode base64/JWT segments and re-scan, and redact the
authorizationheader in captured HTTP.printf '%s' "$B64" | base64 -d 2>/dev/null | grep -En '(key|token|secret)' && echo "encoded secret" -
Verify the redacted payload is clean before sending: re-grep the post-redaction text and confirm zero hits.
-
If a secret was already sent, treat it as disclosed: rotate it, and record which context received it.
Pitfalls
echoing the variable to check it prints the secret into the log you were trying to protect; use${VAR:+set}instead.- Redacting only obvious fields misses secrets in free-text notes, commit messages, and stack traces.
- Placeholders that leak length or prefix still help an attacker; truncate consistently.
- A redaction step that fails silently leaves the raw value; assert the operation ran and reduced the match count.
Verification
grep -rEn '(AKIA[0-9A-Z]{16}|ghp_[A-Za-z0-9]{36}|sk-[A-Za-z0-9]{20,}|PRIVATE KEY)' redacted/ | wc -l # must be 0
Report: "scanned <files>; secrets found n, redacted n, encoded m; post-redaction scan clean; disclosed-and-rotated <list or none>."
04 同仓库更多 Skills
recipe-performance
Diagnose a specific MetaMask user flow's real-app performance and Sentry critical-user-flow telemetry with deterministic mm-harness recipes. Use for CUF boundaries, cold/warm/background-resume behavior, latency regressions, lifecycle tags, duplicate or blocking network requests, long tasks, layout/paint cost, screen redraws, React rerenders, or browser trace analysis where tests alone cannot prove the real app.
mexc-spot-websocket
MEXC Spot WebSocket workflows for public streams, protobuf handling, depth maintenance, listen keys, and private streams without exposing API keys.
mexc-spot-rest
MEXC Spot REST workflows for public data, signed account requests, orders, wallet/admin actions, and secure signing without exposing API keys.
mexc-futures-websocket
MEXC Futures WebSocket workflows for public streams, private account/order/position streams, ping/pong, subscriptions, and depth maintenance.
0xklen-version-and-refresh-sanctions-lists
暂无简介
verify-tests-cover-changed-lines
Use when a PR adds code that the existing suite may not exercise. Measures patch coverage — the share of newly changed lines hit by tests — before approving.