CLI

CLI reference

Every command, flag, environment variable and exit code for capyshield v0.2.1 (watch, guard, vex, actions, init, presets).

Every command, flag and exit code in v0.2.1. Run capyshield <command> --help for the build you have installed. The wrapped command always follows --.

watch

Audit egress of a command without blocking anything — all outbound connections are logged for later use as policy input.

terminal
capyshield watch [--config <file>] [--tls sni|mitm] [--report <events.json>] [--emit-policy <file>] -- <command>

Example output:

terminal
capyshield: audit mode, sni TLS, 1 sensitive ENV value(s) fingerprinted, proxy http://127.0.0.1:49407
npm warn deprecated [email protected]: use String.prototype.padStart()

added 1 package in 497ms

ACTION   DESTINATION              PROTOCOL   CONNS       SENT  RULE
allowed  registry.npmjs.org:443   https-sni      2     4.6 KB
capyshield: 2 connection(s) to 1 host(s)
note: HTTPS payloads were not decrypted; use --tls mitm to scan them for secrets
capyshield: wrote emitted-policy.yaml (review it, then: capyshield guard --config emitted-policy.yaml -- ...)
  • Zero-config egress audit: lists every outbound destination; nothing is blocked (mode: audit).
  • --emit-policy <file> writes an enforce-mode capyshield.yaml allowing exactly the hosts this run reached.
  • --tls mitm inspects HTTPS payloads (the default, sni, sees host names only); --report writes all connection events as JSON.

guard

Enforce egress policy on a command: block secret leaks and unapproved hosts.

terminal
capyshield guard [--config <file>] [--mode <mode>] [--fail-mode <mode>] [--tls sni|mitm] [--agent-id <id>] [--report <file>] [--sync] -- <command>
  • --config defaults to ./capyshield.yaml; without one, guard still enforces the built-in secret, ENV and PII checks.
  • --mode is one of audit, enforce, enforce_fail_open, enforce_fail_closed; --fail-mode is fail_open or fail_closed. Flags win over the config file.
  • --tls is sni (default, no decryption) or mitm (inspect HTTPS with a local CA).
  • --sync pulls the team egress policy (added to your local one) and reports blocked hosts to the Cloud. It needs CAPYSHIELD_TOKEN; if the Cloud can't be reached, guard only warns.
  • --agent-id sets an agent identity for per-agent rules; --report writes events as JSON.
  • Exits 2 when a connection is blocked; otherwise it passes through the wrapped command's exit code.

vex

Triage a Trivy, Grype or OSV-Scanner report with local reachability, then write OpenVEX.

terminal
capyshield vex --input <report> [--scanner trivy|grype|osv] [--repo <dir>] [--output <file>] [--summary <file.md>] [--fail-on <severities>] [--redact-paths] [--sync] [--dry-run] [--config <file>] [--author <name>]
  • Reads a Trivy, Grype or OSV-Scanner report (auto-detected; --scanner forces one) and checks local reachability under --repo (default: the current directory).
  • Writes OpenVEX to --output (stdout when omitted); --summary <file.md> also writes a Markdown summary.
  • --fail-on sets the severities (e.g. high,critical) whose affected findings exit 3.
  • --sync pulls team rules, then uploads the results; --dry-run prints the exact payload instead, without pulling team rules or sending anything.
  • --redact-paths (or vex.redact_paths: true in capyshield.yaml, which capyshield init writes) replaces file paths and the project name with sha256: hashes in the summary and the sync payload.
  • --config defaults to <repo>/capyshield.yaml; --author sets the OpenVEX author (default capyshield).

actions

Audit your GitHub Actions workflows offline: no network, no GitHub API.

terminal
capyshield actions [--repo <dir>] [--fail-on critical|high|medium] [--json]
  • Checks .github/workflows for actions not pinned to a commit SHA, checkout credentials left on disk, missing or write-all token permissions, pull request code checked out by pull_request_target/workflow_run, and untrusted github.event.* input interpolated into run: or github-script.
  • --fail-on exits 4 when a finding is at or above that severity; --json prints findings as JSON on stdout.

init

Create starter config: capyshield.yaml, .capyshield/vex-rules.yaml, and a local CA for TLS inspection.

terminal
capyshield init [--force] [--no-ca]
  • Writes a documented capyshield.yaml (with vex.redact_paths: true), a .capyshield/vex-rules.yaml and a local root CA (in ~/.capyshield).
  • --force overwrites an existing capyshield.yaml; --no-ca skips creating the CA.

presets

List host presets usable in egress.allow_presets.

terminal
capyshield presets

Environment variables

None are required; the CLI runs fully offline unless you pass --sync.

VariablePurpose
CAPYSHIELD_TOKENAPI token for --sync (alias CAPYSHIELD_API_KEY). watch and guard remove both from the wrapped command's environment, so install scripts and agents never see it.
CAPYSHIELD_API_URLOverrides the API endpoint for --sync.
CAPYSHIELD_LOGLog filter for diagnostics on stderr, e.g. debug (default warn).
SOURCE_DATE_EPOCHFixes the OpenVEX timestamp for byte-for-byte reproducible output.

Exit codes

CodeMeaning
0Success. watch and guard pass through the wrapped command's exit code when nothing was blocked.
1Invalid config or flags, --sync without a token, or a refused upload.
2Guard blocked a connection.
3vex found an affected finding at a --fail-on severity.
4actions found a workflow finding at or above --fail-on.