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

Add new parser - Threat Composer #10795

Merged
merged 6 commits into from
Sep 6, 2024
Merged

Conversation

arivra
Copy link
Contributor

@arivra arivra commented Aug 21, 2024

Description

New parser for Threat Composer - simple threat modeling tool

Each threat is equivalent to a finding. Mitigations associated with a threat are included in the finding mitigation field.

For more information, Threat Composer

@github-actions github-actions bot added settings_changes Needs changes to settings.py based on changes in settings.dist.py included in this PR docs unittests parser labels Aug 21, 2024
Copy link

dryrunsecurity bot commented Aug 21, 2024

DryRun Security Summary

The provided code changes focus on improving the integration and handling of the Threat Composer parser in the DefectDojo application, including updates to documentation, configuration files, threat modeling data handling, unit tests, and the introduction of threat modeling data files.

Expand for full summary

Summary:

The provided code changes cover a range of updates to the DefectDojo application, primarily focused on improving the integration and handling of the Threat Composer parser. The changes include:

  1. Documentation Update: Adding documentation for the Threat Composer parser, including information about the file types accepted and where to find sample scan data.
  2. Configuration File Changes: Updates to the configuration file checksums and the handling of Threat Composer scan data, including parsing of threats, mitigations, assumptions, and their relationships.
  3. Threat Modeling Data Handling: Improvements to the parsing and representation of Threat Composer data within the DefectDojo application, including the creation of Finding objects and the appropriate handling of threat metadata.
  4. Unit Tests: Addition of comprehensive unit tests to ensure the proper functioning of the Threat Composer parser, covering various scenarios such as files with no threats, one threat, many threats, and files with errors.
  5. Threat Modeling Data Files: Introduction of several JSON files containing threat modeling data for the "Threat Composer" application, including assumptions, mitigations, and threats.

From an application security perspective, the changes appear to be focused on improving the security posture of the DefectDojo application by enhancing the handling of threat modeling data and ensuring the robustness of the Threat Composer parser. The addition of unit tests and the comprehensive threat modeling data files are particularly noteworthy, as they demonstrate a proactive approach to identifying and addressing potential security risks.

Files Changed:

  1. docs/content/en/integrations/parsers/file/threat_composer.md: Documentation update for the Threat Composer parser.
  2. dojo/settings/.settings.dist.py.sha256sum: Configuration file checksum update.
  3. dojo/tools/threat_composer/parser.py: Implementation of the Threat Composer JSON parser.
  4. dojo/settings/settings.dist.py: Updates to the SAML2 attribute mapping and deduplication algorithm for the "ThreatComposer Scan" parser.
  5. unittests/scans/threat_composer/: Addition of several JSON files containing threat modeling data for the "Threat Composer" application.
  6. unittests/tools/test_threat_composer_parser.py: Unit tests for the Threat Composer parser.

Code Analysis

We ran 9 analyzers against 12 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

@kiblik kiblik left a comment

Choose a reason for hiding this comment

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

Couple of ideas for improvements. But I like it in general.

dojo/tools/threat_composer/parser.py Outdated Show resolved Hide resolved
dojo/tools/threat_composer/parser.py Outdated Show resolved Hide resolved
dojo/tools/threat_composer/parser.py Show resolved Hide resolved
unittests/tools/test_threat_composer_parser.py Outdated Show resolved Hide resolved
unittests/tools/test_threat_composer_parser.py Outdated Show resolved Hide resolved
unittests/tools/test_threat_composer_parser.py Outdated Show resolved Hide resolved
unittests/tools/test_threat_composer_parser.py Outdated Show resolved Hide resolved
unittests/tools/test_threat_composer_parser.py Outdated Show resolved Hide resolved
@arivra arivra force-pushed the threat_composer branch 3 times, most recently from 706e490 to cfcb467 Compare August 28, 2024 08:11
@arivra
Copy link
Contributor Author

arivra commented Aug 28, 2024

I have added the settings.dist.py checksum, how often are unit tests run?

@kiblik
Copy link
Contributor

kiblik commented Aug 28, 2024

@mtesauro, can you enable tests for this PR, please?

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

Copy link
Contributor

github-actions bot commented Sep 6, 2024

This pull request has conflicts, please resolve those before we can evaluate the pull request.

@arivra arivra changed the base branch from dev to bugfix September 6, 2024 11:54
Copy link
Contributor

github-actions bot commented Sep 6, 2024

Conflicts have been resolved. A maintainer will review the pull request shortly.

@github-actions github-actions bot removed the helm label Sep 6, 2024
Copy link
Contributor

@damianpr damianpr left a comment

Choose a reason for hiding this comment

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

LGTM

@arivra
Copy link
Contributor Author

arivra commented Sep 6, 2024

Hi

  • @cneill I have solved your comment, could you review it?
  • @mtesauro I have changed the base branch to bugfix as in this PR

Could anyone approve the ruff-linting step?

Thank you!

@Maffooch Maffooch merged commit bbc68db into DefectDojo:bugfix Sep 6, 2024
73 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs parser settings_changes Needs changes to settings.py based on changes in settings.dist.py included in this PR unittests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants