Safeguard
Security Guides•

Does Maven dependency scope change which scan findings matter?

Test and provided scopes are not transitive and may never ship. See how Maven scope should shape which vulnerability scan findings you treat as urgent.

Safeguard Security Team
3 min read

Yes. Maven scope decides which classpaths include a dependency and whether it passes to projects that depend on yours. A finding in a test scope library usually never ships, while a compile scope finding does. A good scan reports the scope so you can sort by it, but scope is a signal, not a verdict.

What the scopes mean

The Maven documentation lists six scopes:

ScopeMeaningTransitive
compileDefault, on all classpathsYes
providedSupplied by the JDK or container at runtimeNo
runtimeNeeded to run, not to compileYes
testTest compile and execution onlyNo
systemA local jar, not resolved from a repositoryNot stated
importFor a pom in dependencyManagementNot applicable

The documentation also shows how a transitive dependency's scope changes based on its parent. A compile dependency whose own dependency is runtime becomes runtime. A compile dependency whose own dependency is provided or test is omitted.

Why this affects how you triage

A scanner that lists every artifact in the build may include test tools such as unit test frameworks. Most of those never run in production. Treating them like a vulnerable web framework wastes effort.

But be careful in three places.

  • provided libraries are not in your jar, but they run in the container that hosts it. The risk sits in the environment, so someone else must patch it.
  • test libraries run in CI, where your secrets live. A compromised test dependency is a supply chain risk even though it never ships.
  • system scope jars are not fetched from a repository, so a scan that resolves from Maven coordinates may not see them at all.

What to check in your tool

  1. Does the report show the scope for each finding?
  2. Can you filter or set gates by scope, for example block on compile and runtime only?
  3. Does it resolve transitive dependencies, and does it apply the scope table above? OSV-Scanner's docs say transitive scanning is described for pom.xml, and that test dependencies are not yet supported in its dependency graph.
  4. Does it find system scope jars?

A simple policy

Block releases on compile and runtime findings above your threshold. Review provided findings with the platform owner. Review test findings on a schedule, with attention to CI secrets. For gating ideas see what a release gate should block on.

Safeguard's reachability analysis helps rank what remains after scope, and the free scan is at https://gold.safeguard.sh/scan.

Try it yourself

Open the exploitability demo and see how context changes which findings matter. Think of scope as one such context.

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

Quick check

Is a test scope dependency transitive?

No. Per the Maven documentation, test scope is not transitive and is used only for test compilation and execution.

Can I ignore every test scope finding?

Not blindly. Test dependencies run in CI, which often holds credentials, so review them on a schedule.

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.