From 6a95f103a61ad43a0a460cf119ff89144e1b2d7f Mon Sep 17 00:00:00 2001 From: Andrew Pollock Date: Fri, 14 Jun 2024 11:35:56 +1000 Subject: [PATCH] Validate supported ecosystems and identifier prefixes in the schema definition (#246) Fixes: #201 --------- Signed-off-by: Andrew Pollock --- validation/schema.json | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/validation/schema.json b/validation/schema.json index ac2d5e27..f7cbf404 100644 --- a/validation/schema.json +++ b/validation/schema.json @@ -9,7 +9,7 @@ "type": "string" }, "id": { - "type": "string" + "$ref": "#/$defs/prefix" }, "modified": { "$ref": "#/$defs/timestamp" @@ -56,7 +56,7 @@ "type": "object", "properties": { "ecosystem": { - "type": "string" + "$ref": "#/$defs/ecosystem" }, "name": { "type": "string" @@ -296,6 +296,18 @@ "modified" ], "$defs": { + "ecosystem": { + "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:]]+)?" + }, + "prefix": { + "type": "string", + "title": "Currently supported home database identifier prefixes", + "description": "These home databases are also documented at https://ossf.github.io/osv-schema/#id-modified-fields", + "pattern": "^(ASB|A|ALSA|ALBA|ALEA|BIT|CURL|CVE|DSA|DLA|DTSA|GHSA|GO|GSD|HSEC|LBSEC|MAL|OSV|PHSA|PSF|PYSEC|RLSA|RXSA|RSEC|RUSTSEC|USN)-" + }, "severity": { "type": [ "array",