feat: Add dry_run support for reimport-scan operations#13563
Draft
Siryu6 wants to merge 10000 commits intoDefectDojo:devfrom
Draft
feat: Add dry_run support for reimport-scan operations#13563Siryu6 wants to merge 10000 commits intoDefectDojo:devfrom
Siryu6 wants to merge 10000 commits intoDefectDojo:devfrom
Conversation
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
This PR implements a dry_run feature for reimport-scan operations that allows users to preview what changes would occur during a reimport without making any database modifications.
Key Features:
dry_runboolean parameter (defaults tofalse) on reimport-scan API endpointsclose_old_findings,do_not_reactivate, severity filters, etc.)Use Case:
This feature is particularly useful for CI/CD pipelines where teams want to validate scan results and preview changes before merging to production environments.
API Response Example:
{ "test_id": 123, "dry_run": true, "changes_preview": { "would_create": 5, "would_reactivate": 2, "would_close": 3, "would_leave_untouched": 10, "total_changes": 10 }, "findings_details": { "new_findings": [...], "reactivated_findings": [...], "closed_findings": [...], "unchanged_findings": [...] } }Documentation
API documentation is included in the serializer field descriptions (
help_text).Files Changed
dojo/api_v2/serializers.py- API integration for dry_run parameterdojo/importers/default_reimporter.py- Core dry_run_reimport() logicdojo/importers/default_importer.py- Return signature updatedojo/importers/options.py- dry_run parameter validationdojo/fixtures/dojo_testdata.json- Fixed missing SLA_Configurationdojo/engagement/views.py- View layer dry_run supportdojo/test/views.py- View layer dry_run supportunittests/dojo_test_case.py- Test helper methodsunittests/test_import_reimport.py- Minor test adjustmentsunittests/test_import_reimport_dry_run.py- New comprehensive test suiteLabels to add:
enhancementfeature