feat(parsers): add Lacework api importer#14977
Open
GoldraK wants to merge 2 commits into
Open
Conversation
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.
Description
Add a new Lacework API importer/parser for vulnerability ingestion via the Lacework API v2.0. This importer fetches container and host vulnerabilities directly from Lacework without requiring file uploads, following the same pattern as the existing SonarQube API importer.
What this PR introduces:
New module
dojo/tools/api_lacework/:api_client.py— Full Lacework API v2.0 client with Bearer token authentication, automatic pagination, rate limiting, and configurable import options via theExtrasfieldimporter.py— Core importer logic that fetches container and host vulnerabilities and maps them to DefectDojo Finding objects. Supports filtering by repository name viaService key 1parser.py— Parser interface (ApiLaceworkParser) that exposes scan typeLacework API Import, declaresrequires_file=False, and delegates to the importerupdater.py— Placeholder updater for future Lacework vulnerability exception sync (currently logs a no-op)Management commands:
lacework_import_all.py— Bulk import all repositories, auto-creates Products/Engagements/Tests per repositorylacework_debug_vuln.py— Debug command to examine raw Lacework vulnerability data for containers or hostsSettings (
settings.dist.py):DD_LACEWORK_API_IMPORTER_INCLUDE_HOSTS— Enable/disable host vulnerability import (default:True)DD_LACEWORK_API_IMPORTER_TIMEDELTA_HOURS— Time window in hours for API queries (default: 24, max 168)["vuln_id_from_tool", "component_name", "file_path"]DEDUPE_ALGO_HASH_CODEIntegration points:
tool_config/factory.py— RegisteredLaceworkAPIinSCAN_APISfactorytool_issue_updater.py— AddedLaceworkApiUpdaterdispatch for future status syncField mapping:
vulnIdvuln_id_from_toolseverity(or inferred fromriskScore)severitycveProps.description+featureProps.introduced_indescriptionfeatureKey.name/featureKey.versioncomponent_name/component_versionfeatureProps.srcfile_pathfixInfo.fix_available/fixInfo.fixed_versionfix_available/fix_versioncveRiskScore/riskScorecvssv3_scoreTest results
Added comprehensive unit tests in
unittests/test_api_lacework.pywith 30 test methods covering:requires_file,requires_tool_type)Not yet tested:
lacework_import_all,lacework_debug_vuln) — run manuallyDocumentation
Updated documentation at
docs/content/supported_tools/parsers/api/lacework.mdcovering:lacework_import_all,lacework_debug_vuln)Checklist
dev.dev.