Add comprehensive CVE data validation to prevent processing crashes#9
Open
lochlanmcelroy wants to merge 1 commit intocisagov:developfrom
Open
Add comprehensive CVE data validation to prevent processing crashes#9lochlanmcelroy wants to merge 1 commit intocisagov:developfrom
lochlanmcelroy wants to merge 1 commit intocisagov:developfrom
Conversation
Author
|
I don't think I can add labels & some of the checklist is tough for me to do alone, but I hope this is a helpful first contribution :) |
Pull Request Test Coverage Report for Build 16666400260Details
💛 - Coveralls |
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.
Add comprehensive CVE data validation to prevent processing crashes
🗣 Description
This PR adds robust input validation to the
process_cve_jsonfunction to handle malformed or unexpected CVE data from the NVD. The validation includes type checking for JSON structure, CVSS score range validation (0.0-10.0), and comprehensive error handling with detailed logging.💭 Motivation and context
The current code has minimal validation and could crash or corrupt data if:
This change makes the CVE sync process more robust by validating data before processing and gracefully skipping invalid entries while logging detailed warnings for debugging.
🧪 Testing
Enhanced the existing
process_cve_jsonfunction with additional validation logic. The changes maintain backward compatibility and can be tested with existing test suite. Manual testing shows proper handling of invalid data with appropriate logging.I ran some local tests for formatting & edge cases to ensure everything worked smoothly, and can add those to the repo as well if needed.
All existing tests continue to pass, ensuring no breaking changes to current functionality.
✅ Pre-approval checklist
bump_versionscript if this repository is versioned and the changes in this PR warrant a version bump.✅ Pre-merge checklist
✅ Post-merge checklist