Skip to content

AL-JANEF/janef-forge / skills/security/secrets-guard

secrets-guard

Verified

Keep 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.

FileKindSize
SKILL.mdskill md4.7 KB
capability.jsonconfig2.0 KB
references/leak-response.mdmarkdown1.8 KB
references/setup.mdmarkdown1.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 });
```
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: 471kUpdated Claude CodeCodexVerifiedInstall
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: 471kUpdated Claude CodeCodexVerifiedInstall
rea-tool-designmorluto/reaAudit, investigate, design, or change REA investigation tools, CLI/MCP contracts, provider capabilities, and Evidence semantics.Stars: 471kUpdated Claude CodeCodexVerifiedInstall
ponytail-auditDietrichGebert/ponytailQuality audit of the whole repo: bugs, security, real load, missing tests, speed, and what to delete. Most important first.Stars: 194kUpdated Claude CodeCodexVerifiedInstall