Safeguard
Developer Tools•

Why do scanners treat pre-release and build metadata versions differently?

Versions like 1.0.0-rc.1 or 1.0.0+build5 sort by SemVer rules that some tools skip. See why two scanners disagree on them and how to check your own.

Safeguard Security Team
3 min read

Scanners disagree on versions like 1.0.0-rc.1 or 1.0.0+build5 because SemVer gives them special ordering rules. A pre-release ranks below its normal version, and build metadata is ignored when comparing. A tool that compares strings or ignores these rules can flag or miss a version the other tool gets right.

The two rules that matter

The Semantic Versioning specification says pre-release versions have lower precedence than the associated normal version. It also says build metadata must be ignored when determining version precedence, so two versions that differ only in build metadata have the same precedence.

The specification gives an example order.

1.0.0-alpha < 1.0.0-alpha.1 < 1.0.0-alpha.beta < 1.0.0-beta < 1.0.0-beta.2 < 1.0.0-beta.11 < 1.0.0-rc.1 < 1.0.0

Notice beta.2 sorts before beta.11, because numeric identifiers compare as numbers. A tool comparing plain strings would put beta.11 before beta.2. It also says numeric identifiers always have lower precedence than non numeric ones.

How this changes a scan

Take an advisory that says versions below 2.0.0 are affected, with the fix in 2.0.0.

Your versionCorrect SemVer resultWhat a naive tool might do
2.0.0-rc.1Below 2.0.0, so inside the affected rangeTreat it as at or above 2.0 and stay quiet
2.0.0+build7Same precedence as 2.0.0, so fixedTreat the suffix as a newer or older version
1.9.9AffectedAffected
2.0.0-beta.11 vs beta.2beta.2 is lowerWrong order in string comparison

So a release candidate of the fixed version is, by the rules, still before the fix. Whether that matters in practice depends on whether the fix was already in that candidate, which the maintainers' notes will say.

Not every ecosystem uses SemVer

The OSV schema separates range types. SEMVER ranges follow strict SemVer 2.0 ordering. ECOSYSTEM ranges use version strings interpreted by the ecosystem's own rules, which is why the schema recommends an explicit list of versions for them. Python, for example, has its own version ordering. If a tool applies SemVer to a non SemVer ecosystem, edge cases will go wrong.

How to check your own case

  1. Find the odd version. Look for versions with a dash suffix or a plus suffix in your lockfile.
  2. Read the advisory range type. SemVer, ecosystem or git.
  3. Order the versions by hand using the rules above.
  4. Compare with each tool's verdict. The tool that matches your hand ordering is applying the right rule for that case.
  5. Report the discrepancy to the tool's maintainers with the example, and record your decision in the meantime.

Practical advice

Avoid shipping pre-release dependencies to production where you can. If you must, pin the exact version and note it in your decision record, because scanners are most likely to disagree there. Prefer a stable release once the fix lands in one.

Treat build metadata as a label. It never makes a version newer or older for matching purposes, and a tool that acts as if it does is comparing the wrong thing.

Quick check

Is 1.0.0-rc.1 newer than 1.0.0?

No. A pre-release has lower precedence than its normal version, so 1.0.0-rc.1 comes before 1.0.0.

Does a plus suffix make a version newer?

No. Build metadata is ignored when determining precedence.

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.