feat: use VulnsStatus to skip NVD Rejected CVE - #542
Merged
Conversation
knqyf263
reviewed
Jun 17, 2025
There are some CVE which will not have "** REJECT **" keyword, but they are rejected. Hence added checks for such CVEs. eg. CVE-2024-4109 CVE-2022-45046
gshanbhag525
force-pushed
the
gun-rejected-cve
branch
from
June 17, 2025 12:00
c9eb2c2 to
0a25722
Compare
knqyf263
reviewed
Jun 18, 2025
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR enhances the logic for skipping rejected CVEs by introducing a VulnStatus field and adding checks for additional rejection patterns in descriptions.
- Add
VulnStatusto core types and mappings from NVD payloads - Extend
getRejectedStatusto skip CVEs based on status or new description markers - Update tests to populate and evaluate the new
VulnStatusfield
Reviewed Changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| pkg/vulnsrc/vulnerability/vulnerability.go | Add rejectedStatus, rejectedReason, rejectedDoNotUse constants and extend rejection logic |
| pkg/vulnsrc/vulnerability/vulnerability_test.go | Populate VulnStatus in test cases for both modified and rejected CVEs |
| pkg/vulnsrc/nvd/types.go | Add VulnStatus field to Cve struct |
| pkg/vulnsrc/nvd/nvd.go | Map cve.VulnStatus into stored VulnerabilityDetail |
| pkg/vulnsrc/nvd/nvd_test.go | Populate VulnStatus in NVD test fixtures |
| pkg/types/types.go | Add VulnStatus to VulnerabilityDetail type |
Comments suppressed due to low confidence (3)
pkg/vulnsrc/vulnerability/vulnerability_test.go:122
- Add test cases where
Descriptioncontains "DO NOT USE THIS CANDIDATE NUMBER" and where it starts with "Rejected reason:" to cover all new rejection branches.
VulnStatus: "Rejected",
pkg/vulnsrc/nvd/types.go:12
- [nitpick] Add a comment above this field to explain what
VulnStatusrepresents, which values are expected, and its source.
VulnStatus string `json:"vulnStatus"`
pkg/vulnsrc/vulnerability/vulnerability.go:15
- [nitpick] Consider renaming
rejectVulnerabilityto something likerejectedKeywordorrejectionMarkerto align clearly with the otherrejected*constants.
rejectVulnerability = "** REJECT **"
knqyf263
reviewed
Jun 19, 2025
knqyf263
left a comment
Collaborator
There was a problem hiding this comment.
@DmitriyLewen Any comments?
DmitriyLewen
approved these changes
Jun 25, 2025
knqyf263
approved these changes
Jun 30, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
There are some CVE which will not have "** REJECT **" keyword, but they are rejected.
Hence used VulnStatus to skip such NVD CVEs.
eg.
CVE-2024-4109
CVE-2022-45046
CVE-2024-36610