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

Dynamic Parsing: Add flag to indicate new test types #10871

Merged
merged 2 commits into from
Sep 9, 2024

Conversation

Maffooch
Copy link
Contributor

@Maffooch Maffooch commented Sep 5, 2024

When using parsers that are capable of creating new test types (e.i. generic, sarif, GitLab, etc.) it would beneficial to know if a test type was generated "dynamically" or if it is supported by DefectDojo out of the box

[sc-7401]

@github-actions github-actions bot added New Migration Adding a new migration file. Take care when merging. apiv2 unittests labels Sep 5, 2024
Copy link

dryrunsecurity bot commented Sep 5, 2024

DryRun Security Summary

The pull request covers various improvements to the Defect Dojo application, including handling of test types, form management, API serialization, and the import/reimport functionality for security scan reports, without introducing any obvious security vulnerabilities.

Expand for full summary

Summary:

The code changes in this pull request cover various aspects of the Defect Dojo application, including the handling of test types, form management, API serialization, and the import/reimport functionality for security scan reports.

From an application security perspective, the changes do not introduce any obvious security vulnerabilities. The changes are primarily focused on enhancing the functionality and maintainability of the application, such as:

  1. Tracking whether test types are dynamically generated during the import process.
  2. Updating forms to exclude certain fields from being displayed.
  3. Adjusting the serialization of test type data to remove unnecessary fields.
  4. Improving the handling of import and reimport of security scan reports, including preserving finding history, managing unique identifiers, and providing detailed statistics.

While these changes do not directly address security vulnerabilities, it's important to review the broader context and potential implications of the changes. Proper input validation, access control, and secure data handling should be maintained throughout the application to prevent common web application vulnerabilities.

Files Changed:

  1. dojo/importers/base_importer.py: The changes add functionality to mark dynamically generated test types and save them to the database.
  2. dojo/db_migrations/0214_test_type_dynamically_generated.py: This database migration adds a new dynamically_generated field to the test_type model.
  3. dojo/forms.py: The changes update the Test_TypeForm class to exclude the dynamically_generated field from the form.
  4. dojo/api_v2/serializers.py: The changes remove the dynamically_generated field from the TestTypeSerializer.
  5. dojo/models.py: The changes add a new dynamically_generated field to the Test_Type model.
  6. unittests/test_import_reimport.py: The changes enhance the import and reimport functionality for various types of security scan reports, including handling of unique identifiers, preserving existing findings, and providing detailed statistics.

Code Analysis

We ran 9 analyzers against 6 files and 0 analyzers had findings. 9 analyzers had no findings.

Riskiness

🟢 Risk threshold not exceeded.

View PR in the DryRun Dashboard.

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

@Maffooch Maffooch merged commit f13afa8 into DefectDojo:bugfix Sep 9, 2024
72 checks passed
@Maffooch Maffooch deleted the dynamic branch September 9, 2024 14:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
apiv2 New Migration Adding a new migration file. Take care when merging. unittests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants