secret-handling

Prevents agents from reading .env files and committing credentials to git history.

1|Updated Jul 7, 2026
One-click install
npx skills add https://github.com/seiggy/maf-copilot-studio-demo --skill secret-handling-seiggy
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: secret-handling
Source: https://github.com/seiggy/maf-copilot-studio-demo/tree/main/.copilot/skills/secret-handling
Command: npx skills add https://github.com/seiggy/maf-copilot-studio-demo --skill secret-handling-seiggy

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Agents with repository access can accidentally read live credentials from .env files and write them into committed files, leaking secrets into git history. This Skill enforces strict prohibitions and safe alternatives to prevent credential exposure. ## Core Features & Use Cases - Prohibited File Rules: Blocks reading of .env, .env.local, .env.production, and other .env.* variants while allowing safe templates like .env.example. - Secret Pattern Detection: Provides regex patterns to detect API keys, passwords, connection strings, JWT tokens, private keys, AWS credentials, and email addresses before commits. - Pre-Commit Validation: Defines a blocking validation workflow that scans staged files, halts commits containing secrets, and reports violations to the user. - Use Case: Before committing team decision logs to git, an automated commit process scans staged content for credential patterns, blocks the commit if a database connection string is found, and instructs the user to replace it with a placeholder. ## Quick Start Scan my staged git changes for any secrets or credentials before committing and block the commit if any are found.

Frequently Asked Questions about secret-handling

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I prevent agents from committing secrets to git?

Scan all staged files for secret patterns like API keys, passwords, and connection strings before running git commit. If a match is found, unstage the file with git reset, report the violation to the user, and exit with an error instead of committing.

What regex patterns detect credentials in code files?

Common patterns include [A-Z_]+(KEY|TOKEN|SECRET)= for API keys, eyJ... for JWT tokens, AKIA[0-9A-Z]{16} for AWS access keys, and -----BEGIN [A-Z ]+PRIVATE KEY----- for private keys. Connection strings match (postgres|mysql|mongodb)://user:pass@host formats.

Can I read .env files to understand the config schema?

No, never read .env files even just to check the schema. Use .env.example, .env.sample, or .env.template instead, which show the required structure with placeholder values and no real credentials.

What should I do if a secret was already committed to git history?

Stop making commits immediately and alert the user with the commit hash, file, and leaked pattern. The credential must be revoked and rotated, then removed from history using git filter-repo or BFG, followed by a force-push of the cleaned history.

Why block the commit instead of just warning about secrets?

Silent warnings allow secrets to reach remote git history where they persist even after deletion. Blocking the commit before it happens is the only reliable enforcement, since remediation after a leak requires credential rotation and history rewriting.