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

Add a filter for Findings for Has Any JIRA (grouped or single) #11313

Merged
merged 4 commits into from
Dec 3, 2024

Conversation

hblankenship
Copy link
Collaborator

[sc-4131]

Added a filter for Has Any JIRA which will filter the findings on having group jira or jira_issue. This will also allow a dashboard tile to exist that shows all findings with any type of JIRA issue.

Copy link

dryrunsecurity bot commented Nov 22, 2024

DryRun Security Summary

The pull request introduces a new filter called FindingHasJIRAFilter in the dojo/filters.py file, which allows users to filter findings based on whether they have a JIRA issue associated with them, and the key points of interest are the potential performance impact, the importance of ensuring proper access control, and the need for a consistent user experience.

Expand for full summary

Summary:

The code changes in this pull request introduce a new filter called FindingHasJIRAFilter to the dojo/filters.py file. This filter allows users to filter findings based on whether they have a JIRA issue associated with them or not. From an application security perspective, this is a useful feature that can help security teams better manage and track their findings.

The key points of interest are the potential performance impact of the new filter, the importance of ensuring proper access control, and the need for a consistent user experience. The code appears to be using the get_authorized_findings function to handle access control, which is a good practice. However, it's important to ensure that the filter is optimized and that the database queries are efficient, especially for large datasets. Additionally, the integration of the new filter should provide a seamless and consistent experience for the users.

Files Changed:

  • dojo/filters.py: This file has been updated to include a new filter called FindingHasJIRAFilter. This filter allows users to filter findings based on whether they have a JIRA issue associated with them or not. The key points of interest from an application security perspective are the potential performance impact, the importance of ensuring proper access control, and the need for a consistent user experience.

Code Analysis

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

View PR in the DryRun Dashboard.

dojo/filters.py Outdated Show resolved Hide resolved
dojo/filters.py Outdated
Comment on lines 245 to 246
def all_items(self, qs, name):
return qs.filter(Q(jira_issue=None) | Q(finding_group__jira_issue=None))
Copy link
Contributor

Choose a reason for hiding this comment

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

This will only return Findings that are either missing jira_issue or missing finding_group__jira_issue. Shouldn't it simply return everything, unfiltered?

Copy link
Contributor

@Maffooch Maffooch Nov 27, 2024

Choose a reason for hiding this comment

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

This function is only called when the input supplied does not match what is expected, and low key sorta fails. I believe the thought process is along the lines of "if something unexpected happens, removing all findings with jira links would be a good indicator". This is just me speculating though. Would need @hblankenship to confirm

On the other side, returning all results (as if the filter was never applied) is a totally valid approach as well

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I apologize for not getting to this earlier. Testing shows that the option returns the same thing not applying the filter returns. The reason it returns them all, despite what it looks like, is because jira_issue is None for finding_group__jira_issue findings and finding_group__jira_issue is None for jira_issue items. I have modified it to just return without filtering to alleviate the confusion.

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

Under the assumption that the pending comment from @cneill is resolved

@Maffooch Maffooch merged commit 6c1d1d6 into bugfix Dec 3, 2024
75 checks passed
@Maffooch Maffooch deleted the hb-jira-any-filter branch December 3, 2024 16:02
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