Manage schemas¶
The Editor supports CVE, GCVE and OSV record editing. The relevant schemas are pulled from the official repositories (CVE, GCVE and OSV). GCVE is just an extension to the CVE record schema by providing an extra x_gcve extension field which can be populated with additional data. OSV is a standalone format; its profile (osv-1.9.2) reuses the GCVE extension schema for GCVE data stored under database_specific. In addition to that there exists extension to the BCP-05 standard defining the GCVE record structure. As of today three extensions exist:
-
BCP-05-X-01: Standard for adding information about AI assisted annotations
-
BCP-05-X-02: Standard for using patch2vuln for record creation
-
BCP-05-X-03: Standard for a vulnerability's handling and disclosure timeline
Info
These BCP extensions do not have official schemas, only generic field definitions on the corresponding website. Therefore custom schemas based on these generic field definitions were created in schemas/extensions. Which extensions are included in the generated GCVE profile, and whether each is published or still draft, is defined in schemas/extensions/gcve/registry.json.
The schemas/manifest.json file contains the definitions of all available profiles which can be used to build the editor UI and their corresponding schema files. currentProfiles names the profile in use for each format (cve, gcve, osv). Each profile entry can define, among other things:
kind(cve,gcveorosv),label(the name shown in the UI) andversion.baseSchema/baseProfile(the upstream schema it builds on, and the profile it extends).extensionSchemas(additional schemas merged in, e.g. the GCVE extension).schemaOverlay(a patch applied on top of the base schema).semanticValidator(a named validator run beyond plain JSON Schema).identifier.strategy(how the backend reads the record's ID:cve,gcveorosv).validation.notRequired(dotted paths of fields the base schema requires but the profile doesn't, e.g.cveMetadata.cveIdfor GCVE records; a value that is present is still checked).validation.preferredRootBranch(which rootoneOfbranch validation errors are reported against when it's unclear which one the record was aiming for, e.g. the published CVE variant).- an
editorblock controlling how the profile renders in the UI:layout,layoutExtras,augmenters,variant(which rootoneOfvariant of the schema the form is built from, e.g.Published) andautoAdditionalPropertiesFrom(a path whose properties not placed in the layout are still added to the form automatically, e.g.containers.cna).
See the gcve-bcp-05-1.7 entry in schemas/manifest.json for a profile using most of these.
Pull Upstream Schema Files¶
New schema files can be fetched from the official sources using the scripts/update_schemas.py script. Every run fetches and installs CVE, GCVE and OSV together; each flag has a default (--cve-ref v5.2.0, --gcve-ref main, --osv-ref v1.9.2), so set all of them:
python3 scripts/update_schemas.py \
--cve-ref v5.2.0 --cve-version 5.2.0 \
--gcve-ref <commit-sha> --gcve-version 1.7 \
--osv-ref v1.9.2 --osv-version 1.9.2
Add --dry-run to see what would change without writing anything.
The schema files are written to the schemas/upstream directory (cve, gcve and osv).
Warning
Leaving out --gcve-ref fetches the moving main branch, so pin a commit.
Warning
Every successful run creates or updates the cve, gcve and osv profile entries in schemas/manifest.json (missing CVE/GCVE settings get defaults, the OSV entry is rebuilt from defaults merged with the existing one), and overwrites all three currentProfiles entries to point to the versions that were just installed.
A new profile also needs its frontend definition in frontend/src/editor/profiles/ (e.g. osv-1.9.2.ts).
UI Schema Creation¶
The schemas used to display the contents in the frontend are directly generated from the official schemas. They are generated using the scripts/generate_editor_schemas.py script, once per profile:
Without --profile, the script uses currentProfiles.cve from schemas/manifest.json.
The script writes three files per profile under frontend/src/generated/schemas/<profile>/:
authoring.schema.json— the schema the editor's form validation is built from.ui.schema.json— the layout/field-ordering schema consumed by the form renderer.field-paths.json— a flat index of every field path in the profile.
Profiles using the gcve-extensions augmenter (GCVE and OSV) also write frontend/src/generated/gcve/extension-schemas.json, the bundle of GCVE extension schemas.
Layout paths that don't exist in the schema are printed as warnings; with --strict they fail the run, which is useful when a new upstream schema version doesn't translate cleanly.
The layout used in the UI can be configured through the *.layout.json files in schemas/editor.