Safeguard
Security Guides•

How do you test scanner coverage with a planted vulnerable package?

Plant a known vulnerable dependency in a throwaway repo and see if your scanner reports it. Steps, a safe example, and how to read a miss.

Safeguard Security Team
3 min read

Create a throwaway repository, add one dependency version with a well documented advisory, run your scanner, and see whether it reports it. If it does, that path works. If it does not, you have found a coverage gap before an attacker or auditor does. Never deploy the test repository.

Why a canary test works

You cannot measure false negatives by looking at findings, because a miss produces nothing to look at. A planted canary gives you a known answer to compare against. It is the same idea as a smoke test in software: cheap, repeatable, and decisive when it fails.

Pick a canary with a documented advisory

Choose a component whose affected range is published by its own maintainers. The Apache Logging Services security page lists CVE-2021-44228 for log4j-core with affected ranges that include [2.13.0, 2.15.0). Version 2.14.1 falls inside that range, so it is a reasonable canary for a Java project. Confirm the range on the page yourself before relying on it, as ranges can be updated.

For other ecosystems, pick any package with a maintainer published advisory and a clearly affected version.

Steps

  1. Create an empty repository named something obvious, such as scanner-canary.
  2. Add a minimal manifest in the ecosystem you want to test, with exactly one planted dependency.
  3. Commit the lockfile too, if the ecosystem has one.
  4. Run the scanner the same way your pipeline does, with the same flags and credentials.
  5. Check whether the planted advisory appears, with the right version and package name.
  6. Repeat with the dependency as a transitive one, pulled in by another package.
  7. Record the result in a table: ecosystem, direct pass or fail, transitive pass or fail, date, scanner version.

Reading the result

ResultMeaningNext step
Found, correct versionPath worksRepeat for other ecosystems
Found, wrong versionVersion resolution problemCheck lockfile handling
Not found, directEcosystem or matching gapAsk vendor, add a workaround
Found direct, missed transitiveDepth gapScan the resolved tree

Safety rules

  • Keep the repository private and never build or deploy it.
  • Do not run the planted code. You are testing the scanner, not the library.
  • Delete or archive the repository when done, so the planted finding does not enter your real metrics.
  • Tag it so reports exclude it.

Repeat the test whenever you change scanner version, add an ecosystem, or change how pipelines invoke the tool. See also a clean scan usually means the scanner did not look and check scanner language and ecosystem support before choosing.

Try it yourself

Click through it at your own pace, or open it full screen. Watch how a finding moves from detection to a tracked item, which is what your canary should trigger.

Safeguard offers dependency scanning and a free scan at gold.safeguard.sh/scan. Run your canary through any tool you evaluate.

Quick check

How often should I rerun the canary?

After any scanner, ecosystem or pipeline change, and on a regular schedule such as quarterly.

Is it safe to add a vulnerable version to a repository?

In an isolated, never deployed repository, yes. Do not build, run or publish it.

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.