Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Version rule does not differentiate between version types and other formats #15

Open
pedrohc opened this issue Dec 5, 2024 · 0 comments

Comments

@pedrohc
Copy link

pedrohc commented Dec 5, 2024

The current version rule uses one regular expression that is too broad and doesn't differentiate between some version formats.

Some examples of cases not currently contemplated by the RE:

  1. The use of "*" to convey upper limits are only attributed to the "lessThan" object according to the schema[1].
  2. pre-releases[2] and build[3] metadata should be avoided in version ranges. (This is IMO, schema doesn't mention this)
  3. "custom" versionType should be avoided. [4]
  4. No correlation between versionType and the format is made (e.g. git commits has a strict format of 40 long string with sha-1 or sha-256 chars)

My proposal is to split the input json data input into a new struct and test against multiple RE strings, depending on the version category (range or single version) and version types (semver, git, rpm, maven, python).

I'd like to send a PR if it's ok (I'm still working on it).

[1] https://github.com/CVEProject/cve-schema/blob/a29f28e5d48383cc5e179f9c6655ac49e8ffe1f9/schema/docs/versions.md?plain=1#L507
[2] https://semver.org/#spec-item-9
[3] https://semver.org/#spec-item-10
[4] https://github.com/CVEProject/cve-schema/blob/a29f28e5d48383cc5e179f9c6655ac49e8ffe1f9/schema/docs/versions.md?plain=1#L248

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

No branches or pull requests

1 participant