AL-JANEF/janef-forge / skills/security/secrets-guard
secrets-guard
VerifiedKeep secrets out of code, git history, logs, and client bundles: detect hardcoded API keys, credentials, tokens, and connection strings; move them to the environment or a secret manager; catch client-exposed prefixes; set up gitignore and pre-commit scanning; run the rotate-first response when a secret has leaked. Use for any credential, .env, or "where do I put my key?" question.
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 4.7 KB |
| capability.json | config | 2.0 KB |
| references/leak-response.md | markdown | 1.8 KB |
| references/setup.md | markdown | 1.7 KB |
references/setup.md
View on GitHub# Secrets Prevention Setup
Copyable configuration to keep secrets out of the repo.
## .gitignore
```gitignore
# Environment / secrets
.env
.env.*
!.env.example
*.pem
*.key
secrets/
```
The `!.env.example` line re-includes the example file so the *names* of required
variables are documented and committed, while real values stay out.
## .env.example
Commit this; it documents required variables with placeholder values.
```dotenv
# Database
DATABASE_URL=postgres://user:password@localhost:5432/dbname
# Third-party services
STRIPE_SECRET_KEY=replace_me
WHATSAPP_API_TOKEN=placeholder
# Auth
JWT_SECRET=replace_with_a_long_random_value
# Public (client-safe) values only
NEXT_PUBLIC_SUPABASE_URL=https://placeholder.supabase.co
NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY=placeholder
```
Note the split: only genuinely client-safe, publishable values carry a public
prefix. A secret key must never be prefixed for client exposure.
## Pre-commit secret scanning (gitleaks)
Install gitleaks, then add a pre-commit hook so secret-shaped strings are blocked
before they're ever committed.
`.pre-commit-config.yaml`:
```yaml
repos:
- repo: https://github.com/gitleaks/gitleaks
rev: v8.18.0
hooks:
- id: gitleaks
```
Or a bare git hook at `.git/hooks/pre-commit`:
```bash
#!/bin/sh
gitleaks protect --staged --redact --verbose || {
echo "Potential secret detected — commit blocked."
exit 1
}
```
Make it executable: `chmod +x .git/hooks/pre-commit`.
## Don't log secrets
Check request loggers and error handlers don't emit auth headers or tokens:
```js
// redact sensitive headers before logging
const safe = { ...req.headers };
delete safe.authorization;
delete safe.cookie;
logger.info({ headers: safe });
```
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| rea-analysis-optimizationmorluto/reaOptimize REA providers and shared analysis workflows for agent context, latency, CPU, and memory while preserving correctness and Evidence. Use for analysis bottlenecks and cache or query design; CI/test-suite optimization belongs to rea-ci-tests-audit. | Stars: 471k | Updated | Claude CodeCodex | Verified | Install |
| rea-ci-tests-auditmorluto/reaAudit REA CI and test suites for correctness, fixture drift, false passes, and measured performance; use for suite or workflow investigations and efficiency changes, rather than ordinary feature testing or a single test failure. | Stars: 471k | Updated | Claude CodeCodex | Verified | Install |
| rea-tool-designmorluto/reaAudit, investigate, design, or change REA investigation tools, CLI/MCP contracts, provider capabilities, and Evidence semantics. | Stars: 471k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-auditDietrichGebert/ponytailQuality audit of the whole repo: bugs, security, real load, missing tests, speed, and what to delete. Most important first. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |