Created importers for detailed scan results #2031
Open
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.
I implemented a pluggable scan results import system for ScanCode.io that extends the existing LoadInventory pipeline to automatically detect and import data from three external security tools: VulnerableCode for vulnerability data, PurlDB for package metadata enrichment, and MatchCode.io for fingerprint-based package matching. The implementation uses a strategy pattern with automatic tool detection based on JSON structure analysis, followed by specialized importer functions that handle database operations efficiently using bulk updates and PURL-based matching. I added production code across two core files in the scanpipe/pipes/input.py and scanpipe/pipelines/load_inventory.py modules, created three JSON test fixtures, and wrote four comprehensive unit tests to validate the tool detection logic and each importer's database operations. The architecture is extensible, idempotent, and follows Django best practices, allowing users to simply drop JSON exports from these tools into their project's input directory and have the pipeline automatically process them without any manual configuration.