Detect secrets in files using your 1Password vault as the source of truth.
Traditional secret scanners use regex patterns to guess what might be a secret. This leads to:
- False positives: Random strings flagged as secrets
- False negatives: Custom secrets that don't match known patterns slip through
- No context: Scanner doesn't know which secrets are actually yours
vault-scanner queries your actual 1Password vault and checks if any of your real secrets appear in the scanned files. If a string in your file matches something in your vault, it's definitely a secret.
Your File → 1Password Vault Query → Exact Match Detection → Report
# Install
git clone https://github.com/UncertainMeow/vault-scanner.git
cd vault-scanner
chmod +x vault-scan vault-sanitize
# Sign in to 1Password
eval $(op signin)
# Scan a file
./vault-scan config.ymlDetects secrets by cross-referencing files against your 1Password vault.
# Basic scan
vault-scan document.md
# Scan specific vault
vault-scan -v Infrastructure server-config.yml
# JSON output for CI/CD
vault-scan -f json deployment.yml
# Multiple files
vault-scan *.md *.ymlExit codes:
0- No secrets found1- Secrets detected
Pattern-based sanitizer for redacting common secret formats.
# Sanitize to new file
vault-sanitize config.yml config-clean.yml
# In-place (creates backup)
vault-sanitize -i sensitive.md
# Strict mode (emails, UUIDs, bearer tokens)
vault-sanitize -s --strict document.md clean.md
# Preserve IP addresses
vault-sanitize -p infrastructure.md safe.md# 1. Scan file against your vault
vault-scan captured-session.md
# Output: "ALERT: 2 secret(s) found (2 high risk)"
# 2. Sanitize the file
vault-sanitize captured-session.md safe-session.md
# 3. Verify sanitization
vault-scan safe-session.md
# Output: "OK: No secrets detected"
# 4. Safe to share with AI/others- Passwords from Login items
- API keys matching known prefixes (sk-, ghp_, etc.)
- Tokens and credentials stored in your vault
- URLs that may contain embedded credentials
- API Keys: OpenAI, Anthropic, GitHub, GitLab, Slack, AWS, Stripe
- Passwords: Common password=value patterns
- Database URLs: MySQL, PostgreSQL, MongoDB, Redis connection strings
- Private Keys: RSA, EC, and generic private key blocks
- Network: IP addresses, MAC addresses (optional)
- Infrastructure: Proxmox tokens, CSRF tokens
# 1Password CLI
brew install 1password-cli
# jq for JSON processing
brew install jq
# Sign in
eval $(op signin)git clone https://github.com/UncertainMeow/vault-scanner.git
cd vault-scanner
chmod +x vault-scan vault-sanitize
# Optional: add to PATH
ln -s "$(pwd)/vault-scan" ~/bin/vault-scan
ln -s "$(pwd)/vault-sanitize" ~/bin/vault-sanitize# GitHub Actions example
- name: Check for secrets
run: |
eval $(op signin)
vault-scan --quiet deployment/*.yml# Pre-commit hook
#!/bin/bash
vault-scan --quiet $(git diff --cached --name-only) || {
echo "Secrets detected! Run vault-sanitize first."
exit 1
}Create a patterns file for organization-specific secrets:
# my-patterns.txt
s/MYCOMPANY_TOKEN=[A-Za-z0-9]+/MYCOMPANY_TOKEN=[REDACTED]/g
s/internal-api-[a-z0-9]{16}/internal-api-[REDACTED]/gvault-sanitize -c my-patterns.txt document.md clean.md- Queries your 1Password vault via the
opCLI - Extracts secrets (passwords, API keys, tokens) from each item
- Searches input files for exact matches
- Reports findings with item names (not the secrets themselves)
- Applies sed patterns to redact known secret formats
- Optionally sanitizes IP/MAC addresses
- Adds sanitization header to output
- Verifies no obvious secrets remain
- Secrets never logged: vault-scan reports item names, not secret values
- Temp files cleaned: All temporary files removed on exit
- Local processing: Nothing sent externally
- Audit trail: JSON reports for compliance
| Feature | vault-scanner | Regex Scanners | git-secrets |
|---|---|---|---|
| Finds YOUR secrets | Yes | No | No |
| False negatives | Zero* | Many | Many |
| False positives | Minimal | Many | Moderate |
| Custom secrets | Automatic | Manual patterns | Manual patterns |
| Setup complexity | 1Password | None | Git hooks |
*For secrets stored in your 1Password vault
- 1Password CLI - Official CLI documentation