Safeguard
Developer Tools•

How fast does a pull request dependency scan need to be?

A pull request dependency scan should finish within the time developers already wait for tests. Here is how to budget, cache and split the work.

Safeguard Security Team
3 min read

A pull request dependency scan should finish in about the time developers already wait for their other checks, and ideally in parallel with them. There is no universal number. If the scan is the slowest check, people will start merging around it, so measure your own pipeline and set the budget there.

Why speed is a security property

A slow gate does not just annoy people. It changes behaviour: developers batch changes into bigger pull requests, rerun until green, or ask for the check to be made optional. Each of those weakens the control. Speed protects adoption.

What makes a dependency scan slow

  • Resolving the tree from scratch. Installing everything just to scan it.
  • Fetching vulnerability data on every run. Large downloads, repeated.
  • Scanning the whole repository on every pull request. Including unchanged projects in a monorepo.
  • Running it serially after tests. The scan waits when it could run alongside.
  • Heavy analysis on every run. Deep reachability analysis on every commit when a quick diff check would do for most.

Ways to cut the time

TechniqueEffectCaution
Read the lock file, do not installSkips the slowest stepNeeds a committed lock file
Scan only the diffFast, focused resultDoes not cover old packages, keep a scheduled scan
Run in parallel with testsHides the timeNeeds a runner with capacity
Cache vulnerability dataSaves repeated downloadsSet an expiry, stale data is a risk
Split fast and deepQuick check on every push, deep analysis on merge or nightlyMake sure the deep result still reaches someone
Skip when no dependency file changedZero cost for most pull requestsKeep a periodic full run

npm's documentation on its clean install command notes that keeping the npm cache around speeds up installs in CI, which is one example of the caching idea. For the scan data, the same logic applies with a freshness limit.

A budget exercise

  1. Look at the median time of your existing pull request checks.
  2. Time the dependency scan on a typical change and on your largest one.
  3. If it is slower than the other checks, apply the techniques above in order: lock file input, diff only, parallel run.
  4. Re-measure, and decide on a target you can state in one sentence, such as "no slower than the unit test job".

What not to trade away

Do not cut speed by skipping transitive dependencies or by reading only the manifest. A fast scan that misses the tree is not a scan. And do not let caching hide new advisories for days.

Where Safeguard fits

Safeguard offers dependency scanning with gates that can block a pull request, a CLI for local runs, and reachability analysis to prioritise findings. Try the free scan at gold.safeguard.sh/scan.

Quick check

Should the scan block the pull request while it is running?

Only if the check is required. If it is too slow, fix the speed instead of making it optional.

Is it safe to cache vulnerability data?

Yes with a short expiry and a visible timestamp. Long lived caches hide new advisories.

Sources

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.