Skip to content

Conversation

@valentijnscholten
Copy link
Member

Description

This PR fixes issue #10219 where DefectDojo silently accepts test_type mismatches during reimport.

Changes

  • Added validation in consolidate_dynamic_tests method to detect test_type mismatches during reimport
  • Raises ValidationError with descriptive message when test_type doesn't match existing test
  • Validation occurs before any findings are processed or deduplication starts
  • Added comprehensive test cases covering:
    • Initial import (should create new test successfully)
    • Reimport with matching test_type (should succeed)
    • Reimport with different test_type (should fail with ValidationError)

Testing

All test cases pass:

  • test_import_generic_with_custom_test_type - Initial import creates test correctly
  • test_reimport_generic_with_matching_test_type - Reimport with matching test_type succeeds
  • test_reimport_generic_with_different_test_type - Reimport with different test_type raises ValidationError

Related Issue

Fixes #10219

- Add validation in consolidate_dynamic_tests to detect test_type mismatches during reimport
- Raise ValidationError with descriptive message when test_type doesn't match
- Validation occurs before any findings are processed or deduplication starts
- Add test cases for matching test_type, mismatched test_type, and initial import scenarios
- Create test data files for generic parser with different test types

Fixes DefectDojo#10219
@valentijnscholten
Copy link
Member Author

Every time I look at this feature I have to find out how it works. To help myself and other I added a short piece of documentation, let me know if that makes sense.

@github-actions github-actions bot added the docs label Dec 24, 2025
@valentijnscholten valentijnscholten changed the title Fix test_type mismatch validation during reimport (#10219) Add test_type mismatch validation during reimport (#10219) Dec 24, 2025
Copy link
Contributor

@mtesauro mtesauro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved

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.

3 participants