Skip to content

Show a user-friendly error when the CVE Record Schema cannot be loaded #24

Description

@ann-linh-mitre

Ann Tu Linh
Good questions. Let's scope it to this issue (PR #15 (Bug Fix #6)) that I will post later: Show an error when the CVE Record Schema cannot be loaded. Currently, I'm not able to reproduce it and the c…
Following up on this issue. This is what I am thinking of posting but like to get your thoughts on it first. The program does handle the case when the files fail, but we can do one better:

Issue: Show a user-friendly error when the CVE Record Schema cannot be loaded

Current behavior

When the CVE Record Schema cannot be loaded, the Validation Library throws an error directly from fs.ts:

Error: Unable to find 5.2.0_published_cna_container.json. Checked: /path/to/cve-validation-library/dist/../schemas/5.2.0_published_cna_container.json

This exposes the low-level file-loading error without providing users with guidance on how to recover.

Desired behavior

When the CVE Record Schema cannot be loaded, the Validation Library should gracefully stop validation and return a user-friendly error message that explains the failure and provides recovery steps.

Requirements

  • Update the error handling in fs.ts line 31.
  • Do not expose the schema-loading failure as an unhandled error.
  • Stop validation when the required CVE Record Schema cannot be found.
  • Return the following message, preserving the underlying file/path details:
CVE Validation Library failed to validate CVE data.
 
Try using npm to reinstall the library. If that does not work, file an issue in the repository:
https://github.com/CVEProject/cve-validation-library/issues/new
 
Error: Unable to find ${fileName}. Checked: ${checkedPaths}

Acceptance criteria

  • Validation stops immediately if the required CVE Record Schema cannot be loaded.
  • The client receives the user-friendly validation failure message.
  • The message includes the missing ${fileName} and all ${checkedPaths}.
  • The message provides instructions to reinstall the library using npm.
  • The message provides a link for filing an issue if reinstalling does not resolve the problem.
  • Existing validation behavior is unchanged when the schema loads successfully.
    Official CVE Validation Library for validating CVE Records - CVEProject/cve-validation-library

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions