Safeguard
Supply Chain•

Do test and provided scope dependencies matter for vulnerability scans?

Maven scopes decide where a dependency lands on the classpath. See how test, provided, runtime and compile scope change what a scan finding means.

Safeguard Security Team
3 min read

Yes, but they matter differently. Compile and runtime dependencies ship with your application, so findings there are your risk. Test scope never reaches production, so findings are lower priority. Provided scope is supplied by a container, so the container's version decides your exposure, not your POM.

Definition: what a Maven scope does

Maven describes scope as a way to limit the transitivity of a dependency and to decide when it is included in a classpath. Every dependency has one, and compile is the default.

ScopeOn which classpathsPassed on to consumers?
compilecompile, runtime, testYes
providedcompile, test (not runtime)No, not transitive
runtimeruntime, test (not compile)Through the dependency graph
testtest onlyNo, not transitive
systemLocal jar at a given path, not recommendedNot stated

The Maven guide describes provided as something you expect the JDK or a container to supply at runtime, and test as available only for test compilation and execution.

How to read a finding by scope

Compile and runtime. These are in the packaged application. A vulnerable version here needs a decision: upgrade, constrain, exclude or accept with a reason.

Test. A flaw in a test library can still matter on a build machine, since tests run code with the privileges of your CI job. It rarely matters to your customers. Rank it below shipped code, but do not hide it.

Provided. Your POM names a version only for compilation. At runtime the application server or servlet container brings its own copy. The question to ask is which version the deployed container actually has. A clean POM can sit on top of an old container.

System. Maven does not download these from a repository. It reads a jar from a local path, which means a scanner reading coordinates may miss it entirely. Treat each one as a manual inventory item.

Steps to triage a scan by scope

  1. Export the dependency tree with scope shown. In Maven, mvn dependency:tree prints it.
  2. Filter findings to compile and runtime first.
  3. For provided findings, record the container version in your asset inventory and check it separately.
  4. For test findings, batch them into routine upgrades.
  5. For every system scope entry, find out where that jar came from.

Many scanners flatten scope away. If yours does, you lose the cheapest prioritisation signal you have.

Try it yourself

Click through it at your own pace, or open it full screen.

Open a component and look at how it entered the project. Direct and transitive entries need different fixes.

Where Safeguard fits

Safeguard provides SBOM and dependency scanning for Java projects, with reachability analysis to separate code your application can call from code that is only present. You can try a free scan at gold.safeguard.sh/scan.

Quick check

Is a test scope vulnerability safe to ignore?

Not always. It will not ship, but tests run on developer and CI machines. Lower the priority and fix it in routine upgrades.

Does a provided dependency count as my vulnerability?

It counts as your exposure only if the deployed container carries the vulnerable version. Check the container, not just the POM.

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.