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

Validate supported ecosystems and identifier prefixes in the schema definition #246

Merged

Conversation

andrewpollock
Copy link
Collaborator

Fixes: #201

Fixes: ossf#201

Signed-off-by: Andrew Pollock <apollock@google.com>
Alphabetise definitions

Signed-off-by: Andrew Pollock <apollock@google.com>
@andrewpollock andrewpollock changed the title Validate supported ecosystems in the schema definition Validate supported ecosystems and identifier prefixes in the schema definition Jun 4, 2024
Because some ecosystems use the "colon" notation, we have to use a regex
for validation purposes instead, unfortunately.

Signed-off-by: Andrew Pollock <apollock@google.com>
(rightly or wrongly)

Signed-off-by: Andrew Pollock <apollock@google.com>
"type": "string",
"title": "Currently supported ecosystems",
"description": "These ecosystems are also documented at https://ossf.github.io/osv-schema/#affectedpackage-field",
"pattern": "^(AlmaLinux|Alpine|Android|Bioconductor|Bitnami|ConanCenter|CRAN|crates.io|Debian|GHC|GitHub Actions|GIT|Go|Hackage|Hex|Linux|Maven|npm|NuGet|OSS-Fuzz|Packagist|Photon OS|Pub|PyPI|Rocky Linux|RubyGems|SwiftURL|Ubuntu)(:[[:digit:]]+)?"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this regex support periods after the : bit? e.g. Debian:3.1 ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any periods as per your example fall outside of the regex as currently defined, so strings as per your example pass validation:

$ cat /tmp/osv-vulnerabilities/Debian/DTSA-99-1.json | gron | grep ecosystem
json.affected[0].package.ecosystem = "Debian:5.0";
$ ~/go/bin/jv ~/gosst/osv/osv-schema/validation/schema.json /tmp/osv-vulnerabilities/Debian/DTSA-99-1.json
$ echo $?
0

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.

Validate valid ecosystems in schema.json
2 participants