Safeguard
Developer Tools•

What is an incremental scan, and what can it safely skip?

An incremental scan analyses only what changed since the last run. It can skip unchanged files and layers, but not re-matching against new advisories.

Safeguard Security Team
4 min read

An incremental scan analyses only the parts of a target that changed since the last scan and reuses earlier results for the rest. It can safely skip unchanged files, layers and manifests. It cannot skip re-matching against new advisory data or policy changes, because those change without any code change.

Definition

Incremental scanning means a scan reuses stored work. The scanner compares the current state of a target against a recorded earlier state, finds the difference, analyses that difference, and merges it with prior results. Compare that with a full scan, which starts from nothing every time.

The benefit is time. On a large repository or a layered image, most content is identical between runs. Re-analysing it is waste.

What is safe to skip, and what is not

Part of the scanSkip when unchanged?Reason
Parsing source filesYesSame content, same parse
Unpacking image layersYesLayer digest identifies the content
Dependency resolution from a lockfileYes, if the file hash and resolver version matchDeterministic inputs
Matching components to advisoriesNoNew advisories arrive daily
Policy evaluationNoPolicies change
Rules or analysers that look across filesNot safelyA change in one file can alter results elsewhere

That last row is where incremental scans go wrong. Some analyses, such as data flow across modules, depend on more than the changed file. A scanner that only re-reads the changed file can miss a new path that passes through unchanged code. Good implementations track dependencies between files and re-analyse affected neighbours, or they fall back to a full scan when they cannot be sure.

How to decide on a cadence

Most platforms run incremental scans on every change and a full scan on a longer cycle. The full scan acts as a correctness check and catches state that drifted. A common pattern:

  1. Pull request: incremental, diff based, fast feedback.
  2. Merge to the main branch: incremental against the last main scan.
  3. Weekly or monthly: full scan, compare against the incremental result.
  4. After a scanner upgrade: full scan, since analysers may have changed.
  5. After a rule or policy change: re-evaluate stored results, and full scan if the rule needs source.

If the periodic full scan finds issues the incremental scans missed, treat that as a bug report about your incremental logic.

Questions to ask about any incremental feature

  • What is the unit of change: file, layer, package, commit?
  • Does it handle renames and moves, or does it treat them as delete plus add?
  • What happens when the baseline is lost or corrupted?
  • Is the scanner version part of the baseline, so an upgrade forces a rebuild?
  • Can you force a full scan on demand?

Try it yourself

Click through it at your own pace, or open it full screen. Pay attention to what the pull request check reports about the change itself, which is the incremental view.

Safeguard scans pull requests with policies and gates, and it keeps inventory so dependency findings are re-evaluated as advisories change. You can try the free scan at https://gold.safeguard.sh/scan.

Quick check

Is an incremental scan less accurate than a full scan?

It can be, if the analysis crosses file boundaries and the tool does not track those dependencies. A scheduled full scan is the safety net.

Do I still need to rescan unchanged code?

Yes, at the matching step. The code did not change, but the advisory data did.

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.