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

Importers: Force tags to lowercase #11221

Merged
merged 1 commit into from
Nov 11, 2024
Merged

Conversation

Maffooch
Copy link
Contributor

@Maffooch Maffooch commented Nov 8, 2024

When adding tags on a model object through the UI or API, the tag is forced to lowercase. Here is an example of the finding model with this requirement:

tags = TagField(blank=True, force_lowercase=True, help_text=_("Add tags that help describe this finding. Choose from the list or add new tags. Press Enter key to add."))

The issue is that when doing imports, something is bypassed in the way that tags are being added to the model. They are being added like any other many to may relationship, but the force_lowercase flag is not being respected for some reason. Instead, we can just force the tags to be lowercased ourselves when the importer processes the tags

[sc-8280]

@Maffooch Maffooch added the bugfix label Nov 8, 2024
Copy link

dryrunsecurity bot commented Nov 8, 2024

DryRun Security Summary

The code change in the dojo/importers/options.py file focuses on the validate_tags function, which now converts all tags to lowercase before returning the validated list, a positive improvement for application security by ensuring consistent and case-insensitive handling of findings.

Expand for full summary

Summary:

The code change in the dojo/importers/options.py file is focused on the validate_tags function, which is responsible for validating the tags field in the ImporterOptions class. The primary change is the addition of a new line that forces all tags to be converted to lowercase before returning the validated list of tags.

This change is a positive improvement from an application security perspective, as it ensures that the tags are standardized and consistent, which can help with the organization and management of findings. Ensuring that all tags are in lowercase can help prevent issues related to case-sensitivity, such as duplicate tags or difficulty in searching and filtering findings. Additionally, the conversion to lowercase can help mitigate potential security issues related to case-sensitive input handling, making the application more robust against potential attacks that attempt to exploit case-sensitive vulnerabilities.

Files Changed:

  • dojo/importers/options.py: The changes in this file are related to the validate_tags function, which is responsible for validating the tags field in the ImporterOptions class. The main change is the addition of a new line that forces all tags to be converted to lowercase before returning the validated list of tags. This change is a positive improvement from an application security perspective, as it enhances the consistency and reliability of the data handling within the application.

Code Analysis

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

@mtesauro mtesauro merged commit c5c1052 into DefectDojo:bugfix Nov 11, 2024
72 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants