Secrets Leak Guardrail skill - #228
Conversation
Scan code, config, logs, or exported files for API keys, tokens, and passwords before they're shared. Flags every finding to the user instead of redacting silently.
There was a problem hiding this comment.
Pull request overview
Adds a new submission (“Secrets Leak Guardrail”) to help agents detect likely leaked credentials in code/logs/files before sharing them, with a bundled Python scanner plus agent instructions that require surfacing findings to the user (no silent redaction).
Changes:
- Added
SKILL.mddefining when and how to run the leak check and how to report findings. - Added a standalone Python scanner script (
scan_secrets.py) that detects known token formats and high-entropy secret-like assignments. - Added submission metadata and a human-facing README describing usage and limits.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| submissions/secrets-leak-guardrail/SKILL.md | Defines the runtime guardrail procedure and reporting expectations. |
| submissions/secrets-leak-guardrail/scripts/scan_secrets.py | Implements regex- and entropy-based secret candidate detection. |
| submissions/secrets-leak-guardrail/README.md | Human-facing overview, usage examples, and limitations. |
| submissions/secrets-leak-guardrail/metadata.json | Registers the submission (name/description/platforms/tags/author/version/dates). |
Matches the invocation shown in SKILL.md and README.md, per Copilot review feedback on the PR.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
Comments suppressed due to low confidence (1)
submissions/secrets-leak-guardrail/scripts/scan_secrets.py:73
- The scanner currently reports regex matches even when they are obvious documentation placeholders (e.g., "sk-EXAMPLE..."), but SKILL.md explicitly instructs not to flag such placeholders as real findings. Consider filtering placeholder-like matches for all pattern hits (not just high-entropy assignments) to avoid noisy/incorrect findings.
for name, pattern in PATTERNS:
for match in pattern.finditer(line):
findings.append({
"source": source,
"line": line_number,
Fixes the issues flagged in the automated review: see PR discussion for details.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 4 out of 4 changed files in this pull request and generated no new comments.
Comments suppressed due to low confidence (1)
submissions/secrets-leak-guardrail/scripts/scan_secrets.py:103
- The scanner currently prints the first/last characters of each match. Even partial token/password disclosure is still sensitive and can undermine the guardrail goal if the output is copied/shared. Prefer a non-reversible fingerprint (length + short SHA-256 prefix) so findings can be referenced without leaking any characters.
def _redact_middle(value: str) -> str:
# Short values (a short password, a connection-string fragment) get no
# characters revealed at all, revealing even 2+2 chars of something
# this short exposes too large a fraction of the actual secret.
if len(value) <= 12:
return "…redacted…"
return value[:6] + "…redacted…" + value[-4:]
| return findings | ||
|
|
||
|
|
||
| def _redact_middle(value: str) -> str: |
There was a problem hiding this comment.
The redaction still leaks part of real secrets. For longer values it prints the first 6 and last 4 characters. For a skill whose job is preventing leakage, echoing 10 characters of a live token into output that might get copied is problematic. The clean fix is the one Copilot suggested, replace it with a non-reversible fingerprint (length + short hash) so nothing from the real value is echoed.
Scan code, config, logs, or exported files for API keys, tokens, and passwords before they're shared. Flags every finding to the user instead of redacting silently.