CLI Reference

The HAVOC CLI (havoc) is the primary tool for running security scans locally and in CI. Install via npm: npm install -g @havoc/cli

havoc scan

havoc scan [path] [flags]

Runs a full security scan on your project. When run in CI with GITHUB_EVENT_NAME=pull_request, automatically switches to diff-aware mode and only parses changed files (while using cached coverage from the last full scan).

Arguments

ArgumentDefaultDescription
path.Directory to scan. Defaults to current directory.

Flags

FlagTypeDefaultDescription
--formatstringtextOutput format: text, json, sarif, github
--outputstringstdoutWrite output to a file instead of stdout
--min-severitystringinfoMinimum severity to report: critical, high, medium, low, info
--fail-onstringhighExit with code 1 if findings at or above this severity exist
--coverage-thresholdnumberFail if authorization coverage drops below this % (e.g. 80)
--diffbooleanautoForce diff-aware mode (compares against baseline)
--fullbooleanfalseForce full scan even in CI
--analyzerstring[]allRun specific analyzers only (comma-separated)
--excludestring[]Glob patterns to exclude from scanning
--configstring.havoc.ymlPath to config file
--no-cloudbooleanfalseSkip uploading results to HAVOC Cloud
--quietbooleanfalseSuppress progress output; only show findings

Examples

# Basic scan
havoc scan

# JSON output to file
havoc scan --format json --output havoc-results.json

# Only report high and above, fail the build
havoc scan --min-severity high --fail-on high

# Scan specific directory, exclude tests
havoc scan ./app --exclude "tests/**,database/**"

# Full scan with coverage threshold
havoc scan --full --coverage-threshold 85

# SARIF output for GitHub Code Scanning
havoc scan --format sarif --output results.sarif

havoc baseline

havoc baseline [subcommand] [flags]

Manage scan baselines. A baseline captures the current state of findings — subsequent diff-aware scans only report new findings introduced since the baseline.

Subcommands

SubcommandDescription
createCreate a new baseline from the current scan results
showDisplay the current baseline
diffCompare current scan against baseline without failing
clearRemove the current baseline

Examples

# Scan and save as new baseline
havoc scan --full && havoc baseline create

# See what changed since last baseline
havoc baseline diff

# Show current baseline summary
havoc baseline show

havoc init

havoc init [flags]

Initializes HAVOC in your project. Creates a .havoc.yml config file with sensible defaults based on your detected framework version.

Flags

FlagDefaultDescription
--forcefalseOverwrite existing .havoc.yml
--interactivetruePrompt for configuration options
--cifalseNon-interactive mode with CI defaults
# Interactive init (recommended for first setup)
havoc init

# Silent init for CI bootstrap
havoc init --ci --force

havoc auth

havoc auth [subcommand]

Manage authentication with HAVOC Cloud.

SubcommandDescription
loginAuthenticate with HAVOC Cloud via GitHub OAuth
logoutRemove stored credentials
statusShow current authentication status
tokenPrint API token (for CI use)
# Login (opens browser)
havoc auth login

# Check status
havoc auth status

# Get token for CI environment variable
havoc auth token

Global Flags

These flags work with all HAVOC commands:

FlagDescription
--version, -vPrint HAVOC CLI version
--help, -hShow help for any command
--verboseEnable verbose/debug output
--no-colorDisable colored output
--configOverride config file location

Exit codes

CodeMeaning
0Scan completed, no findings above --fail-on threshold
1Scan completed, findings at or above --fail-on threshold
2Scan error (config error, parse error, etc.)
3Coverage threshold not met (when --coverage-threshold set)