Secret Scanning
Rafter scans your code for secrets and credentials to prevent accidental leaks.Quick Start
Scan a directory for secrets:Detected Secret Types
Rafter detects 21+ types of secrets:Cloud Providers
Cloud Providers
- AWS Access Keys & Secret Keys
- Google API Keys & OAuth credentials
- Azure credentials
Version Control
Version Control
- GitHub Personal Access Tokens
- GitHub OAuth Tokens
- GitHub App Tokens
- GitHub Refresh Tokens
Payment & SaaS
Payment & SaaS
- Stripe API Keys (live & restricted)
- Slack Tokens & Webhooks
- Twilio API Keys
Package Registries
Package Registries
- npm Access Tokens
- PyPI API Tokens
Databases & Keys
Databases & Keys
- Database connection strings (postgres, mysql, mongodb)
- Private keys (RSA, DSA, EC, OpenSSH)
- JWT tokens
- Generic API keys
Usage Examples
Scan Specific File
Scan Directory
Quiet Mode (CI/CD)
Only output if secrets are found:1 if secrets found, perfect for CI pipelines.
JSON Output
Get machine-readable results:Diff Scanning
Scan only files changed since a git ref:Output Format
When secrets are found, Rafter shows:Severity Levels
Severity Indicators
- 🔴 Critical: Immediate security risk (AWS keys, database passwords)
- 🟠 High: Significant risk (generic API keys, bearer tokens)
- 🟡 Medium: Moderate risk (connection strings without credentials)
- 🟢 Low: Low risk (public keys, non-sensitive patterns)
Smart Redaction
Rafter uses smart redaction to show context without exposing secrets:- Short secrets (≤8 chars): Fully redacted (
********) - Long secrets (>8 chars): Show first 4 and last 4 characters
AKIAIOSFODNN7EXAMPLE → AKIA************MPLE
Pre-Commit Scanning
Integrate with git commits:Excluding Files
Rafter automatically skips:- Binary files (images, PDFs, executables)
- Build directories (
node_modules,dist,build,.next) - Version control (
.git) - IDE folders (
.vscode,.idea)
CI/CD Integration
GitHub Actions
1 will fail the pipeline if secrets are detected.
GitLab CI
Audit Trail
All scans are logged to~/.rafter/audit.log:
False Positives
If you encounter false positives:-
Exclude patterns via config:
- Report issues: Help improve detection at rafter-cli/issues
Advanced Usage
Scan with Custom Patterns
Define custom patterns in.rafter.yml:
Engine Selection
Rafter ships two scan engines, selectable via--engine:
rafter agent init for enhanced detection.
Best Practices
Recommended Workflow
- Run
rafter agent scanbefore every commit - Configure pre-commit hooks for automation
- Use
--quietmode in CI/CD pipelines - Review audit logs regularly
- Report false positives to improve accuracy

