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

fix(edit-prod): Add assigned PT to queryset #10843

Merged
merged 1 commit into from
Sep 6, 2024

Conversation

kiblik
Copy link
Contributor

@kiblik kiblik commented Sep 2, 2024

Until now, when a user has no permission to add Prod or edit ProdType (a.k.a get_authorized_product_types(Permissions.Product_Type_Add_Product) is empty) but the same user still has permission to edit product (Maintainer for that specific product), generated edit form for Product contained empty list for Product Types. So user wasn't able to edit this product.

Screenshot 2024-09-02 at 16 36 47

From now on, it does not matter which other permissions a user has, the list of product types contains at least ProdType which is already assigned - so it is possible to submit the form.

Screenshot 2024-09-02 at 16 37 01

Copy link

dryrunsecurity bot commented Sep 2, 2024

DryRun Security Summary

The pull request focuses on improving the functionality and security of the ProductForm class in the dojo application, including updating the prod_type field's queryset and disabling the sla_configuration field when findings are being asynchronously updated.

Expand for full summary

Summary:

The code changes in this pull request focus on improving the functionality and security of the ProductForm class in the dojo application. The key changes include:

  1. Updating the prod_type field's queryset in the __init__ method of the ProductForm class to include the current product type, even if the user does not have permission to view other product types. This ensures that the form can be submitted successfully, as the current product type needs to be selected.

  2. Disabling the sla_configuration field if the product has findings being asynchronously updated. This prevents users from modifying the SLA configuration while the findings are being recalculated, which could lead to inconsistencies or errors.

These changes help to improve the overall stability and reliability of the application by addressing potential issues that could arise due to user permissions or asynchronous data updates. By ensuring that the form can be submitted correctly and that users cannot modify certain fields during critical processes, the changes help to maintain the integrity of the application's data and functionality.

Files Changed:

  • dojo/forms.py: This file contains the ProductForm class, which is responsible for handling the creation and modification of product-related data. The changes in this pull request focus on improving the functionality and security of this form, as described in the summary above.

Code Analysis

We ran 9 analyzers against 1 file and 1 analyzer had findings. 8 analyzers had no findings.

Analyzer Findings
Authn/Authz Analyzer 1 finding

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 8f54596 into DefectDojo:bugfix Sep 6, 2024
73 checks passed
@kiblik kiblik deleted the prod_edit branch September 6, 2024 20:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants