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

Ruff: Add and fix PTH120 #11201

Merged
merged 12 commits into from
Nov 12, 2024
Merged

Ruff: Add and fix PTH120 #11201

merged 12 commits into from
Nov 12, 2024

Conversation

manuel-sommer
Copy link
Contributor

Ruff: Add and fix PTH120

@github-actions github-actions bot added settings_changes Needs changes to settings.py based on changes in settings.dist.py included in this PR unittests integration_tests labels Nov 6, 2024
Copy link

dryrunsecurity bot commented Nov 6, 2024

DryRun Security Summary

This pull request introduces a wide range of improvements to the unit tests for various security-related parsers in the DefectDojo application, with a focus on enhancing the robustness and maintainability of the test suite, which is crucial for ensuring the overall security and reliability of the application.

Expand for full summary

Summary:

The code changes in this pull request cover a wide range of improvements to the unit tests for various security-related parsers in the DefectDojo application. The key focus of these changes is to enhance the robustness and maintainability of the test suite, which is crucial for ensuring the overall security and reliability of the application.

The changes primarily involve updating the file path handling to use the pathlib.Path module instead of the os.path module, which provides a more platform-independent and secure way of working with file paths. Additionally, the test cases have been expanded to cover a broader range of scenarios, including handling edge cases and validating the correct parsing of security scan results.

While the changes do not directly address any specific security vulnerabilities, they contribute to the overall quality and security of the application by improving the testing infrastructure. Comprehensive and well-structured unit tests help catch potential issues early in the development process and ensure that the security-related components of the application are functioning as expected.

Files Changed:

  1. dojo/settings/.settings.dist.py.sha256sum: The SHA256 hash value of the dojo/settings/.settings.dist.py file has been updated, which is a routine change to ensure the integrity of the configuration file.
  2. dojo/management/commands/import_surveys.py: The changes address a potential path traversal vulnerability by using a more secure method to construct the file path to the JSON file containing the initial survey data.
  3. ruff.toml: The changes update the configuration of the Ruff linter, which includes several security-related rules to help identify potential vulnerabilities in the codebase.
  4. dojo/settings/settings.dist.py: The changes improve the security of the Django settings, including updates to the SAML2 configuration, session and CSRF cookie settings, and logging configuration.
  5. tests/Import_scanner_test.py, tests/close_old_findings_dedupe_test.py, tests/close_old_findings_test.py, tests/dedupe_test.py, tests/finding_test.py, tests/ibm_appscan_test.py, tests/file_test.py, unittests/dojo_test_case.py, tests/report_builder_test.py, and various other test files: These changes focus on improving the file path handling and adding more comprehensive unit tests for the security-related functionality of the DefectDojo application.

Code Analysis

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

Copy link
Contributor

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

Copy link
Contributor

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

Copy link
Contributor

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

Copy link
Contributor

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

Copy link
Contributor

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

Copy link
Contributor

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

Copy link
Contributor

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

Copy link
Contributor

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

@manuel-sommer
Copy link
Contributor Author

FYI: the merge conflicts are also resolved here @mtesauro

@mtesauro mtesauro merged commit 9b71a37 into DefectDojo:dev Nov 12, 2024
73 checks passed
@manuel-sommer manuel-sommer deleted the ruffpth120 branch November 13, 2024 04:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
integration_tests 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.

5 participants