You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug]: Hand-written newestVersion comparator misorders large prerelease identifiers #1119
Bespoke-code audit of main 96543b7, Node 26.10.0. Reproduced directly against packages/core/src/package-files.ts:newestVersion, used by the add-on outdated report.
Both inputs are accepted as valid by the checkout's installed semver package. Converting both numeric identifiers to Number loses the distinction; the sort treats them as equal and returns whichever is last.
Additional direct probes: newestVersion(['1.0.0-01','1.0.0-0']) chooses the invalid leading-zero prerelease, and newestVersion(['1.0.0+','1.0.0-alpha']) chooses the invalid empty-build-metadata version. Those invalid values may not come from a normal npm registry response; the large valid numeric identifier is the actionable ordering defect.
Relevant output
The checkout's semver.rsort selects 1.0.0-9007199254740993 for the first input, while the owned comparator selects the lower version. No package was installed/upgraded by the probe and no automatic downgrade is claimed.
Use semver's validated ordering (we already use semver as a development dependency; explicitly assess promoting it to runtime), or retain a narrowly correct comparator with precision-safe numeric identifier comparison and defined invalid-input behavior. Test input permutations, equal versions, build metadata and prereleases. This is a small general-purpose helper worth reconsidering on correctness evidence, not a reason for a new version abstraction.
Activity
jimhoyd commentedon Oct 1, 2026
Taking this: Issues [37f079]
Shared Markdown fence/link readers, strict newestVersion, middleware …