Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Generic Parser: Support Test Type Meta #12348

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

Merged
merged 3 commits into from
Apr 30, 2025

Conversation

Maffooch
Copy link
Contributor

Generic Finding Import is capable of importing data from the report that influences the name of the test type and some other fields on the test. This behavior could be expanded to also influence the static_tool and dynamic_tool fields as well.

The following things were added to accomplish this:

  • Expand the ParserTest class to accommodate the new fields
  • Rework the dynamic test parser in the importers to allow for fields to be set during import, and overwritten during reimport if fields are supplied
  • Unit tests at the parser and import/reimport level to cover to above
  • Docs to explain how these fields are used

[sc-11026]

@Maffooch Maffooch marked this pull request as ready for review April 30, 2025 01:38
@Maffooch Maffooch requested a review from mtesauro as a code owner April 30, 2025 01:38
Copy link

dryrunsecurity bot commented Apr 30, 2025

DryRun Security

This pull request reveals multiple security concerns including potential metadata injection risks, dynamic code loading vulnerabilities, expanded attack surfaces through flexible input handling, disabled SSL redirects, and insecure token-based authentication practices that could compromise the application's security if not addressed.

💭 Unconfirmed Findings (5)
Vulnerability Potential Metadata Injection Risk
Description In dojo/importers/base_importer.py, new methods update_test_from_internal_test and update_test_type_from_internal_test directly set test and test type attributes from parser-provided metadata without explicit validation. This could allow an attacker to manipulate test metadata if the parser is compromised.
Vulnerability Potential Dynamic Code Loading Risk
Description In dojo/tools/parser_test.py, dynamic module loading via importlib based on settings configuration could potentially allow loading of arbitrary classes if PARSER_TEST_CLASS_PATH is not strictly controlled, leading to potential code execution if settings are manipulated.
Vulnerability Expanded Attack Surface via Kwargs
Description In dojo/tools/parser_test.py, switching to using *args and **kwargs increases the potential attack surface by allowing more flexible and potentially unvalidated input during class initialization.
Vulnerability Disabled SSL Redirect
Description In unittests/test_generic_meta_import.py, settings.SECURE_SSL_REDIRECT is set to False, which could bypass TLS/SSL security redirects during testing and should not be used in production.
Vulnerability Token-based Authentication Exposure
Description In unittests/test_generic_meta_import.py, hardcoded admin user token for authentication demonstrates the use of static authentication credentials, which could be a security anti-pattern if adopted in production.

All finding details can be found in the DryRun Security 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

@kiblik
Copy link
Contributor

kiblik commented Apr 30, 2025

It looks that this PR allow to change test name (in update_test_from_internal_test). But it does nothing with test type.
Am I reading this correctly?
So #10219 would still be in place. Is there any chance to solve it as well?

@Maffooch
Copy link
Contributor Author

@kiblik good catch! Overwriting the name was actually not supported before this PR, so it is would be best to maintain that in this PR.

As for the test type name not being overwritten, I have some thoughts that I will share on the issue to keep things all in the same placee

@Maffooch Maffooch added this to the 2.46.0 milestone Apr 30, 2025
@Maffooch Maffooch merged commit 9636c1e into DefectDojo:bugfix Apr 30, 2025
78 checks passed
@Maffooch Maffooch deleted the generic-parser-meta-fields branch April 30, 2025 21:58
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.

6 participants