── CLI REFERENCE ──
exo scan
Scan the project for hardcoded secrets, API keys, tokens, and sensitive values.
## Synopsis
bash
exo scan [path]## Description
Walks the directory tree and inspects each file for secret-like patterns — AWS keys, GitHub tokens, generic API keys, database passwords, private key headers, and more. Binary files are detected via magic-byte inspection and automatically skipped to avoid false positives and wasted processing.
The scanner uses a tightened allowlist: variable names containing secret or password are never suppressed — only placeholder-value patterns (e.g. your-key-here, xxxx, changeme) are.
## Binary File Detection
Before scanning any file, Exo reads the first 512 bytes and calls isBinaryFile() which checks for null bytes and known magic-byte signatures:
| Magic Bytes | Type Skipped |
|---|---|
0x7f 0x45 0x4c 0x46 | ELF executables (Linux binaries) |
0x4d 0x5a | PE executables (Windows .exe) |
0xff 0xd8 0xff | JPEG images |
0x89 0x50 0x4e 0x47 | PNG images |
0x25 0x50 0x44 0x46 | PDF documents |
0x50 0x4b 0x03 0x04 | ZIP archives (also .jar, .docx, .xlsx) |
0x1f 0x8b | Gzip archives |
Null byte (0x00) | Any binary file with embedded null bytes |
## Detected Patterns
| Pattern | Example Match |
|---|---|
| AWS Access Key | AKIA... (20-char key) |
| AWS Secret Key | aws_secret_access_key = ... |
| GitHub Token | ghp_..., github_token = ... |
| Generic API Key | api_key = "...", apikey: ... |
| Database password | db_password = "..." |
| Private key header | -----BEGIN RSA PRIVATE KEY----- |
| Bearer token | Authorization: Bearer ey... |
## Example Output
bash
$ exo scanScanning for hardcoded secrets... [!] config/db.go:14 db_password = "supersecret123" [!] .env:3 GITHUB_TOKEN=ghp_abc123XYZ [i] main_linux: skipped (binary) [i] assets/logo.png: skipped (binary)Scan complete. 2 issue(s) found.## Best Practices
→Run
exo scan before every commit or in your CI pipeline→Add secrets to
.env (gitignored) and never hardcode them in source files→Use environment variable references like
os.Getenv("DB_PASSWORD") instead→Pair with
exo gen pre-commit to add scan as a pre-commit hook automatically