Safeguard
Developer Tools•

When should you run a security scan from the CLI instead of CI?

Use the CLI for local checks, investigations, and custom pipelines. Use CI for anything that must be enforced on every change with the same settings.

Safeguard Security Team
3 min read

Run scans from the command line when you want a fast local check, are investigating something, or work in a pipeline your CI service does not cover. Use CI for anything that must apply to every change. The CLI is a tool, and CI is a control point.

What each is for

A command line scanner runs wherever you run it: your laptop, a build agent, a jump host. It is flexible and scriptable. CI is a place where your team agreed to run checks automatically on each change.

The same command can often do both jobs. The difference is who triggers it and whether anyone can skip it.

When the CLI is the better choice

  • Before pushing. A developer wants to check a branch without waiting for a pipeline.
  • Investigations. Someone wants to scan a specific directory, an old release, or a downloaded artifact.
  • Unusual build systems. Your CI platform has no native integration, so a command in a script is the integration.
  • Restricted networks. Builds on isolated infrastructure still need a scan step you can call directly.
  • Triage. Reproducing a finding locally to understand it before opening a ticket.

When CI is the better choice

  • You need the result to block a merge.
  • You need the same settings on every change.
  • You need a record that the scan ran, with the version of tool and data.
  • You are collecting evidence for an audit or a customer.

Comparison

NeedCLI by handCI job
Speed of feedbackFastDepends on queue
Enforced for everyoneNoYes, if required
Reproducible settingsOnly if scriptedYes
Good for one-off analysisYesAwkward
Audit evidenceWeakStrong

A common failure

A developer runs the scanner once, sees a clean result, and assumes the pipeline will agree. Then CI fails on a different dependency resolution or a newer advisory, and trust in the tool drops. Naming the cause early (version, data timing, settings) saves a long thread.

Make the two agree

The worst outcome is a CLI scan that passes locally and a CI scan that fails with different settings. Avoid it by keeping the config in the repository and calling the same command in both places. Pin the scanner version in CI and tell developers which one to install locally.

A small checklist

  1. Store scanner settings in the repository, not in personal dotfiles.
  2. Use the same command locally and in CI.
  3. Pin versions in CI and update them on a schedule.
  4. Make CI the only source of pass or fail for merging.
  5. Treat local results as advice.

Where Safeguard fits

The Safeguard CLI is at version 1.4.0 on the download page, with curl and PowerShell installers (npm is listed as coming soon). The same policies can apply on pull requests as gates. Try a scan first at https://gold.safeguard.sh/scan.

Quick check

Can a CLI scan count as audit evidence?

It can, but a CI run is easier to defend because it is recorded, repeatable, and independent of one person's machine.

Why do local and CI results differ?

Usually different tool versions, different advisory data timing, or different settings. Keep config in the repository and pin versions.

Last reviewed: 19 October 2026.

Never miss an update

Weekly insights on software supply chain security, delivered to your inbox.

Self-healing security runs on Safeguard.

Your first fix PR is minutes away.

No sales call required, even your agent can complete the purchase over MCP.