From 1566031f3b1381a0230fb32c4c7eddc8cab64b5a Mon Sep 17 00:00:00 2001 From: KW Kwan Date: Wed, 25 Nov 2026 09:03:44 +0800 Subject: [PATCH] feat: publish and validate CSAF 2.0 and OpenVEX feeds --- .github/workflows/build_deploy.yml | 8 +- README.md | 10 +- _data/packages.yml | 8 + index.html | 20 +- schemas/csaf-2.0-schema.json | 1414 ++++++++++++++++++++++++++++ schemas/cvss-v2.0.json | 104 ++ schemas/cvss-v3.0.json | 143 +++ schemas/cvss-v3.1.json | 143 +++ schemas/openvex-0.2.0-schema.json | 317 +++++++ scripts/generate_feeds.rb | 390 +++++++- scripts/validate_feeds.rb | 101 +- test/test_feeds.rb | 48 + 12 files changed, 2693 insertions(+), 13 deletions(-) create mode 100644 schemas/csaf-2.0-schema.json create mode 100644 schemas/cvss-v2.0.json create mode 100644 schemas/cvss-v3.0.json create mode 100644 schemas/cvss-v3.1.json create mode 100644 schemas/openvex-0.2.0-schema.json diff --git a/.github/workflows/build_deploy.yml b/.github/workflows/build_deploy.yml index bbaf709..2031fd9 100644 --- a/.github/workflows/build_deploy.yml +++ b/.github/workflows/build_deploy.yml @@ -35,10 +35,10 @@ jobs: id: pages uses: actions/configure-pages@v5 - - name: Generate OSV and GHSA feeds + - name: Generate OSV, GHSA, CSAF, and OpenVEX feeds run: bundle exec ruby scripts/generate_feeds.rb - - name: Validate OSV and GHSA feeds + - name: Validate OSV, GHSA, CSAF, and OpenVEX feeds run: bundle exec ruby scripts/validate_feeds.rb - name: Test feed generation and validation @@ -56,9 +56,13 @@ jobs: test -f _site/index.html test -f _site/feeds/osv/index.json test -f _site/feeds/ghsa/index.json + test -f _site/feeds/csaf/index.json + test -f _site/feeds/vex/index.json for pkg in rnp metanorma cla identity; do test -f "_site/feeds/osv/${pkg}.json" test -f "_site/feeds/ghsa/${pkg}.json" + test -f "_site/feeds/csaf/${pkg}.json" + test -f "_site/feeds/vex/${pkg}.json" done - name: Upload artifact diff --git a/README.md b/README.md index 0eb547f..60a48f1 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # cve.ribose.com -This repository publishes machine-readable Open Source Vulnerability (OSV) and GitHub Security Advisory (GHSA) JSON feeds for tracked Ribose packages on `https://cve.ribose.com`. +This repository publishes machine-readable Open Source Vulnerability (OSV), GitHub Security Advisory (GHSA), Common Security Advisory Framework (CSAF 2.0), and OpenVEX JSON feeds for tracked Ribose packages on `https://cve.ribose.com`. ## Sources @@ -15,6 +15,12 @@ This repository publishes machine-readable Open Source Vulnerability (OSV) and G - `/feeds/osv/.json`: Individual OSV-schema vulnerability records. - `/feeds/ghsa/index.json`: GHSA feed index. - `/feeds/ghsa/.json`: Per-package GHSA feed (`rnp`, `metanorma`, `cla`, `identity`). +- `/feeds/csaf/index.json`: CSAF 2.0 feed index keyed by package and PURL. +- `/feeds/csaf/.json`: Per-package CSAF 2.0 `csaf_vex` document (`rnp`, `metanorma`, `cla`, `identity`). +- `/feeds/csaf/.json`: Individual CSAF 2.0 `csaf_vex` documents. +- `/feeds/vex/index.json`: OpenVEX 0.2.0 feed index keyed by package and PURL. +- `/feeds/vex/.json`: Per-package OpenVEX 0.2.0 feed (`rnp`, `metanorma`, `cla`, `identity`). +- `/feeds/vex/.json`: Individual OpenVEX 0.2.0 documents. ## Build and validation @@ -24,4 +30,4 @@ make test make _site ``` -Every generated OSV record is validated against the vendored OSV JSON Schema (`schemas/osv-schema.json`) before publication. +Every generated OSV, CSAF 2.0, and OpenVEX 0.2.0 record is validated against the vendored JSON Schemas (`schemas/osv-schema.json`, `schemas/csaf-2.0-schema.json`, and `schemas/openvex-0.2.0-schema.json`) before publication. diff --git a/_data/packages.yml b/_data/packages.yml index 0a97dde..c38667c 100644 --- a/_data/packages.yml +++ b/_data/packages.yml @@ -16,6 +16,8 @@ packages: - https://github.com/rnpgp/rnp osv_feed_path: /feeds/osv/rnp.json ghsa_feed_path: /feeds/ghsa/rnp.json + csaf_feed_path: /feeds/csaf/rnp.json + vex_feed_path: /feeds/vex/rnp.json - repo: metanorma/metanorma org: metanorma @@ -32,6 +34,8 @@ packages: - https://github.com/metanorma/metanorma osv_feed_path: /feeds/osv/metanorma.json ghsa_feed_path: /feeds/ghsa/metanorma.json + csaf_feed_path: /feeds/csaf/metanorma.json + vex_feed_path: /feeds/vex/metanorma.json - repo: riboseinc/cla org: riboseinc @@ -48,6 +52,8 @@ packages: - https://github.com/riboseinc/cla osv_feed_path: /feeds/osv/cla.json ghsa_feed_path: /feeds/ghsa/cla.json + csaf_feed_path: /feeds/csaf/cla.json + vex_feed_path: /feeds/vex/cla.json - repo: ribosei/identity org: ribosei @@ -63,3 +69,5 @@ packages: - https://github.com/ribosei/identity osv_feed_path: /feeds/osv/identity.json ghsa_feed_path: /feeds/ghsa/identity.json + csaf_feed_path: /feeds/csaf/identity.json + vex_feed_path: /feeds/vex/identity.json diff --git a/index.html b/index.html index dbcaca5..30a5899 100644 --- a/index.html +++ b/index.html @@ -39,12 +39,14 @@

Ribose Vulnerability Feeds

-

This site publishes machine-readable Open Source Vulnerability (OSV) and GitHub Security Advisory (GHSA) JSON feeds for tracked Ribose software packages.

+

This site publishes machine-readable Open Source Vulnerability (OSV), GitHub Security Advisory (GHSA), Common Security Advisory Framework (CSAF 2.0), and OpenVEX JSON feeds for tracked Ribose software packages.

Index endpoints

Tier A per-package OSV feeds

@@ -62,5 +64,21 @@

Tier A per-package GHSA feeds

  • /feeds/ghsa/cla.json — riboseinc/cla
  • /feeds/ghsa/identity.json — ribosei/identity
  • + +

    Tier A per-package CSAF 2.0 feeds

    + + +

    Tier A per-package OpenVEX feeds

    + diff --git a/schemas/csaf-2.0-schema.json b/schemas/csaf-2.0-schema.json new file mode 100644 index 0000000..93ff152 --- /dev/null +++ b/schemas/csaf-2.0-schema.json @@ -0,0 +1,1414 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://docs.oasis-open.org/csaf/csaf/v2.0/csaf_json_schema.json", + "title": "Common Security Advisory Framework", + "description": "Representation of security advisory information as a JSON document.", + "type": "object", + "$defs": { + "acknowledgments_t": { + "title": "List of acknowledgments", + "description": "Contains a list of acknowledgment elements.", + "type": "array", + "minItems": 1, + "items": { + "title": "Acknowledgment", + "description": "Acknowledges contributions by describing those that contributed.", + "type": "object", + "minProperties": 1, + "properties": { + "names": { + "title": "List of acknowledged names", + "description": "Contains the names of contributors being recognized.", + "type": "array", + "minItems": 1, + "items": { + "title": "Name of the contributor", + "description": "Contains the name of a single contributor being recognized.", + "type": "string", + "minLength": 1, + "examples": [ + "Albert Einstein", + "Johann Sebastian Bach" + ] + } + }, + "organization": { + "title": "Contributing organization", + "description": "Contains the name of a contributing organization being recognized.", + "type": "string", + "minLength": 1, + "examples": [ + "CISA", + "Google Project Zero", + "Talos" + ] + }, + "summary": { + "title": "Summary of the acknowledgment", + "description": "SHOULD represent any contextual details the document producers wish to make known about the acknowledgment or acknowledged parties.", + "type": "string", + "minLength": 1, + "examples": [ + "First analysis of Coordinated Multi-Stream Attack (CMSA)" + ] + }, + "urls": { + "title": "List of URLs", + "description": "Specifies a list of URLs or location of the reference to be acknowledged.", + "type": "array", + "minItems": 1, + "items": { + "title": "URL of acknowledgment", + "description": "Contains the URL or location of the reference to be acknowledged.", + "type": "string", + "format": "uri" + } + } + } + } + }, + "branches_t": { + "title": "List of branches", + "description": "Contains branch elements as children of the current element.", + "type": "array", + "minItems": 1, + "items": { + "title": "Branch", + "description": "Is a part of the hierarchical structure of the product tree.", + "type": "object", + "maxProperties": 3, + "minProperties": 3, + "required": [ + "category", + "name" + ], + "properties": { + "branches": { + "$ref": "#/$defs/branches_t" + }, + "category": { + "title": "Category of the branch", + "description": "Describes the characteristics of the labeled branch.", + "type": "string", + "enum": [ + "architecture", + "host_name", + "language", + "legacy", + "patch_level", + "product_family", + "product_name", + "product_version", + "product_version_range", + "service_pack", + "specification", + "vendor" + ] + }, + "name": { + "title": "Name of the branch", + "description": "Contains the canonical descriptor or 'friendly name' of the branch.", + "type": "string", + "minLength": 1, + "examples": [ + "10", + "365", + "Microsoft", + "Office", + "PCS 7", + "SIMATIC", + "Siemens", + "Windows" + ] + }, + "product": { + "$ref": "#/$defs/full_product_name_t" + } + } + } + }, + "full_product_name_t": { + "title": "Full product name", + "description": "Specifies information about the product and assigns the product_id.", + "type": "object", + "required": [ + "name", + "product_id" + ], + "properties": { + "name": { + "title": "Textual description of the product", + "description": "The value should be the product’s full canonical name, including version number and other attributes, as it would be used in a human-friendly document.", + "type": "string", + "minLength": 1, + "examples": [ + "Cisco AnyConnect Secure Mobility Client 2.3.185", + "Microsoft Host Integration Server 2006 Service Pack 1" + ] + }, + "product_id": { + "$ref": "#/$defs/product_id_t" + }, + "product_identification_helper": { + "title": "Helper to identify the product", + "description": "Provides at least one method which aids in identifying the product in an asset database.", + "type": "object", + "minProperties": 1, + "properties": { + "cpe": { + "title": "Common Platform Enumeration representation", + "description": "The Common Platform Enumeration (CPE) attribute refers to a method for naming platforms external to this specification.", + "type": "string", + "pattern": "^(cpe:2\\.3:[aho\\*\\-](:(((\\?*|\\*?)([a-zA-Z0-9\\-\\._]|(\\\\[\\\\\\*\\?!\"#\\$%&'\\(\\)\\+,/:;<=>@\\[\\]\\^`\\{\\|\\}~]))+(\\?*|\\*?))|[\\*\\-])){5}(:(([a-zA-Z]{2,3}(-([a-zA-Z]{2}|[0-9]{3}))?)|[\\*\\-]))(:(((\\?*|\\*?)([a-zA-Z0-9\\-\\._]|(\\\\[\\\\\\*\\?!\"#\\$%&'\\(\\)\\+,/:;<=>@\\[\\]\\^`\\{\\|\\}~]))+(\\?*|\\*?))|[\\*\\-])){4})|([c][pP][eE]:/[AHOaho]?(:[A-Za-z0-9\\._\\-~%]*){0,6})$", + "minLength": 5 + }, + "hashes": { + "title": "List of hashes", + "description": "Contains a list of cryptographic hashes usable to identify files.", + "type": "array", + "minItems": 1, + "items": { + "title": "Cryptographic hashes", + "description": "Contains all information to identify a file based on its cryptographic hash values.", + "type": "object", + "required": [ + "file_hashes", + "filename" + ], + "properties": { + "file_hashes": { + "title": "List of file hashes", + "description": "Contains a list of cryptographic hashes for this file.", + "type": "array", + "minItems": 1, + "items": { + "title": "File hash", + "description": "Contains one hash value and algorithm of the file to be identified.", + "type": "object", + "required": [ + "algorithm", + "value" + ], + "properties": { + "algorithm": { + "title": "Algorithm of the cryptographic hash", + "description": "Contains the name of the cryptographic hash algorithm used to calculate the value.", + "type": "string", + "default": "sha256", + "minLength": 1, + "examples": [ + "blake2b512", + "sha256", + "sha3-512", + "sha384", + "sha512" + ] + }, + "value": { + "title": "Value of the cryptographic hash", + "description": "Contains the cryptographic hash value in hexadecimal representation.", + "type": "string", + "pattern": "^[0-9a-fA-F]{32,}$", + "minLength": 32, + "examples": [ + "37df33cb7464da5c7f077f4d56a32bc84987ec1d85b234537c1c1a4d4fc8d09dc29e2e762cb5203677bf849a2855a0283710f1f5fe1d6ce8d5ac85c645d0fcb3", + "4775203615d9534a8bfca96a93dc8b461a489f69124a130d786b42204f3341cc", + "9ea4c8200113d49d26505da0e02e2f49055dc078d1ad7a419b32e291c7afebbb84badfbd46dec42883bea0b2a1fa697c" + ] + } + } + } + }, + "filename": { + "title": "Filename", + "description": "Contains the name of the file which is identified by the hash values.", + "type": "string", + "minLength": 1, + "examples": [ + "WINWORD.EXE", + "msotadddin.dll", + "sudoers.so" + ] + } + } + } + }, + "model_numbers": { + "title": "List of models", + "description": "Contains a list of full or abbreviated (partial) model numbers.", + "type": "array", + "minItems": 1, + "uniqueItems": true, + "items": { + "title": "Model number", + "description": "Contains a full or abbreviated (partial) model number of the component to identify.", + "type": "string", + "minLength": 1 + } + }, + "purl": { + "title": "package URL representation", + "description": "The package URL (purl) attribute refers to a method for reliably identifying and locating software packages external to this specification.", + "type": "string", + "format": "uri", + "pattern": "^pkg:[A-Za-z\\.\\-\\+][A-Za-z0-9\\.\\-\\+]*/.+", + "minLength": 7 + }, + "sbom_urls": { + "title": "List of SBOM URLs", + "description": "Contains a list of URLs where SBOMs for this product can be retrieved.", + "type": "array", + "minItems": 1, + "items": { + "title": "SBOM URL", + "description": "Contains a URL of one SBOM for this product.", + "type": "string", + "format": "uri" + } + }, + "serial_numbers": { + "title": "List of serial numbers", + "description": "Contains a list of full or abbreviated (partial) serial numbers.", + "type": "array", + "minItems": 1, + "uniqueItems": true, + "items": { + "title": "Serial number", + "description": "Contains a full or abbreviated (partial) serial number of the component to identify.", + "type": "string", + "minLength": 1 + } + }, + "skus": { + "title": "List of stock keeping units", + "description": "Contains a list of full or abbreviated (partial) stock keeping units.", + "type": "array", + "minItems": 1, + "items": { + "title": "Stock keeping unit", + "description": "Contains a full or abbreviated (partial) stock keeping unit (SKU) which is used in the ordering process to identify the component.", + "type": "string", + "minLength": 1 + } + }, + "x_generic_uris": { + "title": "List of generic URIs", + "description": "Contains a list of identifiers which are either vendor-specific or derived from a standard not yet supported.", + "type": "array", + "minItems": 1, + "items": { + "title": "Generic URI", + "description": "Provides a generic extension point for any identifier which is either vendor-specific or derived from a standard not yet supported.", + "type": "object", + "required": [ + "namespace", + "uri" + ], + "properties": { + "namespace": { + "title": "Namespace of the generic URI", + "description": "Refers to a URL which provides the name and knowledge about the specification used or is the namespace in which these values are valid.", + "type": "string", + "format": "uri" + }, + "uri": { + "title": "URI", + "description": "Contains the identifier itself.", + "type": "string", + "format": "uri" + } + } + } + } + } + } + } + }, + "lang_t": { + "title": "Language type", + "description": "Identifies a language, corresponding to IETF BCP 47 / RFC 5646. See IETF language registry: https://www.iana.org/assignments/language-subtag-registry/language-subtag-registry", + "type": "string", + "pattern": "^(([A-Za-z]{2,3}(-[A-Za-z]{3}(-[A-Za-z]{3}){0,2})?|[A-Za-z]{4,8})(-[A-Za-z]{4})?(-([A-Za-z]{2}|[0-9]{3}))?(-([A-Za-z0-9]{5,8}|[0-9][A-Za-z0-9]{3}))*(-[A-WY-Za-wy-z0-9](-[A-Za-z0-9]{2,8})+)*(-[Xx](-[A-Za-z0-9]{1,8})+)?|[Xx](-[A-Za-z0-9]{1,8})+|[Ii]-[Dd][Ee][Ff][Aa][Uu][Ll][Tt]|[Ii]-[Mm][Ii][Nn][Gg][Oo])$", + "examples": [ + "de", + "en", + "fr", + "frc", + "jp" + ] + }, + "notes_t": { + "title": "List of notes", + "description": "Contains notes which are specific to the current context.", + "type": "array", + "minItems": 1, + "items": { + "title": "Note", + "description": "Is a place to put all manner of text blobs related to the current context.", + "type": "object", + "required": [ + "category", + "text" + ], + "properties": { + "audience": { + "title": "Audience of note", + "description": "Indicates who is intended to read it.", + "type": "string", + "minLength": 1, + "examples": [ + "all", + "executives", + "operational management and system administrators", + "safety engineers" + ] + }, + "category": { + "title": "Note category", + "description": "Contains the information of what kind of note this is.", + "type": "string", + "enum": [ + "description", + "details", + "faq", + "general", + "legal_disclaimer", + "other", + "summary" + ] + }, + "text": { + "title": "Note content", + "description": "Holds the content of the note. Content varies depending on type.", + "type": "string", + "minLength": 1 + }, + "title": { + "title": "Title of note", + "description": "Provides a concise description of what is contained in the text of the note.", + "type": "string", + "minLength": 1, + "examples": [ + "Details", + "Executive summary", + "Technical summary", + "Impact on safety systems" + ] + } + } + } + }, + "product_group_id_t": { + "title": "Reference token for product group instance", + "description": "Token required to identify a group of products so that it can be referred to from other parts in the document. There is no predefined or required format for the product_group_id as long as it uniquely identifies a group in the context of the current document.", + "type": "string", + "minLength": 1, + "examples": [ + "CSAFGID-0001", + "CSAFGID-0002", + "CSAFGID-0020" + ] + }, + "product_groups_t": { + "title": "List of product_group_ids", + "description": "Specifies a list of product_group_ids to give context to the parent item.", + "type": "array", + "minItems": 1, + "uniqueItems": true, + "items": { + "$ref": "#/$defs/product_group_id_t" + } + }, + "product_id_t": { + "title": "Reference token for product instance", + "description": "Token required to identify a full_product_name so that it can be referred to from other parts in the document. There is no predefined or required format for the product_id as long as it uniquely identifies a product in the context of the current document.", + "type": "string", + "minLength": 1, + "examples": [ + "CSAFPID-0004", + "CSAFPID-0008" + ] + }, + "products_t": { + "title": "List of product_ids", + "description": "Specifies a list of product_ids to give context to the parent item.", + "type": "array", + "minItems": 1, + "uniqueItems": true, + "items": { + "$ref": "#/$defs/product_id_t" + } + }, + "references_t": { + "title": "List of references", + "description": "Holds a list of references.", + "type": "array", + "minItems": 1, + "items": { + "title": "Reference", + "description": "Holds any reference to conferences, papers, advisories, and other resources that are related and considered related to either a surrounding part of or the entire document and to be of value to the document consumer.", + "type": "object", + "required": [ + "summary", + "url" + ], + "properties": { + "category": { + "title": "Category of reference", + "description": "Indicates whether the reference points to the same document or vulnerability in focus (depending on scope) or to an external resource.", + "type": "string", + "default": "external", + "enum": [ + "external", + "self" + ] + }, + "summary": { + "title": "Summary of the reference", + "description": "Indicates what this reference refers to.", + "type": "string", + "minLength": 1 + }, + "url": { + "title": "URL of reference", + "description": "Provides the URL for the reference.", + "type": "string", + "format": "uri" + } + } + } + }, + "version_t": { + "title": "Version", + "description": "Specifies a version string to denote clearly the evolution of the content of the document. Format must be either integer or semantic versioning.", + "type": "string", + "pattern": "^(0|[1-9][0-9]*)$|^((0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)(?:-((?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\\.(?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\\+([0-9a-zA-Z-]+(?:\\.[0-9a-zA-Z-]+)*))?)$", + "examples": [ + "1", + "4", + "0.9.0", + "1.4.3", + "2.40.0+21AF26D3" + ] + } + }, + "required": [ + "document" + ], + "properties": { + "document": { + "title": "Document level meta-data", + "description": "Captures the meta-data about this document describing a particular set of security advisories.", + "type": "object", + "required": [ + "category", + "csaf_version", + "publisher", + "title", + "tracking" + ], + "properties": { + "acknowledgments": { + "title": "Document acknowledgments", + "description": "Contains a list of acknowledgment elements associated with the whole document.", + "$ref": "#/$defs/acknowledgments_t" + }, + "aggregate_severity": { + "title": "Aggregate severity", + "description": "Is a vehicle that is provided by the document producer to convey the urgency and criticality with which the one or more vulnerabilities reported should be addressed. It is a document-level metric and applied to the document as a whole — not any specific vulnerability. The range of values in this field is defined according to the document producer's policies and procedures.", + "type": "object", + "required": [ + "text" + ], + "properties": { + "namespace": { + "title": "Namespace of aggregate severity", + "description": "Points to the namespace so referenced.", + "type": "string", + "format": "uri" + }, + "text": { + "title": "Text of aggregate severity", + "description": "Provides a severity which is independent of - and in addition to - any other standard metric for determining the impact or severity of a given vulnerability (such as CVSS).", + "type": "string", + "minLength": 1, + "examples": [ + "Critical", + "Important", + "Moderate" + ] + } + } + }, + "category": { + "title": "Document category", + "description": "Defines a short canonical name, chosen by the document producer, which will inform the end user as to the category of document.", + "type": "string", + "pattern": "^[^\\s\\-_\\.](.*[^\\s\\-_\\.])?$", + "minLength": 1, + "examples": [ + "csaf_base", + "csaf_security_advisory", + "csaf_vex", + "Example Company Security Notice" + ] + }, + "csaf_version": { + "title": "CSAF version", + "description": "Gives the version of the CSAF specification which the document was generated for.", + "type": "string", + "enum": [ + "2.0" + ] + }, + "distribution": { + "title": "Rules for sharing document", + "description": "Describe any constraints on how this document might be shared.", + "type": "object", + "minProperties": 1, + "properties": { + "text": { + "title": "Textual description", + "description": "Provides a textual description of additional constraints.", + "type": "string", + "minLength": 1, + "examples": [ + "Copyright 2021, Example Company, All Rights Reserved.", + "Distribute freely.", + "Share only on a need-to-know-basis only." + ] + }, + "tlp": { + "title": "Traffic Light Protocol (TLP)", + "description": "Provides details about the TLP classification of the document.", + "type": "object", + "required": [ + "label" + ], + "properties": { + "label": { + "title": "Label of TLP", + "description": "Provides the TLP label of the document.", + "type": "string", + "enum": [ + "AMBER", + "GREEN", + "RED", + "WHITE" + ] + }, + "url": { + "title": "URL of TLP version", + "description": "Provides a URL where to find the textual description of the TLP version which is used in this document. Default is the URL to the definition by FIRST.", + "type": "string", + "default": "https://www.first.org/tlp/", + "format": "uri", + "examples": [ + "https://www.us-cert.gov/tlp", + "https://www.bsi.bund.de/SharedDocs/Downloads/DE/BSI/Kritis/Merkblatt_TLP.pdf" + ] + } + } + } + } + }, + "lang": { + "title": "Document language", + "description": "Identifies the language used by this document, corresponding to IETF BCP 47 / RFC 5646.", + "$ref": "#/$defs/lang_t" + }, + "notes": { + "title": "Document notes", + "description": "Holds notes associated with the whole document.", + "$ref": "#/$defs/notes_t" + }, + "publisher": { + "title": "Publisher", + "description": "Provides information about the publisher of the document.", + "type": "object", + "required": [ + "category", + "name", + "namespace" + ], + "properties": { + "category": { + "title": "Category of publisher", + "description": "Provides information about the category of publisher releasing the document.", + "type": "string", + "enum": [ + "coordinator", + "discoverer", + "other", + "translator", + "user", + "vendor" + ] + }, + "contact_details": { + "title": "Contact details", + "description": "Information on how to contact the publisher, possibly including details such as web sites, email addresses, phone numbers, and postal mail addresses.", + "type": "string", + "minLength": 1, + "examples": [ + "Example Company can be reached at contact_us@example.com, or via our website at https://www.example.com/contact." + ] + }, + "issuing_authority": { + "title": "Issuing authority", + "description": "Provides information about the authority of the issuing party to release the document, in particular, the party's constituency and responsibilities or other obligations.", + "type": "string", + "minLength": 1 + }, + "name": { + "title": "Name of publisher", + "description": "Contains the name of the issuing party.", + "type": "string", + "minLength": 1, + "examples": [ + "BSI", + "Cisco PSIRT", + "Siemens ProductCERT" + ] + }, + "namespace": { + "title": "Namespace of publisher", + "description": "Contains a URL which is under control of the issuing party and can be used as a globally unique identifier for that issuing party.", + "type": "string", + "format": "uri", + "examples": [ + "https://csaf.io", + "https://www.example.com" + ] + } + } + }, + "references": { + "title": "Document references", + "description": "Holds a list of references associated with the whole document.", + "$ref": "#/$defs/references_t" + }, + "source_lang": { + "title": "Source language", + "description": "If this copy of the document is a translation then the value of this property describes from which language this document was translated.", + "$ref": "#/$defs/lang_t" + }, + "title": { + "title": "Title of this document", + "description": "This SHOULD be a canonical name for the document, and sufficiently unique to distinguish it from similar documents.", + "type": "string", + "minLength": 1, + "examples": [ + "Cisco IPv6 Crafted Packet Denial of Service Vulnerability", + "Example Company Cross-Site-Scripting Vulnerability in Example Generator" + ] + }, + "tracking": { + "title": "Tracking", + "description": "Is a container designated to hold all management attributes necessary to track a CSAF document as a whole.", + "type": "object", + "required": [ + "current_release_date", + "id", + "initial_release_date", + "revision_history", + "status", + "version" + ], + "properties": { + "aliases": { + "title": "Aliases", + "description": "Contains a list of alternate names for the same document.", + "type": "array", + "minItems": 1, + "uniqueItems": true, + "items": { + "title": "Alternate name", + "description": "Specifies a non-empty string that represents a distinct optional alternative ID used to refer to the document.", + "type": "string", + "minLength": 1, + "examples": [ + "CVE-2019-12345" + ] + } + }, + "current_release_date": { + "title": "Current release date", + "description": "The date when the current revision of this document was released", + "type": "string", + "format": "date-time" + }, + "generator": { + "title": "Document generator", + "description": "Is a container to hold all elements related to the generation of the document. These items will reference when the document was actually created, including the date it was generated and the entity that generated it.", + "type": "object", + "required": [ + "engine" + ], + "properties": { + "date": { + "title": "Date of document generation", + "description": "This SHOULD be the current date that the document was generated. Because documents are often generated internally by a document producer and exist for a nonzero amount of time before being released, this field MAY be different from the Initial Release Date and Current Release Date.", + "type": "string", + "format": "date-time" + }, + "engine": { + "title": "Engine of document generation", + "description": "Contains information about the engine that generated the CSAF document.", + "type": "object", + "required": [ + "name" + ], + "properties": { + "name": { + "title": "Engine name", + "description": "Represents the name of the engine that generated the CSAF document.", + "type": "string", + "minLength": 1, + "examples": [ + "Red Hat rhsa-to-cvrf", + "Secvisogram", + "TVCE" + ] + }, + "version": { + "title": "Engine version", + "description": "Contains the version of the engine that generated the CSAF document.", + "type": "string", + "minLength": 1, + "examples": [ + "0.6.0", + "1.0.0-beta+exp.sha.a1c44f85", + "2" + ] + } + } + } + } + }, + "id": { + "title": "Unique identifier for the document", + "description": "The ID is a simple label that provides for a wide range of numbering values, types, and schemes. Its value SHOULD be assigned and maintained by the original document issuing authority.", + "type": "string", + "pattern": "^[\\S](.*[\\S])?$", + "minLength": 1, + "examples": [ + "Example Company - 2019-YH3234", + "RHBA-2019:0024", + "cisco-sa-20190513-secureboot" + ] + }, + "initial_release_date": { + "title": "Initial release date", + "description": "The date when this document was first published.", + "type": "string", + "format": "date-time" + }, + "revision_history": { + "title": "Revision history", + "description": "Holds one revision item for each version of the CSAF document, including the initial one.", + "type": "array", + "minItems": 1, + "items": { + "title": "Revision", + "description": "Contains all the information elements required to track the evolution of a CSAF document.", + "type": "object", + "required": [ + "date", + "number", + "summary" + ], + "properties": { + "date": { + "title": "Date of the revision", + "description": "The date of the revision entry", + "type": "string", + "format": "date-time" + }, + "legacy_version": { + "title": "Legacy version of the revision", + "description": "Contains the version string used in an existing document with the same content.", + "type": "string", + "minLength": 1 + }, + "number": { + "$ref": "#/$defs/version_t" + }, + "summary": { + "title": "Summary of the revision", + "description": "Holds a single non-empty string representing a short description of the changes.", + "type": "string", + "minLength": 1, + "examples": [ + "Initial version." + ] + } + } + } + }, + "status": { + "title": "Document status", + "description": "Defines the draft status of the document.", + "type": "string", + "enum": [ + "draft", + "final", + "interim" + ] + }, + "version": { + "$ref": "#/$defs/version_t" + } + } + } + } + }, + "product_tree": { + "title": "Product tree", + "description": "Is a container for all fully qualified product names that can be referenced elsewhere in the document.", + "type": "object", + "minProperties": 1, + "properties": { + "branches": { + "$ref": "#/$defs/branches_t" + }, + "full_product_names": { + "title": "List of full product names", + "description": "Contains a list of full product names.", + "type": "array", + "minItems": 1, + "items": { + "$ref": "#/$defs/full_product_name_t" + } + }, + "product_groups": { + "title": "List of product groups", + "description": "Contains a list of product groups.", + "type": "array", + "minItems": 1, + "items": { + "title": "Product group", + "description": "Defines a new logical group of products that can then be referred to in other parts of the document to address a group of products with a single identifier.", + "type": "object", + "required": [ + "group_id", + "product_ids" + ], + "properties": { + "group_id": { + "$ref": "#/$defs/product_group_id_t" + }, + "product_ids": { + "title": "List of Product IDs", + "description": "Lists the product_ids of those products which known as one group in the document.", + "type": "array", + "minItems": 2, + "uniqueItems": true, + "items": { + "$ref": "#/$defs/product_id_t" + } + }, + "summary": { + "title": "Summary of the product group", + "description": "Gives a short, optional description of the group.", + "type": "string", + "minLength": 1, + "examples": [ + "Products supporting Modbus.", + "The x64 versions of the operating system." + ] + } + } + } + }, + "relationships": { + "title": "List of relationships", + "description": "Contains a list of relationships.", + "type": "array", + "minItems": 1, + "items": { + "title": "Relationship", + "description": "Establishes a link between two existing full_product_name_t elements, allowing the document producer to define a combination of two products that form a new full_product_name entry.", + "type": "object", + "required": [ + "category", + "full_product_name", + "product_reference", + "relates_to_product_reference" + ], + "properties": { + "category": { + "title": "Relationship category", + "description": "Defines the category of relationship for the referenced component.", + "type": "string", + "enum": [ + "default_component_of", + "external_component_of", + "installed_on", + "installed_with", + "optional_component_of" + ] + }, + "full_product_name": { + "$ref": "#/$defs/full_product_name_t" + }, + "product_reference": { + "title": "Product reference", + "description": "Holds a Product ID that refers to the Full Product Name element, which is referenced as the first element of the relationship.", + "$ref": "#/$defs/product_id_t" + }, + "relates_to_product_reference": { + "title": "Relates to product reference", + "description": "Holds a Product ID that refers to the Full Product Name element, which is referenced as the second element of the relationship.", + "$ref": "#/$defs/product_id_t" + } + } + } + } + } + }, + "vulnerabilities": { + "title": "Vulnerabilities", + "description": "Represents a list of all relevant vulnerability information items.", + "type": "array", + "minItems": 1, + "items": { + "title": "Vulnerability", + "description": "Is a container for the aggregation of all fields that are related to a single vulnerability in the document.", + "type": "object", + "minProperties": 1, + "properties": { + "acknowledgments": { + "title": "Vulnerability acknowledgments", + "description": "Contains a list of acknowledgment elements associated with this vulnerability item.", + "$ref": "#/$defs/acknowledgments_t" + }, + "cve": { + "title": "CVE", + "description": "Holds the MITRE standard Common Vulnerabilities and Exposures (CVE) tracking number for the vulnerability.", + "type": "string", + "pattern": "^CVE-[0-9]{4}-[0-9]{4,}$" + }, + "cwe": { + "title": "CWE", + "description": "Holds the MITRE standard Common Weakness Enumeration (CWE) for the weakness associated.", + "type": "object", + "required": [ + "id", + "name" + ], + "properties": { + "id": { + "title": "Weakness ID", + "description": "Holds the ID for the weakness associated.", + "type": "string", + "pattern": "^CWE-[1-9]\\d{0,5}$", + "examples": [ + "CWE-22", + "CWE-352", + "CWE-79" + ] + }, + "name": { + "title": "Weakness name", + "description": "Holds the full name of the weakness as given in the CWE specification.", + "type": "string", + "minLength": 1, + "examples": [ + "Cross-Site Request Forgery (CSRF)", + "Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')", + "Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')" + ] + } + } + }, + "discovery_date": { + "title": "Discovery date", + "description": "Holds the date and time the vulnerability was originally discovered.", + "type": "string", + "format": "date-time" + }, + "flags": { + "title": "List of flags", + "description": "Contains a list of machine readable flags.", + "type": "array", + "minItems": 1, + "uniqueItems": true, + "items": { + "title": "Flag", + "description": "Contains product specific information in regard to this vulnerability as a single machine readable flag.", + "type": "object", + "required": [ + "label" + ], + "properties": { + "date": { + "title": "Date of the flag", + "description": "Contains the date when assessment was done or the flag was assigned.", + "type": "string", + "format": "date-time" + }, + "group_ids": { + "$ref": "#/$defs/product_groups_t" + }, + "label": { + "title": "Label of the flag", + "description": "Specifies the machine readable label.", + "type": "string", + "enum": [ + "component_not_present", + "inline_mitigations_already_exist", + "vulnerable_code_cannot_be_controlled_by_adversary", + "vulnerable_code_not_in_execute_path", + "vulnerable_code_not_present" + ] + }, + "product_ids": { + "$ref": "#/$defs/products_t" + } + } + } + }, + "ids": { + "title": "List of IDs", + "description": "Represents a list of unique labels or tracking IDs for the vulnerability (if such information exists).", + "type": "array", + "minItems": 1, + "uniqueItems": true, + "items": { + "title": "ID", + "description": "Contains a single unique label or tracking ID for the vulnerability.", + "type": "object", + "required": [ + "system_name", + "text" + ], + "properties": { + "system_name": { + "title": "System name", + "description": "Indicates the name of the vulnerability tracking or numbering system.", + "type": "string", + "minLength": 1, + "examples": [ + "Cisco Bug ID", + "GitHub Issue" + ] + }, + "text": { + "title": "Text", + "description": "Is unique label or tracking ID for the vulnerability (if such information exists).", + "type": "string", + "minLength": 1, + "examples": [ + "CSCso66472", + "oasis-tcs/csaf#210" + ] + } + } + } + }, + "involvements": { + "title": "List of involvements", + "description": "Contains a list of involvements.", + "type": "array", + "minItems": 1, + "uniqueItems": true, + "items": { + "title": "Involvement", + "description": "Is a container, that allows the document producers to comment on the level of involvement (or engagement) of themselves or third parties in the vulnerability identification, scoping, and remediation process.", + "type": "object", + "required": [ + "party", + "status" + ], + "properties": { + "date": { + "title": "Date of involvement", + "description": "Holds the date and time of the involvement entry.", + "type": "string", + "format": "date-time" + }, + "party": { + "title": "Party category", + "description": "Defines the category of the involved party.", + "type": "string", + "enum": [ + "coordinator", + "discoverer", + "other", + "user", + "vendor" + ] + }, + "status": { + "title": "Party status", + "description": "Defines contact status of the involved party.", + "type": "string", + "enum": [ + "completed", + "contact_attempted", + "disputed", + "in_progress", + "not_contacted", + "open" + ] + }, + "summary": { + "title": "Summary of the involvement", + "description": "Contains additional context regarding what is going on.", + "type": "string", + "minLength": 1 + } + } + } + }, + "notes": { + "title": "Vulnerability notes", + "description": "Holds notes associated with this vulnerability item.", + "$ref": "#/$defs/notes_t" + }, + "product_status": { + "title": "Product status", + "description": "Contains different lists of product_ids which provide details on the status of the referenced product related to the current vulnerability. ", + "type": "object", + "minProperties": 1, + "properties": { + "first_affected": { + "title": "First affected", + "description": "These are the first versions of the releases known to be affected by the vulnerability.", + "$ref": "#/$defs/products_t" + }, + "first_fixed": { + "title": "First fixed", + "description": "These versions contain the first fix for the vulnerability but may not be the recommended fixed versions.", + "$ref": "#/$defs/products_t" + }, + "fixed": { + "title": "Fixed", + "description": "These versions contain a fix for the vulnerability but may not be the recommended fixed versions.", + "$ref": "#/$defs/products_t" + }, + "known_affected": { + "title": "Known affected", + "description": "These versions are known to be affected by the vulnerability.", + "$ref": "#/$defs/products_t" + }, + "known_not_affected": { + "title": "Known not affected", + "description": "These versions are known not to be affected by the vulnerability.", + "$ref": "#/$defs/products_t" + }, + "last_affected": { + "title": "Last affected", + "description": "These are the last versions in a release train known to be affected by the vulnerability. Subsequently released versions would contain a fix for the vulnerability.", + "$ref": "#/$defs/products_t" + }, + "recommended": { + "title": "Recommended", + "description": "These versions have a fix for the vulnerability and are the vendor-recommended versions for fixing the vulnerability.", + "$ref": "#/$defs/products_t" + }, + "under_investigation": { + "title": "Under investigation", + "description": "It is not known yet whether these versions are or are not affected by the vulnerability. However, it is still under investigation - the result will be provided in a later release of the document.", + "$ref": "#/$defs/products_t" + } + } + }, + "references": { + "title": "Vulnerability references", + "description": "Holds a list of references associated with this vulnerability item.", + "$ref": "#/$defs/references_t" + }, + "release_date": { + "title": "Release date", + "description": "Holds the date and time the vulnerability was originally released into the wild.", + "type": "string", + "format": "date-time" + }, + "remediations": { + "title": "List of remediations", + "description": "Contains a list of remediations.", + "type": "array", + "minItems": 1, + "items": { + "title": "Remediation", + "description": "Specifies details on how to handle (and presumably, fix) a vulnerability.", + "type": "object", + "required": [ + "category", + "details" + ], + "properties": { + "category": { + "title": "Category of the remediation", + "description": "Specifies the category which this remediation belongs to.", + "type": "string", + "enum": [ + "mitigation", + "no_fix_planned", + "none_available", + "vendor_fix", + "workaround" + ] + }, + "date": { + "title": "Date of the remediation", + "description": "Contains the date from which the remediation is available.", + "type": "string", + "format": "date-time" + }, + "details": { + "title": "Details of the remediation", + "description": "Contains a thorough human-readable discussion of the remediation.", + "type": "string", + "minLength": 1 + }, + "entitlements": { + "title": "List of entitlements", + "description": "Contains a list of entitlements.", + "type": "array", + "minItems": 1, + "items": { + "title": "Entitlement of the remediation", + "description": "Contains any possible vendor-defined constraints for obtaining fixed software or hardware that fully resolves the vulnerability.", + "type": "string", + "minLength": 1 + } + }, + "group_ids": { + "$ref": "#/$defs/product_groups_t" + }, + "product_ids": { + "$ref": "#/$defs/products_t" + }, + "restart_required": { + "title": "Restart required by remediation", + "description": "Provides information on category of restart is required by this remediation to become effective.", + "type": "object", + "required": [ + "category" + ], + "properties": { + "category": { + "title": "Category of restart", + "description": "Specifies what category of restart is required by this remediation to become effective.", + "type": "string", + "enum": [ + "connected", + "dependencies", + "machine", + "none", + "parent", + "service", + "system", + "vulnerable_component", + "zone" + ] + }, + "details": { + "title": "Additional restart information", + "description": "Provides additional information for the restart. This can include details on procedures, scope or impact.", + "type": "string", + "minLength": 1 + } + } + }, + "url": { + "title": "URL to the remediation", + "description": "Contains the URL where to obtain the remediation.", + "type": "string", + "format": "uri" + } + } + } + }, + "scores": { + "title": "List of scores", + "description": "Contains score objects for the current vulnerability.", + "type": "array", + "minItems": 1, + "items": { + "title": "Score", + "description": "Specifies information about (at least one) score of the vulnerability and for which products the given value applies.", + "type": "object", + "minProperties": 2, + "required": [ + "products" + ], + "properties": { + "cvss_v2": { + "$ref": "https://www.first.org/cvss/cvss-v2.0.json" + }, + "cvss_v3": { + "oneOf": [ + { + "$ref": "https://www.first.org/cvss/cvss-v3.0.json" + }, + { + "$ref": "https://www.first.org/cvss/cvss-v3.1.json" + } + ] + }, + "products": { + "$ref": "#/$defs/products_t" + } + } + } + }, + "threats": { + "title": "List of threats", + "description": "Contains information about a vulnerability that can change with time.", + "type": "array", + "minItems": 1, + "items": { + "title": "Threat", + "description": "Contains the vulnerability kinetic information. This information can change as the vulnerability ages and new information becomes available.", + "type": "object", + "required": [ + "category", + "details" + ], + "properties": { + "category": { + "title": "Category of the threat", + "description": "Categorizes the threat according to the rules of the specification.", + "type": "string", + "enum": [ + "exploit_status", + "impact", + "target_set" + ] + }, + "date": { + "title": "Date of the threat", + "description": "Contains the date when the assessment was done or the threat appeared.", + "type": "string", + "format": "date-time" + }, + "details": { + "title": "Details of the threat", + "description": "Represents a thorough human-readable discussion of the threat.", + "type": "string", + "minLength": 1 + }, + "group_ids": { + "$ref": "#/$defs/product_groups_t" + }, + "product_ids": { + "$ref": "#/$defs/products_t" + } + } + } + }, + "title": { + "title": "Title", + "description": "Gives the document producer the ability to apply a canonical name or title to the vulnerability.", + "type": "string", + "minLength": 1 + } + } + } + } + } +} diff --git a/schemas/cvss-v2.0.json b/schemas/cvss-v2.0.json new file mode 100644 index 0000000..efe9917 --- /dev/null +++ b/schemas/cvss-v2.0.json @@ -0,0 +1,104 @@ +{ + "license": [ + "Copyright (c) 2017, FIRST.ORG, INC.", + "All rights reserved.", + "", + "Redistribution and use in source and binary forms, with or without modification, are permitted provided that the ", + "following conditions are met:", + "1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following ", + " disclaimer.", + "2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the ", + " following disclaimer in the documentation and/or other materials provided with the distribution.", + "3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote ", + " products derived from this software without specific prior written permission.", + "", + "THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 'AS IS' AND ANY EXPRESS OR IMPLIED WARRANTIES, ", + "INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE ", + "DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, ", + "SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR ", + "SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, ", + "WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE ", + "OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." + ], + + "$schema": "http://json-schema.org/draft-04/schema#", + "title": "JSON Schema for Common Vulnerability Scoring System version 2.0", + "id": "https://www.first.org/cvss/cvss-v2.0.json?20170531", + "type": "object", + "definitions": { + "accessVectorType": { + "type": "string", + "enum": [ "NETWORK", "ADJACENT_NETWORK", "LOCAL" ] + }, + "accessComplexityType": { + "type": "string", + "enum": [ "HIGH", "MEDIUM", "LOW" ] + }, + "authenticationType": { + "type": "string", + "enum": [ "MULTIPLE", "SINGLE", "NONE" ] + }, + "ciaType": { + "type": "string", + "enum": [ "NONE", "PARTIAL", "COMPLETE" ] + }, + "exploitabilityType": { + "type": "string", + "enum": [ "UNPROVEN", "PROOF_OF_CONCEPT", "FUNCTIONAL", "HIGH", "NOT_DEFINED" ] + }, + "remediationLevelType": { + "type": "string", + "enum": [ "OFFICIAL_FIX", "TEMPORARY_FIX", "WORKAROUND", "UNAVAILABLE", "NOT_DEFINED" ] + }, + "reportConfidenceType": { + "type": "string", + "enum": [ "UNCONFIRMED", "UNCORROBORATED", "CONFIRMED", "NOT_DEFINED" ] + }, + "collateralDamagePotentialType": { + "type": "string", + "enum": [ "NONE", "LOW", "LOW_MEDIUM", "MEDIUM_HIGH", "HIGH", "NOT_DEFINED" ] + }, + "targetDistributionType": { + "type": "string", + "enum": [ "NONE", "LOW", "MEDIUM", "HIGH", "NOT_DEFINED" ] + }, + "ciaRequirementType": { + "type": "string", + "enum": [ "LOW", "MEDIUM", "HIGH", "NOT_DEFINED" ] + }, + "scoreType": { + "type": "number", + "minimum": 0, + "maximum": 10 + } + }, + "properties": { + "version": { + "description": "CVSS Version", + "type": "string", + "enum": [ "2.0" ] + }, + "vectorString": { + "type": "string", + "pattern": "^((AV:[NAL]|AC:[LMH]|Au:[MSN]|[CIA]:[NPC]|E:(U|POC|F|H|ND)|RL:(OF|TF|W|U|ND)|RC:(UC|UR|C|ND)|CDP:(N|L|LM|MH|H|ND)|TD:(N|L|M|H|ND)|[CIA]R:(L|M|H|ND))/)*(AV:[NAL]|AC:[LMH]|Au:[MSN]|[CIA]:[NPC]|E:(U|POC|F|H|ND)|RL:(OF|TF|W|U|ND)|RC:(UC|UR|C|ND)|CDP:(N|L|LM|MH|H|ND)|TD:(N|L|M|H|ND)|[CIA]R:(L|M|H|ND))$" + }, + "accessVector": { "$ref": "#/definitions/accessVectorType" }, + "accessComplexity": { "$ref": "#/definitions/accessComplexityType" }, + "authentication": { "$ref": "#/definitions/authenticationType" }, + "confidentialityImpact": { "$ref": "#/definitions/ciaType" }, + "integrityImpact": { "$ref": "#/definitions/ciaType" }, + "availabilityImpact": { "$ref": "#/definitions/ciaType" }, + "baseScore": { "$ref": "#/definitions/scoreType" }, + "exploitability": { "$ref": "#/definitions/exploitabilityType" }, + "remediationLevel": { "$ref": "#/definitions/remediationLevelType" }, + "reportConfidence": { "$ref": "#/definitions/reportConfidenceType" }, + "temporalScore": { "$ref": "#/definitions/scoreType" }, + "collateralDamagePotential": { "$ref": "#/definitions/collateralDamagePotentialType" }, + "targetDistribution": { "$ref": "#/definitions/targetDistributionType" }, + "confidentialityRequirement": { "$ref": "#/definitions/ciaRequirementType" }, + "integrityRequirement": { "$ref": "#/definitions/ciaRequirementType" }, + "availabilityRequirement": { "$ref": "#/definitions/ciaRequirementType" }, + "environmentalScore": { "$ref": "#/definitions/scoreType" } + }, + "required": [ "version", "vectorString", "baseScore" ] +} diff --git a/schemas/cvss-v3.0.json b/schemas/cvss-v3.0.json new file mode 100644 index 0000000..af09ec6 --- /dev/null +++ b/schemas/cvss-v3.0.json @@ -0,0 +1,143 @@ +{ + "license": [ + "Copyright (c) 2017, FIRST.ORG, INC.", + "All rights reserved.", + "", + "Redistribution and use in source and binary forms, with or without modification, are permitted provided that the ", + "following conditions are met:", + "1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following ", + " disclaimer.", + "2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the ", + " following disclaimer in the documentation and/or other materials provided with the distribution.", + "3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote ", + " products derived from this software without specific prior written permission.", + "", + "THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 'AS IS' AND ANY EXPRESS OR IMPLIED WARRANTIES, ", + "INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE ", + "DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, ", + "SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR ", + "SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, ", + "WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE ", + "OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." + ], + + "$schema": "http://json-schema.org/draft-04/schema#", + "title": "JSON Schema for Common Vulnerability Scoring System version 3.0", + "id": "https://www.first.org/cvss/cvss-v3.0.json?20170531", + "type": "object", + "definitions": { + "attackVectorType": { + "type": "string", + "enum": [ "NETWORK", "ADJACENT_NETWORK", "LOCAL", "PHYSICAL" ] + }, + "modifiedAttackVectorType": { + "type": "string", + "enum": [ "NETWORK", "ADJACENT_NETWORK", "LOCAL", "PHYSICAL", "NOT_DEFINED" ] + }, + "attackComplexityType": { + "type": "string", + "enum": [ "HIGH", "LOW" ] + }, + "modifiedAttackComplexityType": { + "type": "string", + "enum": [ "HIGH", "LOW", "NOT_DEFINED" ] + }, + "privilegesRequiredType": { + "type": "string", + "enum": [ "HIGH", "LOW", "NONE" ] + }, + "modifiedPrivilegesRequiredType": { + "type": "string", + "enum": [ "HIGH", "LOW", "NONE", "NOT_DEFINED" ] + }, + "userInteractionType": { + "type": "string", + "enum": [ "NONE", "REQUIRED" ] + }, + "modifiedUserInteractionType": { + "type": "string", + "enum": [ "NONE", "REQUIRED", "NOT_DEFINED" ] + }, + "scopeType": { + "type": "string", + "enum": [ "UNCHANGED", "CHANGED" ] + }, + "modifiedScopeType": { + "type": "string", + "enum": [ "UNCHANGED", "CHANGED", "NOT_DEFINED" ] + }, + "ciaType": { + "type": "string", + "enum": [ "NONE", "LOW", "HIGH" ] + }, + "modifiedCiaType": { + "type": "string", + "enum": [ "NONE", "LOW", "HIGH", "NOT_DEFINED" ] + }, + "exploitCodeMaturityType": { + "type": "string", + "enum": [ "UNPROVEN", "PROOF_OF_CONCEPT", "FUNCTIONAL", "HIGH", "NOT_DEFINED" ] + }, + "remediationLevelType": { + "type": "string", + "enum": [ "OFFICIAL_FIX", "TEMPORARY_FIX", "WORKAROUND", "UNAVAILABLE", "NOT_DEFINED" ] + }, + "confidenceType": { + "type": "string", + "enum": [ "UNKNOWN", "REASONABLE", "CONFIRMED", "NOT_DEFINED" ] + }, + "ciaRequirementType": { + "type": "string", + "enum": [ "LOW", "MEDIUM", "HIGH", "NOT_DEFINED" ] + }, + "scoreType": { + "type": "number", + "minimum": 0, + "maximum": 10 + }, + "severityType": { + "type": "string", + "enum": [ "NONE", "LOW", "MEDIUM", "HIGH", "CRITICAL" ] + } + }, + "properties": { + "version": { + "description": "CVSS Version", + "type": "string", + "enum": [ "3.0" ] + }, + "vectorString": { + "type": "string", + "pattern": "^CVSS:3[.]0/((AV:[NALP]|AC:[LH]|PR:[NLH]|UI:[NR]|S:[UC]|[CIA]:[NLH]|E:[XUPFH]|RL:[XOTWU]|RC:[XURC]|[CIA]R:[XLMH]|MAV:[XNALP]|MAC:[XLH]|MPR:[XNLH]|MUI:[XNR]|MS:[XUC]|M[CIA]:[XNLH])/)*(AV:[NALP]|AC:[LH]|PR:[NLH]|UI:[NR]|S:[UC]|[CIA]:[NLH]|E:[XUPFH]|RL:[XOTWU]|RC:[XURC]|[CIA]R:[XLMH]|MAV:[XNALP]|MAC:[XLH]|MPR:[XNLH]|MUI:[XNR]|MS:[XUC]|M[CIA]:[XNLH])$" + }, + "attackVector": { "$ref": "#/definitions/attackVectorType" }, + "attackComplexity": { "$ref": "#/definitions/attackComplexityType" }, + "privilegesRequired": { "$ref": "#/definitions/privilegesRequiredType" }, + "userInteraction": { "$ref": "#/definitions/userInteractionType" }, + "scope": { "$ref": "#/definitions/scopeType" }, + "confidentialityImpact": { "$ref": "#/definitions/ciaType" }, + "integrityImpact": { "$ref": "#/definitions/ciaType" }, + "availabilityImpact": { "$ref": "#/definitions/ciaType" }, + "baseScore": { "$ref": "#/definitions/scoreType" }, + "baseSeverity": { "$ref": "#/definitions/severityType" }, + "exploitCodeMaturity": { "$ref": "#/definitions/exploitCodeMaturityType" }, + "remediationLevel": { "$ref": "#/definitions/remediationLevelType" }, + "reportConfidence": { "$ref": "#/definitions/confidenceType" }, + "temporalScore": { "$ref": "#/definitions/scoreType" }, + "temporalSeverity": { "$ref": "#/definitions/severityType" }, + "confidentialityRequirement": { "$ref": "#/definitions/ciaRequirementType" }, + "integrityRequirement": { "$ref": "#/definitions/ciaRequirementType" }, + "availabilityRequirement": { "$ref": "#/definitions/ciaRequirementType" }, + "modifiedAttackVector": { "$ref": "#/definitions/modifiedAttackVectorType" }, + "modifiedAttackComplexity": { "$ref": "#/definitions/modifiedAttackComplexityType" }, + "modifiedPrivilegesRequired": { "$ref": "#/definitions/modifiedPrivilegesRequiredType" }, + "modifiedUserInteraction": { "$ref": "#/definitions/modifiedUserInteractionType" }, + "modifiedScope": { "$ref": "#/definitions/modifiedScopeType" }, + "modifiedConfidentialityImpact": { "$ref": "#/definitions/modifiedCiaType" }, + "modifiedIntegrityImpact": { "$ref": "#/definitions/modifiedCiaType" }, + "modifiedAvailabilityImpact": { "$ref": "#/definitions/modifiedCiaType" }, + "environmentalScore": { "$ref": "#/definitions/scoreType" }, + "environmentalSeverity": { "$ref": "#/definitions/severityType" } + }, + "required": [ "version", "vectorString", "baseScore", "baseSeverity" ] +} diff --git a/schemas/cvss-v3.1.json b/schemas/cvss-v3.1.json new file mode 100644 index 0000000..0c2b2dd --- /dev/null +++ b/schemas/cvss-v3.1.json @@ -0,0 +1,143 @@ +{ + "license": [ + "Copyright (c) 2021, FIRST.ORG, INC.", + "All rights reserved.", + "", + "Redistribution and use in source and binary forms, with or without modification, are permitted provided that the ", + "following conditions are met:", + "1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following ", + " disclaimer.", + "2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the ", + " following disclaimer in the documentation and/or other materials provided with the distribution.", + "3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote ", + " products derived from this software without specific prior written permission.", + "", + "THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 'AS IS' AND ANY EXPRESS OR IMPLIED WARRANTIES, ", + "INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE ", + "DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, ", + "SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR ", + "SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, ", + "WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE ", + "OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." + ], + + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "JSON Schema for Common Vulnerability Scoring System version 3.1", + "$id": "https://www.first.org/cvss/cvss-v3.1.json?20211103", + "type": "object", + "definitions": { + "attackVectorType": { + "type": "string", + "enum": [ "NETWORK", "ADJACENT_NETWORK", "LOCAL", "PHYSICAL" ] + }, + "modifiedAttackVectorType": { + "type": "string", + "enum": [ "NETWORK", "ADJACENT_NETWORK", "LOCAL", "PHYSICAL", "NOT_DEFINED" ] + }, + "attackComplexityType": { + "type": "string", + "enum": [ "HIGH", "LOW" ] + }, + "modifiedAttackComplexityType": { + "type": "string", + "enum": [ "HIGH", "LOW", "NOT_DEFINED" ] + }, + "privilegesRequiredType": { + "type": "string", + "enum": [ "HIGH", "LOW", "NONE" ] + }, + "modifiedPrivilegesRequiredType": { + "type": "string", + "enum": [ "HIGH", "LOW", "NONE", "NOT_DEFINED" ] + }, + "userInteractionType": { + "type": "string", + "enum": [ "NONE", "REQUIRED" ] + }, + "modifiedUserInteractionType": { + "type": "string", + "enum": [ "NONE", "REQUIRED", "NOT_DEFINED" ] + }, + "scopeType": { + "type": "string", + "enum": [ "UNCHANGED", "CHANGED" ] + }, + "modifiedScopeType": { + "type": "string", + "enum": [ "UNCHANGED", "CHANGED", "NOT_DEFINED" ] + }, + "ciaType": { + "type": "string", + "enum": [ "NONE", "LOW", "HIGH" ] + }, + "modifiedCiaType": { + "type": "string", + "enum": [ "NONE", "LOW", "HIGH", "NOT_DEFINED" ] + }, + "exploitCodeMaturityType": { + "type": "string", + "enum": [ "UNPROVEN", "PROOF_OF_CONCEPT", "FUNCTIONAL", "HIGH", "NOT_DEFINED" ] + }, + "remediationLevelType": { + "type": "string", + "enum": [ "OFFICIAL_FIX", "TEMPORARY_FIX", "WORKAROUND", "UNAVAILABLE", "NOT_DEFINED" ] + }, + "confidenceType": { + "type": "string", + "enum": [ "UNKNOWN", "REASONABLE", "CONFIRMED", "NOT_DEFINED" ] + }, + "ciaRequirementType": { + "type": "string", + "enum": [ "LOW", "MEDIUM", "HIGH", "NOT_DEFINED" ] + }, + "scoreType": { + "type": "number", + "minimum": 0, + "maximum": 10 + }, + "severityType": { + "type": "string", + "enum": [ "NONE", "LOW", "MEDIUM", "HIGH", "CRITICAL" ] + } + }, + "properties": { + "version": { + "description": "CVSS Version", + "type": "string", + "enum": [ "3.1" ] + }, + "vectorString": { + "type": "string", + "pattern": "^CVSS:3[.]1/((AV:[NALP]|AC:[LH]|PR:[NLH]|UI:[NR]|S:[UC]|[CIA]:[NLH]|E:[XUPFH]|RL:[XOTWU]|RC:[XURC]|[CIA]R:[XLMH]|MAV:[XNALP]|MAC:[XLH]|MPR:[XNLH]|MUI:[XNR]|MS:[XUC]|M[CIA]:[XNLH])/)*(AV:[NALP]|AC:[LH]|PR:[NLH]|UI:[NR]|S:[UC]|[CIA]:[NLH]|E:[XUPFH]|RL:[XOTWU]|RC:[XURC]|[CIA]R:[XLMH]|MAV:[XNALP]|MAC:[XLH]|MPR:[XNLH]|MUI:[XNR]|MS:[XUC]|M[CIA]:[XNLH])$" + }, + "attackVector": { "$ref": "#/definitions/attackVectorType" }, + "attackComplexity": { "$ref": "#/definitions/attackComplexityType" }, + "privilegesRequired": { "$ref": "#/definitions/privilegesRequiredType" }, + "userInteraction": { "$ref": "#/definitions/userInteractionType" }, + "scope": { "$ref": "#/definitions/scopeType" }, + "confidentialityImpact": { "$ref": "#/definitions/ciaType" }, + "integrityImpact": { "$ref": "#/definitions/ciaType" }, + "availabilityImpact": { "$ref": "#/definitions/ciaType" }, + "baseScore": { "$ref": "#/definitions/scoreType" }, + "baseSeverity": { "$ref": "#/definitions/severityType" }, + "exploitCodeMaturity": { "$ref": "#/definitions/exploitCodeMaturityType" }, + "remediationLevel": { "$ref": "#/definitions/remediationLevelType" }, + "reportConfidence": { "$ref": "#/definitions/confidenceType" }, + "temporalScore": { "$ref": "#/definitions/scoreType" }, + "temporalSeverity": { "$ref": "#/definitions/severityType" }, + "confidentialityRequirement": { "$ref": "#/definitions/ciaRequirementType" }, + "integrityRequirement": { "$ref": "#/definitions/ciaRequirementType" }, + "availabilityRequirement": { "$ref": "#/definitions/ciaRequirementType" }, + "modifiedAttackVector": { "$ref": "#/definitions/modifiedAttackVectorType" }, + "modifiedAttackComplexity": { "$ref": "#/definitions/modifiedAttackComplexityType" }, + "modifiedPrivilegesRequired": { "$ref": "#/definitions/modifiedPrivilegesRequiredType" }, + "modifiedUserInteraction": { "$ref": "#/definitions/modifiedUserInteractionType" }, + "modifiedScope": { "$ref": "#/definitions/modifiedScopeType" }, + "modifiedConfidentialityImpact": { "$ref": "#/definitions/modifiedCiaType" }, + "modifiedIntegrityImpact": { "$ref": "#/definitions/modifiedCiaType" }, + "modifiedAvailabilityImpact": { "$ref": "#/definitions/modifiedCiaType" }, + "environmentalScore": { "$ref": "#/definitions/scoreType" }, + "environmentalSeverity": { "$ref": "#/definitions/severityType" } + }, + "required": [ "version", "vectorString", "baseScore", "baseSeverity" ] +} diff --git a/schemas/openvex-0.2.0-schema.json b/schemas/openvex-0.2.0-schema.json new file mode 100644 index 0000000..2a6aecb --- /dev/null +++ b/schemas/openvex-0.2.0-schema.json @@ -0,0 +1,317 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://github.com/openvex/spec/openvex_json_schema_0.2.0.json", + "title": "OpenVEX", + "description": "OpenVEX is an implementation of the Vulnerability Exploitability Exchange (VEX for short) that is designed to be minimal, compliant, interoperable, and embeddable.", + "type": "object", + "$defs": { + "vulnerability": { + "type": "object", + "properties": { + "@id": { + "type": "string", + "format": "iri", + "description": "An Internationalized Resource Identifier (IRI) identifying the struct." + }, + "name": { + "type": "string", + "description": "A string with the main identifier used to name the vulnerability." + }, + "description": { + "type": "string", + "description": "Optional free form text describing the vulnerability." + }, + "aliases": { + "type": "array", + "uniqueItems": true, + "items": { + "type": "string" + }, + "description": "A list of strings enumerating other names under which the vulnerability may be known." + } + }, + "required": [ + "name" + ], + "additionalProperties": false + }, + "identifiers": { + "type": "object", + "properties": { + "purl": { + "type": "string", + "description": "Package URL" + }, + "cpe22": { + "type": "string", + "description": "Common Platform Enumeration v2.2" + }, + "cpe23": { + "type": "string", + "description": "Common Platform Enumeration v2.3" + } + }, + "additionalProperties": false, + "anyOf": [ + { "required": ["purl"] }, + { "required": ["cpe22"] }, + { "required": ["cpe23"] } + ] + }, + "hashes": { + "type": "object", + "properties": { + "md5": { + "type": "string" + }, + "sha1": { + "type": "string" + }, + "sha-256": { + "type": "string" + }, + "sha-384": { + "type": "string" + }, + "sha-512": { + "type": "string" + }, + "sha3-224": { + "type": "string" + }, + "sha3-256": { + "type": "string" + }, + "sha3-384": { + "type": "string" + }, + "sha3-512": { + "type": "string" + }, + "blake2s-256": { + "type": "string" + }, + "blake2b-256": { + "type": "string" + }, + "blake2b-512": { + "type": "string" + } + }, + "additionalProperties": false + }, + "subcomponent": { + "type": "object", + "properties": { + "@id": { + "type": "string", + "format": "iri", + "description": "Optional IRI identifying the component to make it externally referenceable." + }, + "identifiers": { + "$ref": "#/$defs/identifiers", + "description": "Optional IRI identifying the component to make it externally referenceable." + }, + "hashes": { + "$ref": "#/$defs/hashes", + "description": "Map of cryptographic hashes of the component." + } + }, + "additionalProperties": false, + "anyOf": [ + { "required": ["@id"] }, + { "required": ["identifiers"] } + ] + }, + "component": { + "type": "object", + "properties": { + "@id": { + "type": "string", + "format": "iri", + "description": "Optional IRI identifying the component to make it externally referenceable." + }, + "identifiers": { + "$ref": "#/$defs/identifiers", + "description": "A map of software identifiers where the key is the type and the value the identifier." + }, + "hashes": { + "$ref": "#/$defs/hashes", + "description": "Map of cryptographic hashes of the component." + }, + "subcomponents": { + "type": "array", + "uniqueItems": true, + "description": "List of subcomponent structs describing the subcomponents subject of the VEX statement.", + "items": { + "$ref": "#/$defs/subcomponent" + } + } + }, + "additionalProperties": false, + "anyOf": [ + { "required": ["@id"] }, + { "required": ["identifiers"] } + ] + } + }, + "properties": { + "@context": { + "type": "string", + "format": "uri", + "description": "The URL linking to the OpenVEX context definition." + }, + "@id": { + "type": "string", + "format": "iri", + "description": "The IRI identifying the VEX document." + }, + "author": { + "type": "string", + "description": "Author is the identifier for the author of the VEX statement." + }, + "role": { + "type": "string", + "description": "Role describes the role of the document author." + }, + "timestamp": { + "type": "string", + "format": "date-time", + "description": "Timestamp defines the time at which the document was issued." + }, + "last_updated": { + "type": "string", + "format": "date-time", + "description": "Date of last modification to the document." + }, + "version": { + "type": "integer", + "minimum": 1, + "description": "Version is the document version." + }, + "tooling": { + "type": "string", + "description": "Tooling expresses how the VEX document and contained VEX statements were generated." + }, + "statements": { + "type": "array", + "uniqueItems": true, + "minItems": 1, + "description": "A statement is an assertion made by the document's author about the impact a vulnerability has on one or more software 'products'.", + "items": { + "type": "object", + "properties": { + "@id": { + "type": "string", + "format": "iri", + "description": "Optional IRI identifying the statement to make it externally referenceable." + }, + "version": { + "type": "integer", + "minimum": 1, + "description": "Optional integer representing the statement's version number." + }, + "vulnerability": { + "$ref": "#/$defs/vulnerability", + "description": "A struct identifying the vulnerability." + }, + "timestamp": { + "type": "string", + "format": "date-time", + "description": "Timestamp is the time at which the information expressed in the statement was known to be true." + }, + "last_updated": { + "type": "string", + "format": "date-time", + "description": "Timestamp when the statement was last updated." + }, + "products": { + "type": "array", + "uniqueItems": true, + "description": "List of product structs that the statement applies to.", + "items": { + "$ref": "#/$defs/component" + } + }, + "status": { + "type": "string", + "enum": [ + "not_affected", + "affected", + "fixed", + "under_investigation" + ], + "description": "A VEX statement MUST provide the status of the vulnerabilities with respect to the products and components listed in the statement." + }, + "supplier": { + "type": "string", + "description": "Supplier of the product or subcomponent." + }, + "status_notes": { + "type": "string", + "description": "A statement MAY convey information about how status was determined and MAY reference other VEX information." + }, + "justification": { + "type": "string", + "enum": [ + "component_not_present", + "vulnerable_code_not_present", + "vulnerable_code_not_in_execute_path", + "vulnerable_code_cannot_be_controlled_by_adversary", + "inline_mitigations_already_exist" + ], + "description": "For statements conveying a not_affected status, a VEX statement MUST include either a status justification or an impact_statement informing why the product is not affected by the vulnerability." + }, + "impact_statement": { + "type": "string", + "description": "For statements conveying a not_affected status, a VEX statement MUST include either a status justification or an impact_statement informing why the product is not affected by the vulnerability." + }, + "action_statement": { + "type": "string", + "description": "For a statement with affected status, a VEX statement MUST include a statement that SHOULD describe actions to remediate or mitigate the vulnerability." + }, + "action_statement_timestamp": { + "type": "string", + "format": "date-time", + "description": "The timestamp when the action statement was issued." + } + }, + "required": [ + "vulnerability", + "status" + ], + "additionalProperties": false, + "allOf": [ + { + "if": { + "properties": { "status": { "const": "not_affected" }} + }, + "then": { + "anyOf": [ + { "required": ["justification"]}, + { "required": ["impact_statement"]} + ] + } + }, + { + "if": { + "properties": { "status": { "const": "affected" }} + }, + "then": { + "required": ["action_statement"] + } + } + ] + } + } + }, + "required": [ + "@context", + "@id", + "author", + "timestamp", + "version", + "statements" + ], + "additionalProperties": false +} diff --git a/scripts/generate_feeds.rb b/scripts/generate_feeds.rb index 6f03722..8162013 100644 --- a/scripts/generate_feeds.rb +++ b/scripts/generate_feeds.rb @@ -278,6 +278,256 @@ def build_osv_record(cve_path, packages, advisories_by_cve) [record, matched_packages.uniq { |p| p["name"] }] end +def extract_cvss_v3_for_csaf(cna) + Array(cna["metrics"]).each do |metric| + v3 = metric["cvssV3_1"] || metric["cvssV3_0"] + next unless v3 && v3["vectorString"] && v3["baseScore"] && v3["baseSeverity"] && v3["version"] + + return { + "version" => v3["version"].to_s, + "vectorString" => v3["vectorString"].to_s, + "baseScore" => v3["baseScore"].to_f, + "baseSeverity" => v3["baseSeverity"].to_s.upcase + } + end + nil +end + +def extract_first_cwe_for_csaf(cna) + Array(cna["problemTypes"]).each do |pt| + Array(pt["descriptions"]).each do |desc| + cwe_id = desc["cweId"]&.to_s&.strip + next unless cwe_id && /\ACWE-[1-9]\d{0,5}\z/.match?(cwe_id) + + cwe_name = desc["description"]&.to_s&.strip + cwe_name = cwe_id if cwe_name.nil? || cwe_name.empty? + return { "id" => cwe_id, "name" => cwe_name } + end + end + nil +end + +def build_csaf_product_tree(matched_pkgs) + vendor_branches = matched_pkgs.group_by { |p| p["org"].to_s }.map do |org, pkgs| + product_branches = pkgs.map do |pkg| + { + "category" => "product_name", + "name" => pkg["package_name"], + "product" => { + "name" => pkg["package_name"], + "product_id" => pkg["name"], + "product_identification_helper" => { + "purl" => pkg["purl"] + } + } + } + end + { + "category" => "vendor", + "name" => org, + "branches" => product_branches + } + end + + { "branches" => vendor_branches } +end + +def build_csaf_vulnerability(cve_path, packages, advisories_by_cve) + raw = JSON.parse(File.read(cve_path, encoding: "UTF-8")) + cve_meta = raw["cveMetadata"] || {} + cve_id = cve_meta["cveId"] || File.basename(cve_path, ".json") + cna = raw.dig("containers", "cna") || {} + linked_advisories = advisories_by_cve[cve_id] || [] + + published = normalize_timestamp(cna["datePublic"]) || + normalize_timestamp(cve_meta["datePublished"]) || + "1970-01-01T00:00:00Z" + modified = normalize_timestamp(cve_meta["dateUpdated"]) || published + + description = cna.dig("descriptions", 0, "value").to_s.strip + summary = cna["title"]&.to_s&.strip + summary = description.lines.first.to_s.strip if summary.nil? || summary.empty? + + matched_packages = [] + affected_product_ids = [] + fixed_versions = [] + + Array(cna["affected"]).each do |aff| + pkg = match_package(aff, packages) + next unless pkg + + matched_packages << pkg + affected_product_ids << pkg["name"] + + Array(aff["versions"]).each do |ver| + next unless ver["status"].to_s == "affected" + + if ver["lessThan"] && !ver["lessThan"].to_s.strip.empty? + fixed_versions << ver["lessThan"].to_s.strip + end + end + end + + matched_packages.uniq! { |p| p["name"] } + affected_product_ids.uniq! + + references = [] + seen_urls = {} + Array(cna["references"]).each do |ref| + url = ref["url"].to_s.strip + next if url.empty? || seen_urls[url] + + seen_urls[url] = true + ref_name = ref["name"].to_s.strip + references << { + "category" => map_reference_type(ref) == "ADVISORY" ? "external" : "self", + "summary" => ref_name.empty? ? url : ref_name, + "url" => url + } + end + linked_advisories.each do |adv| + next if seen_urls[adv[:url]] + + seen_urls[adv[:url]] = true + references << { + "category" => "self", + "summary" => adv[:title] && !adv[:title].empty? ? adv[:title] : adv[:id], + "url" => adv[:url] + } + end + + vuln = { + "cve" => cve_id, + "title" => summary, + "release_date" => published, + "notes" => [ + { + "category" => "description", + "text" => description.empty? ? summary : description + } + ] + } + + cwe = extract_first_cwe_for_csaf(cna) + vuln["cwe"] = cwe if cwe + + unless affected_product_ids.empty? + vuln["product_status"] = { + "known_affected" => affected_product_ids + } + end + + cvss_v3 = extract_cvss_v3_for_csaf(cna) + if cvss_v3 && !affected_product_ids.empty? + vuln["scores"] = [ + { + "cvss_v3" => cvss_v3, + "products" => affected_product_ids + } + ] + end + + unless fixed_versions.empty? || affected_product_ids.empty? + vuln["remediations"] = [ + { + "category" => "vendor_fix", + "details" => "Upgrade to #{fixed_versions.uniq.join(', ')} or later.", + "product_ids" => affected_product_ids + } + ] + end + + vuln["references"] = references unless references.empty? + + { + cve_id: cve_id, + published: published, + modified: modified, + summary: summary, + description: description, + matched_packages: matched_packages, + vulnerability: vuln, + fixed_versions: fixed_versions.uniq + } +end + +def build_csaf_document(id:, title:, initial_date:, current_date:, matched_packages:, vulnerabilities:) + doc = { + "document" => { + "category" => "csaf_vex", + "csaf_version" => "2.0", + "publisher" => { + "category" => "vendor", + "name" => "Ribose", + "namespace" => BASE_URL + }, + "title" => title, + "tracking" => { + "current_release_date" => current_date, + "id" => id, + "initial_release_date" => initial_date, + "revision_history" => [ + { + "date" => current_date, + "number" => "1.0.0", + "summary" => "Initial publication" + } + ], + "status" => "final", + "version" => "1.0.0" + } + } + } + + doc["product_tree"] = build_csaf_product_tree(matched_packages) unless matched_packages.empty? + doc["vulnerabilities"] = vulnerabilities unless vulnerabilities.empty? + doc +end + +def build_vex_document(cve_info) + cve_id = cve_info[:cve_id] + products = cve_info[:matched_packages].map do |pkg| + { + "@id" => pkg["purl"], + "identifiers" => { + "purl" => pkg["purl"] + } + } + end + + action_statement = if cve_info[:fixed_versions].empty? + "Upgrade to a patched release." + else + "Upgrade to #{cve_info[:fixed_versions].join(', ')} or later." + end + + statement = { + "vulnerability" => { + "@id" => "https://nvd.nist.gov/vuln/detail/#{cve_id}", + "name" => cve_id, + "description" => cve_info[:summary] + }, + "timestamp" => cve_info[:modified], + "products" => products, + "status" => "affected", + "action_statement" => action_statement + } + + unless cve_info[:fixed_versions].empty? + statement["status_notes"] = "Fixed in #{cve_info[:fixed_versions].join(', ')}." + end + + { + "@context" => "https://openvex.dev/ns/v0.2.0", + "@id" => "#{BASE_URL}/feeds/vex/#{cve_id}.json", + "author" => "Ribose", + "role" => "CNA", + "timestamp" => cve_info[:modified], + "version" => 1, + "statements" => [statement] + } +end + def fetch_upstream_ghsa(repo) return [] unless ENV["FETCH_UPSTREAM"] == "1" @@ -318,38 +568,70 @@ def main advisories_by_cve = parse_advisories osv_by_package = Hash.new { |h, k| h[k] = [] } + csaf_by_package = Hash.new { |h, k| h[k] = [] } all_records = [] + all_cve_infos = [] Dir.glob(File.join(CVES_DIR, "*.json")).sort.each do |cve_path| record, matched_pkgs = build_osv_record(cve_path, packages, advisories_by_cve) all_records << record + cve_info = build_csaf_vulnerability(cve_path, packages, advisories_by_cve) + all_cve_infos << cve_info + matched_pkgs.each do |pkg| osv_by_package[pkg["name"]] << record + csaf_by_package[pkg["name"]] << cve_info end end # Sort records deterministically by ID descending (newest CVEs first) all_records.sort_by! { |r| r["id"] }.reverse! + all_cve_infos.sort_by! { |c| c[:cve_id] }.reverse! osv_dir = File.join(OUT_DIR, "osv") ghsa_dir = File.join(OUT_DIR, "ghsa") + csaf_dir = File.join(OUT_DIR, "csaf") + vex_dir = File.join(OUT_DIR, "vex") FileUtils.rm_rf(OUT_DIR) FileUtils.mkdir_p(osv_dir) FileUtils.mkdir_p(ghsa_dir) + FileUtils.mkdir_p(csaf_dir) + FileUtils.mkdir_p(vex_dir) - # 1. Individual OSV records: /feeds/osv/.json + # 1. Individual OSV, CSAF, and OpenVEX records: /feeds/{osv,csaf,vex}/.json all_records.each do |record| write_json(File.join(osv_dir, "#{record['id']}.json"), record) end - # 2. Per-package OSV and GHSA feeds + all_cve_infos.each do |cve_info| + cve_id = cve_info[:cve_id] + csaf_doc = build_csaf_document( + id: "RIBOSE-CSAF-#{cve_id}", + title: "#{cve_id}: #{cve_info[:summary]}", + initial_date: cve_info[:published], + current_date: cve_info[:modified], + matched_packages: cve_info[:matched_packages], + vulnerabilities: [cve_info[:vulnerability]] + ) + write_json(File.join(csaf_dir, "#{cve_id}.json"), csaf_doc) + + vex_doc = build_vex_document(cve_info) + write_json(File.join(vex_dir, "#{cve_id}.json"), vex_doc) + end + + # 2. Per-package OSV, GHSA, CSAF, and OpenVEX feeds index_packages = [] by_purl = {} ghsa_index_packages = [] + csaf_index_packages = [] + csaf_by_purl = {} + vex_index_packages = [] + vex_by_purl = {} packages.each do |pkg| pkg_vulns = osv_by_package[pkg["name"]].sort_by { |r| r["id"] }.reverse + pkg_cve_infos = csaf_by_package[pkg["name"]].sort_by { |c| c[:cve_id] }.reverse pkg_meta = { "repo" => pkg["repo"], "name" => pkg["name"], @@ -368,6 +650,10 @@ def main osv_url = "#{BASE_URL}#{pkg['osv_feed_path']}" ghsa_url = "#{BASE_URL}#{pkg['ghsa_feed_path']}" + csaf_path = pkg["csaf_feed_path"] || "/feeds/csaf/#{pkg['name']}.json" + vex_path = pkg["vex_feed_path"] || "/feeds/vex/#{pkg['name']}.json" + csaf_url = "#{BASE_URL}#{csaf_path}" + vex_url = "#{BASE_URL}#{vex_path}" vuln_ids = pkg_vulns.map { |v| v["id"] } index_packages << { @@ -379,6 +665,8 @@ def main "purl" => pkg["purl"], "osv_feed_url" => osv_url, "ghsa_feed_url" => ghsa_url, + "csaf_feed_url" => csaf_url, + "vex_feed_url" => vex_url, "vulnerability_count" => pkg_vulns.length, "vulnerability_ids" => vuln_ids } @@ -388,6 +676,8 @@ def main "name" => pkg["name"], "osv_feed_url" => osv_url, "ghsa_feed_url" => ghsa_url, + "csaf_feed_url" => csaf_url, + "vex_feed_url" => vex_url, "vulnerability_ids" => vuln_ids } @@ -406,6 +696,62 @@ def main "ghsa_feed_url" => ghsa_url, "advisory_count" => ghsa_advisories.length } + + # Per-package CSAF 2.0 document + initial_date = pkg_cve_infos.map { |c| c[:published] }.min || "1970-01-01T00:00:00Z" + current_date = pkg_cve_infos.map { |c| c[:modified] }.max || initial_date + csaf_pkg_doc = build_csaf_document( + id: "RIBOSE-CSAF-#{pkg['name'].upcase}", + title: "Ribose CSAF VEX Feed for #{pkg['repo']}", + initial_date: initial_date, + current_date: current_date, + matched_packages: [pkg], + vulnerabilities: pkg_cve_infos.map { |c| c[:vulnerability] } + ) + write_json(File.join(csaf_dir, "#{pkg['name']}.json"), csaf_pkg_doc) + + csaf_index_packages << { + "repo" => pkg["repo"], + "name" => pkg["name"], + "tier" => pkg["tier"], + "release_stream" => pkg["release_stream"], + "purl" => pkg["purl"], + "csaf_feed_url" => csaf_url, + "vulnerability_count" => pkg_cve_infos.length, + "vulnerability_ids" => vuln_ids + } + csaf_by_purl[pkg["purl"]] = { + "repo" => pkg["repo"], + "name" => pkg["name"], + "csaf_feed_url" => csaf_url, + "vulnerability_ids" => vuln_ids + } + + # Per-package OpenVEX feed + vex_docs = pkg_cve_infos.map { |c| build_vex_document(c) } + vex_pkg_feed = { + "schema_version" => "0.2.0", + "package" => pkg_meta, + "documents" => vex_docs + } + write_json(File.join(vex_dir, "#{pkg['name']}.json"), vex_pkg_feed) + + vex_index_packages << { + "repo" => pkg["repo"], + "name" => pkg["name"], + "tier" => pkg["tier"], + "release_stream" => pkg["release_stream"], + "purl" => pkg["purl"], + "vex_feed_url" => vex_url, + "document_count" => vex_docs.length, + "vulnerability_ids" => vuln_ids + } + vex_by_purl[pkg["purl"]] = { + "repo" => pkg["repo"], + "name" => pkg["name"], + "vex_feed_url" => vex_url, + "vulnerability_ids" => vuln_ids + } end # 3. OSV index: /feeds/osv/index.json @@ -435,7 +781,45 @@ def main } write_json(File.join(ghsa_dir, "index.json"), ghsa_index) - puts "Generated OSV and GHSA feeds for #{packages.length} packages (#{all_records.length} OSV records) in #{OUT_DIR}" + # 5. CSAF index: /feeds/csaf/index.json + csaf_index = { + "csaf_version" => "2.0", + "base_url" => BASE_URL, + "packages" => csaf_index_packages, + "by_purl" => csaf_by_purl, + "documents" => all_cve_infos.map do |c| + { + "id" => c[:cve_id], + "published" => c[:published], + "modified" => c[:modified], + "summary" => c[:summary], + "purls" => c[:matched_packages].map { |p| p["purl"] }.uniq, + "url" => "#{BASE_URL}/feeds/csaf/#{c[:cve_id]}.json" + } + end + } + write_json(File.join(csaf_dir, "index.json"), csaf_index) + + # 6. OpenVEX index: /feeds/vex/index.json + vex_index = { + "openvex_version" => "0.2.0", + "base_url" => BASE_URL, + "packages" => vex_index_packages, + "by_purl" => vex_by_purl, + "documents" => all_cve_infos.map do |c| + { + "id" => c[:cve_id], + "published" => c[:published], + "modified" => c[:modified], + "summary" => c[:summary], + "purls" => c[:matched_packages].map { |p| p["purl"] }.uniq, + "url" => "#{BASE_URL}/feeds/vex/#{c[:cve_id]}.json" + } + end + } + write_json(File.join(vex_dir, "index.json"), vex_index) + + puts "Generated OSV, GHSA, CSAF, and OpenVEX feeds for #{packages.length} packages (#{all_records.length} CVE records) in #{OUT_DIR}" end main if __FILE__ == $PROGRAM_NAME diff --git a/scripts/validate_feeds.rb b/scripts/validate_feeds.rb index 6c795a9..5fedd5d 100644 --- a/scripts/validate_feeds.rb +++ b/scripts/validate_feeds.rb @@ -7,9 +7,16 @@ ROOT = File.expand_path("..", __dir__) SCHEMA_PATH = File.join(ROOT, "schemas", "osv-schema.json") +CSAF_SCHEMA_PATH = File.join(ROOT, "schemas", "csaf-2.0-schema.json") +VEX_SCHEMA_PATH = File.join(ROOT, "schemas", "openvex-0.2.0-schema.json") +CVSS_REF_MAP = { + "https://www.first.org/cvss/cvss-v2.0.json" => File.join(ROOT, "schemas", "cvss-v2.0.json"), + "https://www.first.org/cvss/cvss-v3.0.json" => File.join(ROOT, "schemas", "cvss-v3.0.json"), + "https://www.first.org/cvss/cvss-v3.1.json" => File.join(ROOT, "schemas", "cvss-v3.1.json") +}.freeze PACKAGES_FILE = File.join(ROOT, "_data", "packages.yml") -def validate_osv_record(schemer, record, context_label, errors) +def validate_against_schema(schemer, record, context_label, errors) issues = schemer.validate(record).to_a return if issues.empty? @@ -22,13 +29,30 @@ def main feeds_dir = ARGV[0] ? File.expand_path(ARGV[0]) : File.join(ROOT, "feeds") schema = JSON.parse(File.read(SCHEMA_PATH, encoding: "UTF-8")) schemer = JSONSchemer.schema(schema) + + csaf_ref_resolver = lambda do |uri| + path = CVSS_REF_MAP[uri.to_s] + path ? JSON.parse(File.read(path, encoding: "UTF-8")) : nil + end + csaf_schemer = JSONSchemer.schema( + JSON.parse(File.read(CSAF_SCHEMA_PATH, encoding: "UTF-8")), + ref_resolver: csaf_ref_resolver + ) + vex_schemer = JSONSchemer.schema( + JSON.parse(File.read(VEX_SCHEMA_PATH, encoding: "UTF-8")) + ) + packages = YAML.safe_load_file(PACKAGES_FILE, permitted_classes: [Date, Time]).fetch("packages", []) errors = [] validated_records = 0 + validated_csaf = 0 + validated_vex = 0 osv_dir = File.join(feeds_dir, "osv") ghsa_dir = File.join(feeds_dir, "ghsa") + csaf_dir = File.join(feeds_dir, "csaf") + vex_dir = File.join(feeds_dir, "vex") osv_index_path = File.join(osv_dir, "index.json") unless File.exist?(osv_index_path) @@ -48,6 +72,26 @@ def main errors << "GHSA index missing 'packages' array" unless ghsa_index["packages"].is_a?(Array) end + csaf_index_path = File.join(csaf_dir, "index.json") + unless File.exist?(csaf_index_path) + errors << "Missing CSAF index file: #{csaf_index_path}" + else + csaf_index = JSON.parse(File.read(csaf_index_path, encoding: "UTF-8")) + errors << "CSAF index missing 'packages' array" unless csaf_index["packages"].is_a?(Array) + errors << "CSAF index missing 'by_purl' object" unless csaf_index["by_purl"].is_a?(Hash) + errors << "CSAF index missing 'documents' array" unless csaf_index["documents"].is_a?(Array) + end + + vex_index_path = File.join(vex_dir, "index.json") + unless File.exist?(vex_index_path) + errors << "Missing OpenVEX index file: #{vex_index_path}" + else + vex_index = JSON.parse(File.read(vex_index_path, encoding: "UTF-8")) + errors << "OpenVEX index missing 'packages' array" unless vex_index["packages"].is_a?(Array) + errors << "OpenVEX index missing 'by_purl' object" unless vex_index["by_purl"].is_a?(Hash) + errors << "OpenVEX index missing 'documents' array" unless vex_index["documents"].is_a?(Array) + end + package_names = packages.map { |p| p["name"].to_s } packages.each do |pkg| @@ -60,7 +104,7 @@ def main end if data["vulns"].is_a?(Array) data["vulns"].each_with_index do |vuln, idx| - validate_osv_record(schemer, vuln, "#{osv_pkg_path}#vulns[#{idx}]", errors) + validate_against_schema(schemer, vuln, "#{osv_pkg_path}#vulns[#{idx}]", errors) validated_records += 1 end else @@ -80,6 +124,33 @@ def main else errors << "Missing per-package GHSA feed: #{ghsa_pkg_path}" end + + csaf_pkg_path = File.join(csaf_dir, "#{name}.json") + if File.exist?(csaf_pkg_path) + data = JSON.parse(File.read(csaf_pkg_path, encoding: "UTF-8")) + validate_against_schema(csaf_schemer, data, csaf_pkg_path, errors) + validated_csaf += 1 + else + errors << "Missing per-package CSAF feed: #{csaf_pkg_path}" + end + + vex_pkg_path = File.join(vex_dir, "#{name}.json") + if File.exist?(vex_pkg_path) + data = JSON.parse(File.read(vex_pkg_path, encoding: "UTF-8")) + unless data["package"].is_a?(Hash) && data["package"]["purl"] == pkg["purl"] + errors << "#{vex_pkg_path}: missing or mismatched package.purl (expected #{pkg['purl']})" + end + if data["documents"].is_a?(Array) + data["documents"].each_with_index do |doc, idx| + validate_against_schema(vex_schemer, doc, "#{vex_pkg_path}#documents[#{idx}]", errors) + validated_vex += 1 + end + else + errors << "#{vex_pkg_path}: 'documents' must be an Array" + end + else + errors << "Missing per-package OpenVEX feed: #{vex_pkg_path}" + end end # Validate all standalone OSV record files in feeds/osv/*.json @@ -88,17 +159,37 @@ def main next if base == "index" || package_names.include?(base) record = JSON.parse(File.read(path, encoding: "UTF-8")) - validate_osv_record(schemer, record, path, errors) + validate_against_schema(schemer, record, path, errors) validated_records += 1 end + # Validate all standalone CSAF document files in feeds/csaf/*.json + Dir.glob(File.join(csaf_dir, "*.json")).sort.each do |path| + base = File.basename(path, ".json") + next if base == "index" || package_names.include?(base) + + doc = JSON.parse(File.read(path, encoding: "UTF-8")) + validate_against_schema(csaf_schemer, doc, path, errors) + validated_csaf += 1 + end + + # Validate all standalone OpenVEX document files in feeds/vex/*.json + Dir.glob(File.join(vex_dir, "*.json")).sort.each do |path| + base = File.basename(path, ".json") + next if base == "index" || package_names.include?(base) + + doc = JSON.parse(File.read(path, encoding: "UTF-8")) + validate_against_schema(vex_schemer, doc, path, errors) + validated_vex += 1 + end + if errors.any? - warn "OSV/GHSA feed validation failed with #{errors.length} error(s):" + warn "OSV/GHSA/CSAF/VEX feed validation failed with #{errors.length} error(s):" errors.each { |e| warn " - #{e}" } exit 1 end - puts "Validated #{validated_records} OSV record(s) and #{packages.length} package feeds against OSV JSON Schema." + puts "Validated #{validated_records} OSV, #{validated_csaf} CSAF, and #{validated_vex} OpenVEX record(s) across #{packages.length} package feeds." end main if __FILE__ == $PROGRAM_NAME diff --git a/test/test_feeds.rb b/test/test_feeds.rb index 618da22..1dd8ab5 100644 --- a/test/test_feeds.rb +++ b/test/test_feeds.rb @@ -22,8 +22,12 @@ def test_tier_a_endpoints_exist %w[rnp metanorma cla identity].each do |pkg| osv_path = File.join(FEEDS_DIR, "osv", "#{pkg}.json") ghsa_path = File.join(FEEDS_DIR, "ghsa", "#{pkg}.json") + csaf_path = File.join(FEEDS_DIR, "csaf", "#{pkg}.json") + vex_path = File.join(FEEDS_DIR, "vex", "#{pkg}.json") assert File.exist?(osv_path), "Expected #{osv_path} to exist" assert File.exist?(ghsa_path), "Expected #{ghsa_path} to exist" + assert File.exist?(csaf_path), "Expected #{csaf_path} to exist" + assert File.exist?(vex_path), "Expected #{vex_path} to exist" osv = JSON.parse(File.read(osv_path, encoding: "UTF-8")) assert_kind_of Array, osv["vulns"] @@ -32,12 +36,24 @@ def test_tier_a_endpoints_exist ghsa = JSON.parse(File.read(ghsa_path, encoding: "UTF-8")) assert_kind_of Array, ghsa["advisories"] assert_equal pkg, ghsa.dig("package", "name") + + csaf = JSON.parse(File.read(csaf_path, encoding: "UTF-8")) + assert_equal "csaf_vex", csaf.dig("document", "category") + assert_equal "2.0", csaf.dig("document", "csaf_version") + + vex = JSON.parse(File.read(vex_path, encoding: "UTF-8")) + assert_kind_of Array, vex["documents"] + assert_equal pkg, vex.dig("package", "name") end end def test_osv_index_keyed_by_package_and_purl index = JSON.parse(File.read(File.join(FEEDS_DIR, "osv", "index.json"), encoding: "UTF-8")) + csaf_index = JSON.parse(File.read(File.join(FEEDS_DIR, "csaf", "index.json"), encoding: "UTF-8")) + vex_index = JSON.parse(File.read(File.join(FEEDS_DIR, "vex", "index.json"), encoding: "UTF-8")) assert_equal "https://cve.ribose.com", index["base_url"] + assert_equal "https://cve.ribose.com", csaf_index["base_url"] + assert_equal "https://cve.ribose.com", vex_index["base_url"] expected_purls = { "rnp" => "pkg:github/rnpgp/rnp", @@ -50,15 +66,29 @@ def test_osv_index_keyed_by_package_and_purl assert index["by_purl"].key?(purl), "Expected index by_purl to include #{purl}" assert_equal "https://cve.ribose.com/feeds/osv/#{pkg}.json", index.dig("by_purl", purl, "osv_feed_url") assert_equal "https://cve.ribose.com/feeds/ghsa/#{pkg}.json", index.dig("by_purl", purl, "ghsa_feed_url") + assert_equal "https://cve.ribose.com/feeds/csaf/#{pkg}.json", index.dig("by_purl", purl, "csaf_feed_url") + assert_equal "https://cve.ribose.com/feeds/vex/#{pkg}.json", index.dig("by_purl", purl, "vex_feed_url") + + assert_equal "https://cve.ribose.com/feeds/csaf/#{pkg}.json", csaf_index.dig("by_purl", purl, "csaf_feed_url") + assert_equal "https://cve.ribose.com/feeds/vex/#{pkg}.json", vex_index.dig("by_purl", purl, "vex_feed_url") end end def test_rnp_osv_records_contain_expected_cves rnp = JSON.parse(File.read(File.join(FEEDS_DIR, "osv", "rnp.json"), encoding: "UTF-8")) + rnp_csaf = JSON.parse(File.read(File.join(FEEDS_DIR, "csaf", "rnp.json"), encoding: "UTF-8")) + rnp_vex = JSON.parse(File.read(File.join(FEEDS_DIR, "vex", "rnp.json"), encoding: "UTF-8")) ids = rnp["vulns"].map { |v| v["id"] } + csaf_ids = rnp_csaf["vulnerabilities"].map { |v| v["cve"] } + vex_ids = rnp_vex["documents"].map { |d| d.dig("statements", 0, "vulnerability", "name") } + %w[CVE-2025-13470 CVE-2023-29480 CVE-2023-29479 CVE-2021-33589].each do |cve| assert_includes ids, cve + assert_includes csaf_ids, cve + assert_includes vex_ids, cve assert File.exist?(File.join(FEEDS_DIR, "osv", "#{cve}.json")) + assert File.exist?(File.join(FEEDS_DIR, "csaf", "#{cve}.json")) + assert File.exist?(File.join(FEEDS_DIR, "vex", "#{cve}.json")) end cve_2025 = rnp["vulns"].find { |v| v["id"] == "CVE-2025-13470" } @@ -77,6 +107,8 @@ def test_validator_rejects_malformed_osv_record Dir.mktmpdir do |tmpdir| FileUtils.cp_r(File.join(FEEDS_DIR, "osv"), tmpdir) FileUtils.cp_r(File.join(FEEDS_DIR, "ghsa"), tmpdir) + FileUtils.cp_r(File.join(FEEDS_DIR, "csaf"), tmpdir) + FileUtils.cp_r(File.join(FEEDS_DIR, "vex"), tmpdir) bad_record_path = File.join(tmpdir, "osv", "CVE-2025-99999.json") File.write(bad_record_path, JSON.pretty_generate({ "id" => "INVALID-PREFIX-123" })) @@ -86,4 +118,20 @@ def test_validator_rejects_malformed_osv_record assert_includes out, "validation failed" end end + + def test_validator_rejects_malformed_csaf_and_vex_records + Dir.mktmpdir do |tmpdir| + FileUtils.cp_r(File.join(FEEDS_DIR, "osv"), tmpdir) + FileUtils.cp_r(File.join(FEEDS_DIR, "ghsa"), tmpdir) + FileUtils.cp_r(File.join(FEEDS_DIR, "csaf"), tmpdir) + FileUtils.cp_r(File.join(FEEDS_DIR, "vex"), tmpdir) + + File.write(File.join(tmpdir, "csaf", "CVE-2025-99999.json"), JSON.pretty_generate({ "document" => {} })) + File.write(File.join(tmpdir, "vex", "CVE-2025-99999.json"), JSON.pretty_generate({ "statements" => [] })) + + out, status = Open3.capture2e(RbConfig.ruby, VALIDATE_SCRIPT, tmpdir) + refute status.success?, "validate_feeds.rb must fail on malformed CSAF and OpenVEX records" + assert_includes out, "CVE-2025-99999.json" + end + end end