Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: improved sbom filename extension handling #4919

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

22f1001635
Copy link
Contributor

Summary

This PR fixes SBOM parsing test failures caused by invalid CycloneDX file extensions. It enforces strict extension validation for CycloneDX files and improves error handling while ensuring backward compatibility.


Changes Introduced

  • Extension Validation:
    • CycloneDX SBOMs now require .json or .xml extensions. Invalid extensions trigger explicit error logging.
  • Test Fixes:
    • Updated test cases to use valid SBOM files from the test/sbom directory.
    • Added checks for error logging and empty results when invalid extensions are detected.
  • Code Refactoring:
    • Simplified extension validation logic in parse.py.

Checklist

  • ✅ Code adheres to project standards.
  • ✅ Tests pass (including updated SBOM test cases).

Steps to Test

pytest test/test_sbom.py -v

Verified

  • Tests for invalid CycloneDX extensions log errors and return empty results.
  • Valid CycloneDX files (JSON/XML) parse successfully.

Related Issues
Fixes #4836

@22f1001635 22f1001635 force-pushed the improved-sbom-filename-extension-handling branch from 4389a69 to 780892a Compare March 13, 2025 09:43
@22f1001635
Copy link
Contributor Author

hi @terriko required changes for URL sanitation has been made please take a look

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

Successfully merging this pull request may close these issues.

bug: improved sbom filename extension handling
2 participants