Skip to content

Secrets Leak Guardrail skill - #228

Open
Tim (Timziito) wants to merge 5 commits into
microsoft:mainfrom
Timziito:add-secrets-leak-guardrail
Open

Secrets Leak Guardrail skill#228
Tim (Timziito) wants to merge 5 commits into
microsoft:mainfrom
Timziito:add-secrets-leak-guardrail

Conversation

@Timziito

Copy link
Copy Markdown
Contributor

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.

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.
Copilot AI review requested due to automatic review settings July 27, 2026 14:31

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.md defining 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).

Comment thread submissions/secrets-leak-guardrail/scripts/scan_secrets.py Outdated
Tim (Timziito) and others added 2 commits July 27, 2026 16:37
Matches the invocation shown in SKILL.md and README.md, per Copilot review feedback on the PR.
Copilot AI review requested due to automatic review settings July 27, 2026 14:51

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

Comment thread submissions/secrets-leak-guardrail/scripts/scan_secrets.py
Comment thread submissions/secrets-leak-guardrail/scripts/scan_secrets.py
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings July 27, 2026 15:56

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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,

Comment thread submissions/secrets-leak-guardrail/SKILL.md Outdated
Fixes the issues flagged in the automated review: see PR discussion for details.
Copilot AI review requested due to automatic review settings July 27, 2026 19:52

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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:

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants