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

Risk Acceptance: Make API set/unset risk acceptance status #10320

Merged
merged 5 commits into from
Jun 3, 2024

Conversation

Maffooch
Copy link
Contributor

@Maffooch Maffooch commented Jun 3, 2024

When creating/updating/deleting a risk acceptance, the status of the finding is not set/unset even though the finding is added to the risk acceptance object.

[sc-6143]

@Maffooch Maffooch added the bugfix label Jun 3, 2024
@github-actions github-actions bot added the apiv2 label Jun 3, 2024
Copy link

dryrunsecurity bot commented Jun 3, 2024

Hi there 👋, @DryRunSecurity here, below is a summary of our analysis and findings.

DryRun Security Status Findings
Configured Codepaths Analyzer 0 findings
Sensitive Files Analyzer 0 findings
AppSec Analyzer 0 findings
Authn/Authz Analyzer 3 findings
Secrets Analyzer 0 findings

Note

🟢 Risk threshold not exceeded.

Change Summary (click to expand)

The following is a summary of changes in this pull request made by me, your security buddy 🤖. Note that this summary is auto-generated and not meant to be a definitive list of security issues but rather a helpful summary from a security perspective.

Summary:

The code changes in this pull request are focused on improving the handling of risk acceptance functionality in the application. The key changes include:

  1. Ensuring that when a risk acceptance is deleted, any findings associated with it are also properly removed. This helps maintain the integrity of the application's data and prevents potential security issues that could arise from orphaned findings.

  2. Overriding the create and update methods in the RiskAcceptanceSerializer class to handle the addition and removal of findings associated with a risk acceptance instance. This ensures that the risk acceptance process is applied consistently and that findings from different engagements are not mixed, which could potentially lead to security issues.

  3. Introducing a new validation check in the validate method of the RiskAcceptanceSerializer class. This check ensures that the findings associated with a risk acceptance instance belong to the same engagement, preventing the mixing of findings from different engagements.

Overall, these changes appear to be a reasonable improvement to the application's security and risk management capabilities, as they help maintain the integrity and consistency of the application's data related to risk acceptance.

Files Changed:

  • dojo/api_v2/views.py: The changes in this file are related to the RiskAcceptanceViewSet class. The main change is the addition of a destroy method that handles the deletion of a risk acceptance. When a risk acceptance is deleted, the code first removes any findings that are associated with that risk acceptance, and then proceeds to delete the risk acceptance object itself. This ensures that the integrity of the application's data is maintained.

  • dojo/api_v2/serializers.py: The changes in this file are related to the RiskAcceptanceSerializer class. The key changes include overriding the create and update methods to handle the addition and removal of findings associated with a risk acceptance instance, as well as introducing a new validation check to ensure that the findings associated with a risk acceptance instance belong to the same engagement.

Powered by DryRun Security

Copy link
Contributor

@cneill cneill left a comment

Choose a reason for hiding this comment

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

Just a minor comment/question on this exception message, otherwise looks good

Maffooch and others added 2 commits June 3, 2024 12:14
Co-authored-by: Charles Neill <1749665+cneill@users.noreply.github.com>
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
Copy link
Contributor Author

Maffooch commented Jun 3, 2024

Tests have gotten stuck. Closing and reopening to trigger again

@Maffooch Maffooch closed this Jun 3, 2024
@Maffooch Maffooch reopened this Jun 3, 2024
@Maffooch
Copy link
Contributor Author

Maffooch commented Jun 3, 2024

The settings.dist.py SHA was messed up

@Maffooch Maffooch merged commit ad7e511 into DefectDojo:dev Jun 3, 2024
123 checks passed
@Maffooch Maffooch deleted the ra branch June 3, 2024 18:59
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.

5 participants