Skip to content

feat(linter): check that SEMVER and GIT range events use valid versions - #673

Open
cvas22 wants to merge 1 commit into
ossf:mainfrom
cvas22:linter-range-versions-valid
Open

cvas22 wants to merge 1 commit into
ossf:mainfrom
cvas22:linter-range-versions-valid

Conversation

@cvas22

@cvas22 cvas22 commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

Part of #311, the "range type is correct (SEMVER is valid, GIT is valid)" item.

RNG:003 (range-versions-valid) flags events in SEMVER ranges that aren't SemVer 2.0.0 versions without a leading "v", and events in GIT ranges that aren't full-length commit hashes (SHA-1 or SHA-256). It looks at introduced, fixed, last_affected and limit, and allows "0" for introduced and "*" for limit. ECOSYSTEM ranges are left alone since their versions are free-form.

It's in ALL and offline. I ran the same logic over the current Go, crates.io and OSS-Fuzz exports from osv.dev (about 17k records, 4k GIT ranges) and nothing got flagged, so it shouldn't be noisy.

Notes

I also removed a few stray lines from the linter README ("Save it.", "Then check", a git diff block) that look like editing notes left over from #609.

jess-lowe pushed a commit that referenced this pull request Nov 30, 2026
…ed event (#674)

Part of #311, the "version range is valid (`fixed` != `0` &&
`introduced` < `fixed`)" item @hogo6002 added.

RNG:004 (`range-events-ordered`) sorts the events of each SEMVER and
ECOSYSTEM range with `semantic`, the same way the evaluation algorithm
does, and flags a `fixed` or `last_affected` that's lower than every
`introduced` in that range. Those events can't close anything, so the
range usually matches nothing or more than intended. That covers `fixed:
"0"` too. GIT ranges and versions `semantic` can't parse are skipped,
and so is a run of several `fixed` after one `introduced`, since Alpine
lists fixes that way on purpose.

I ran it over the current PyPI, npm, Go, crates.io, Maven, RubyGems,
Packagist, NuGet, Pub, Hex, Alpine and Debian exports (about 390k
records) and it flagged 12. Most are real, like GHSA-4f84-67cv-qrv3
(introduced `1.1.5.post1`, fixed `1.1.5`) and GHSA-82jv-9wjw-pqh6
(`4.0.0-beta1` sorts after `4.0.0-beta.11`). The two openc3 RubyGems
hits come from `semantic` putting `7.0.0-rc3` below `7.0.0.pre.rc1`,
which RubyGems itself doesn't do.

It's in ALL and offline, not fatal. This touches the same lines as #673,
so whichever lands second needs a small rebase, and I used RNG:004 so
the codes don't clash.

Signed-off-by: Srinivas Chippagiri <cvas22@gmail.com>
Part of ossf#311. RNG:003 (range-versions-valid) flags SEMVER range events
that aren't SemVer 2.0.0 versions without a leading "v", and GIT range
events that aren't full-length commit hashes. "0" for introduced and "*"
for limit are allowed. ECOSYSTEM ranges aren't checked.

Also drops some leftover editing notes from the README.

Signed-off-by: Srinivas Chippagiri <cvas22@gmail.com>
@cvas22
cvas22 force-pushed the linter-range-versions-valid branch from 4a27af4 to 307b7bf Compare November 30, 2026 19:08

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant