── 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 BytesType Skipped
0x7f 0x45 0x4c 0x46ELF executables (Linux binaries)
0x4d 0x5aPE executables (Windows .exe)
0xff 0xd8 0xffJPEG images
0x89 0x50 0x4e 0x47PNG images
0x25 0x50 0x44 0x46PDF documents
0x50 0x4b 0x03 0x04ZIP archives (also .jar, .docx, .xlsx)
0x1f 0x8bGzip archives
Null byte (0x00)Any binary file with embedded null bytes

## Detected Patterns

PatternExample Match
AWS Access KeyAKIA... (20-char key)
AWS Secret Keyaws_secret_access_key = ...
GitHub Tokenghp_..., github_token = ...
Generic API Keyapi_key = "...", apikey: ...
Database passworddb_password = "..."
Private key header-----BEGIN RSA PRIVATE KEY-----
Bearer tokenAuthorization: Bearer ey...

## Example Output

bash
$ exo scan
Scanning 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