feat(validation): add CycloneDX 1.6 schema validation#22
Open
arunsanna wants to merge 4 commits intoGenAI-Security-Project:mainfrom
Open
feat(validation): add CycloneDX 1.6 schema validation#22arunsanna wants to merge 4 commits intoGenAI-Security-Project:mainfrom
arunsanna wants to merge 4 commits intoGenAI-Security-Project:mainfrom
Conversation
- Add validation.py module with full CycloneDX 1.6 JSON schema validation - Implement schema caching (in-memory + file-based) for performance - Add validate_aibom() for full schema validation - Add validate_minimal_requirements() for lightweight checks - Add get_validation_summary() for completeness reports - Integrate validation into generator with enhancement report - Add schema validation to completeness scoring in utils.py - Add comprehensive test suite with 11 tests Closes GenAI-Security-Project#17
There was a problem hiding this comment.
Pull request overview
This pull request adds CycloneDX 1.6 JSON schema validation capabilities to the AIBOM generator to ensure compliance and interoperability.
Changes:
- Adds a new
validation.pymodule with schema validation functions including full schema validation, minimal requirements checking, and validation summary generation - Integrates validation into the generator workflow with warnings for schema violations
- Adds schema validation results to completeness scoring and enhancement reports
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| validation.py | New module providing CycloneDX 1.6 schema validation with caching support |
| test_validation.py | Comprehensive test suite with 11 tests covering validation functions |
| generator.py | Integrates schema validation into AIBOM generation workflow |
| utils.py | Adds schema validation summary to completeness scoring results |
| requirements.txt | Adds jsonschema>=4.17.0 dependency |
Comments suppressed due to low confidence (1)
HF_files/aibom-generator/src/aibom-generator/generator.py:1
- Duplicate import of 'json' on lines 1 and 4. Remove one of the duplicate imports.
import json
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Import normalize_license_id from utils - Normalize license IDs to proper SPDX format (e.g., Apache-2.0) - Use 'name' field instead of 'id' for non-SPDX licenses - Update _get_license_url to use SPDX-compliant keys - Fix NOASSERTION to use name field (not a valid SPDX id)
- Remove unused os import from validation.py - Improve serialNumber error message to show actual value - Replace print() with logger.warning() in utils.py - Move logger definition before schema validation import
Author
✅ Testing Completed - VERIFIEDTest Space: https://megamind1-aibom-pr22-schema-validation.hf.space Test Results
Files Verified
Ready for merge. ✓ |
3 tasks
Author
Status Update: Superseded by v0.2The CycloneDX 1.6 schema validation has been incorporated into the v0.2 branch architecture. Evidence:
Schema files in
This PR can be closed as schema validation is already in v0.2. |
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.
Summary
Implements CycloneDX 1.6 JSON schema validation for generated AIBOMs to ensure compliance and interoperability.
Changes
New
validation.pymodule with full schema validation capabilities:validate_aibom(): Full schema validation against CycloneDX 1.6 JSON schemavalidate_minimal_requirements(): Lightweight sanity check without full schemaget_validation_summary(): Get validation results for completeness reportsGenerator integration:
Completeness scoring integration:
schema_validationkey in resultsTest suite: 11 comprehensive tests covering:
New dependency
jsonschema>=4.17.0added to requirements.txtTest Plan
pytest tests/test_validation.py -v)Test Results
Closes #17