Safeguard
Security Guides•

Does reachability analysis count test code and dev dependencies?

Whether tests and dev dependencies count depends on what ships. Learn how to scope reachability so tool-only findings do not drown out production risk.

Safeguard Security Team
3 min read

It depends on how the analysis is scoped. A path that exists only from test code or a build tool does not run in production, so most teams rank it lower. But it can still matter for your CI environment and your developers' machines. Scope reachability by where the code runs, not by one global switch.

Three places code can run

WhereExamplesWho is exposed
Production runtimeThe service handling customer trafficCustomers and your data
Build and CICompilers, bundlers, test runnersYour pipeline and its secrets
Developer machinesLinters, local servers, editorsIndividual workstations

A vulnerable function reachable only from a unit test sits in the second or third row. Its blast radius is different, not zero.

Why scope matters for noise

Dev dependencies are often the largest part of a modern project tree. If a reachability report mixes test-only paths with production paths, the "reachable" count inflates and trust drops. If it drops them entirely, you may miss a build tool vulnerability that can steal CI tokens.

The better design is to tag each finding with its scope and let policy decide.

How to set it up

  1. Separate the entry points. Production entry points are the main program, request handlers and job runners. Test entry points are test files and fixtures.
  2. Run analysis per scope, or ask the tool to label which entry point started each path.
  3. Set different thresholds. For example, block a release on production reachable findings of a given severity, and open a lower priority ticket for CI scope findings.
  4. Review CI scope by privilege. A build tool that sees deployment credentials deserves more attention than one that only formats code.
  5. Revisit when scope changes. A test helper copied into production code changes the answer.

Common mistakes

  • Treating "dev dependency" as "harmless". Some run install scripts or process untrusted input, such as parsers used on downloaded files.
  • Counting everything as production because the lockfile does not label scope.
  • Ignoring test code that is deployed, such as a mock server left enabled in a staging environment that holds real data.

Reading the result for a decision

When someone says "not reachable", ask "from which entry points?". An answer such as "not from production entry points, reachable from the test runner" is a precise, useful statement, and it leads to a sensible priority rather than a blanket dismissal.

Safeguard includes reachability analysis alongside SBOM and dependency scanning, and you can run a free scan at gold.safeguard.sh/scan to see the output on your own repository.

Quick check

Should I hide dev dependency findings?

Do not hide them. Label them by scope and give them a lower priority unless the tool touches secrets or untrusted input.

Can test code ever matter for production reachability?

Yes, if test code is packaged into the deployed artifact or reused by production modules. Check what actually ships.

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.