secret-handling

Block commits containing secrets and validate staged files against credential patterns.

Updated Nov 11, 2025
One-click install
npx skills add https://github.com/acmeleme/Conversation-Knowledge-Mining-Solution-Accelerator --skill secret-handling-acmeleme
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: secret-handling
Source: https://github.com/acmeleme/Conversation-Knowledge-Mining-Solution-Accelerator/tree/main/.copilot/skills/secret-handling
Command: npx skills add https://github.com/acmeleme/Conversation-Knowledge-Mining-Solution-Accelerator --skill secret-handling-acmeleme

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Spawned agents have read access to the repository, including .env files containing live credentials. If an agent reads secrets and writes them to .squad/ files (decisions, logs, history), Scribe auto-commits them to git, exposing them in remote history. This skill codifies absolute prohibitions and safe alternatives.

Core Features & Use Cases

Prohibited File Reads

NEVER read these files:

  • .env (production secrets)
  • .env.local (local dev secrets)
  • .env.production (production environment)
  • .env.development (development environment)
  • .env.staging (staging environment)
  • .env.test (test environment with real credentials)
  • Any file matching .env.* UNLESS explicitly allowed (see below)

Allowed Alternatives

  • .env.example (safe — contains placeholder values, no real secrets)
  • .env.sample (safe — documentation template)
  • .env.template (safe — schema/structure reference)

Prohibited Output Patterns

NEVER write these to .squad/ files: | Pattern Type | Examples | Regex Pattern (for scanning) | |--------------|----------|-------------------------------| | API Keys | OPENAI_API_KEY=sk-proj-..., GITHUB_TOKEN=ghp_... | [A-Z_]+(?:KEY|TOKEN|SECRET)=[^\s]+ | | Passwords | DB_PASSWORD=super_secret_123, password: "..." | (?:PASSWORD|PASS|PWD)[:=]\s*["']?[^\s"']+ | | Connection Strings | postgres://user:pass@host:5432/db, Server=...;Password=... | (?:postgres|mysql|mongodb)://[^@]+@|(?:Server|Host)=.*(?:Password|Pwd)= | | JWT Tokens | eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9... | eyJ[A-Za-z0-9_-]+\.eyJ[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+ | | Private Keys | -----BEGIN PRIVATE KEY-----, -----BEGIN RSA PRIVATE KEY----- | -----BEGIN [A-Z ]+PRIVATE KEY----- | | AWS Credentials | AKIA..., aws_secret_access_key=... | AKIA[0-9A-Z]{16}|aws_secret_access_key=[^\s]+ | | Email Addresses | [email protected] (PII violation per team decision) | [a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,} |

Scribe Pre-Commit Validation

Before committing .squad/ changes, Scribe MUST:

  1. Scan all staged files for secret patterns (use regex table above)
  2. Check for prohibited file names (don't commit .env even if manually staged)
  3. If secrets detected:
    • STOP the commit (do NOT proceed)
    • Remove the file from staging: git reset HEAD <file>
    • Report to user:
      🚨 SECRET DETECTED — commit blocked
      
      File: .squad/decisions/inbox/river-db-config.md
      Pattern: DATABASE_URL=postgres://user:password@localhost:5432/prod
      
      This file contains credentials and MUST NOT be committed.
      Please remove the secret, replace with placeholder, and try again.
      
    • Exit with error (never silently skip)

Remediation — If a Secret Was Already Committed

If you discover a secret in git history:

  1. STOP immediately — do not make more commits
  2. Alert the user:
    🚨 CREDENTIAL LEAK DETECTED
    
    A secret was found in git history:
    Commit: abc1234
    File: .squad/decisions/inbox/agent-config.md
    Pattern: API_KEY=sk-proj-...
    
    This requires immediate remediation:
    1. Revoke the exposed credential (regenerate API key, rotate password)
    2. Remove from git history (git filter-repo or BFG)
    3. Force-push the cleaned history
    
    Do NOT proceed with new work until this is resolved.
    
  3. Do NOT attempt to fix it yourself — secret removal requires specialized tools
  4. Wait for user confirmation before resuming work

Quick Start

Use the policy to enforce secret handling.