Skip to content

fix: use cveMetadata.cveId in CNA basic rule - #25

Merged
mprpic merged 1 commit into
mprpic:mainfrom
jgamblin:fix/cveMetadata-cveId
Jul 10, 2026
Merged

fix: use cveMetadata.cveId in CNA basic rule#25
mprpic merged 1 commit into
mprpic:mainfrom
jgamblin:fix/cveMetadata-cveId

Conversation

@jgamblin

@jgamblin jgamblin commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Summary

This PR fixes a bug introduced in PR #21 where the CNA basic validation rule incorrectly expected the CVE ID to be located at cveMetadata.id.

Per the CVE v5 JSON schema, the correct and canonical field name is cveMetadata.cveId. Using the incorrect field id caused the linter to falsely fail valid CVE records with a "CVE ID must be present" error.

Changes

  • Fix Field Path: Updated CheckCNARulesV4_0Basic in internal/rules/cna_rules.go to extract and validate cveMetadata.cveId.
  • Align Tests: Updated the corresponding test fixtures in internal/rules/cna_rules_test.go to reflect the correct schema structure, replacing legacy id fields with cveId.
  • Consistency: This brings the CNA rules inline with the rest of the cvelint codebase (such as references.go), which already correctly utilizes cveId.

Validation

  • go test ./internal/rules -run TestCheckCNARulesV4_0Basic passes with the updated schema-compliant fixtures.
  • go test ./... passes with zero regressions.

@mprpic
mprpic merged commit 0f792f8 into mprpic:main Jul 10, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants