Repository navigation
Fix CPE patch-letter ordering and define prerelease stages - #185
Open
afoote-mitre wants to merge 2 commits into
Open
afoote-mitre wants to merge 2 commits into
afoote-mitre wants to merge 2 commits into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes CPE version ordering that treated bare patch letters such as
1.0.2aas prereleases and incorrectly placed1.1.1lafter1.1.1m. The API now distinguishes bare patch letters from numbered prerelease aliases, so valid ranges such as1.0.2through1.0.2aare accepted and evaluated consistently.This PR also defines distinct
dev,pre, andpreviewprerelease stages. The documented order is:pre,preview, andrcare separate stages, not equivalent aliases. This is an explicit API extension to Maven-style qualifier precedence.Changes and Primary Files
a,b, andmwere unconditionally translated toalpha,beta, andmilestone. This made bare patch letters sort before the release and broke ordering among patch versions. Tokenization now preserves character positions long enough to recognize a directly following digit:2.0a1remains a prerelease, while1.0.2asorts after1.0.2. A separator between the short letter and number does not activate the alias.utils/cpe.jsdev,pre, andpreviewpreviously sorted after the release as unknown qualifiers. They now have explicit prerelease positions, withpre < preview < rc. Numeric suffixes are compared numerically, matching remains case-insensitive, and unrelated labels such aspreviewishremain unknown qualifiers.utils/cpe.jscpeNameapplicability, andvirtualMatchStringinterval overlap. The fix therefore corrects both incorrect HTTP 400 range-order rejections and incorrect range inclusions/exclusions. Exact criteria versions continue to use literal matching.utils/cpe.js; regression coverage inutils/cpe.test.jsandroutes/search.integration.test.jsREADME.md,routes/swagger.js, generatedapi-docs/openapi.jsontest/postman/buildCollection.js, generatedtest/postman/CVE-Search-API.postman_collection.jsonDeferred Scope
Addresses the alias defect and qualifier-policy suggestions in #176.
versionType-specific evaluators remain deferred becauseversionTypebelongs toaffected[].versions[], notcpeApplicability. Supporting affected-product/version searches requires a separate feature decision; this PR does not add affected-array matching or infer a versioning scheme from another part of a record.