TERMINAL
clawhub install secret-detection📖 About This Skill
name: secret-detection description: Git hook to detect secrets before commit. version: 1.0.0 author: skill-factory metadata: openclaw: requires: env: [] bins: ["git", "python3"]
Secret Detection
What This Does
This skill provides a git pre‑commit hook that scans staged files for common secret patterns (API keys, passwords, tokens) and blocks the commit if any are found. It helps prevent accidental leakage of secrets to public repositories.
Inputs: Git staged files (automatically scanned by the hook) or manual file paths. Outputs: Detection report with line numbers; non‑zero exit code if secrets found.
When To Use
Use this skill when:
Usage
Installation
# Install the hook in your git repository
./scripts/main.py install
Manual Scan
# Scan specific files
./scripts/main.py scan --file path/to/fileScan all staged files (like the hook does)
./scripts/main.py scan --staged
Hook Behavior
git commitExamples
Example 1: Installing the Hook
$ ./scripts/main.py install
✓ Pre-commit hook installed at .git/hooks/pre-commit
✓ Hook will scan for secrets on every commit
Example 2: Secret Detection Blocking a Commit
$ git commit -m "Add config"
⚠️ Secret detected in config.yaml line 12: AWS_ACCESS_KEY_ID=AKIA...
⚠️ Secret detected in .env line 3: PASSWORD=secret123
✗ Commit blocked: 2 secrets found
Example 3: Manual Scan
$ ./scripts/main.py scan --staged
Scanning 3 staged files...
✓ config.yaml: clean
✓ .env: clean
✓ src/main.py: clean
✓ No secrets found
Requirements
Limitations
⚡ When to Use
💡 Examples
Example 1: Installing the Hook
$ ./scripts/main.py install
✓ Pre-commit hook installed at .git/hooks/pre-commit
✓ Hook will scan for secrets on every commit
Example 2: Secret Detection Blocking a Commit
$ git commit -m "Add config"
⚠️ Secret detected in config.yaml line 12: AWS_ACCESS_KEY_ID=AKIA...
⚠️ Secret detected in .env line 3: PASSWORD=secret123
✗ Commit blocked: 2 secrets found
Example 3: Manual Scan
$ ./scripts/main.py scan --staged
Scanning 3 staged files...
✓ config.yaml: clean
✓ .env: clean
✓ src/main.py: clean
✓ No secrets found