Fix #10268: Make Finding Group filter context-aware (Test/Engagement/Product)#14271
Fix #10268: Make Finding Group filter context-aware (Test/Engagement/Product)#14271Maffooch merged 3 commits intoDefectDojo:devfrom
Conversation
0198418 to
6fb77ab
Compare
🔴 Risk threshold exceeded.This pull request includes edits to sensitive codepaths in multiple files (dojo/filters.py, dojo/finding/views.py, dojo/test/views.py), which the scanner flagged as potentially sensitive and configurable via .dryrunsecurity.yaml; review and verification of authorship and changes are recommended.
🔴 Configured Codepaths Edit in
|
| Vulnerability | Configured Codepaths Edit |
|---|---|
| Description | Sensitive edits detected for this file. Sensitive file paths and allowed authors can be configured in .dryrunsecurity.yaml. |
🔴 Configured Codepaths Edit in dojo/finding/views.py
| Vulnerability | Configured Codepaths Edit |
|---|---|
| Description | Sensitive edits detected for this file. Sensitive file paths and allowed authors can be configured in .dryrunsecurity.yaml. |
🔴 Configured Codepaths Edit in dojo/test/views.py
| Vulnerability | Configured Codepaths Edit |
|---|---|
| Description | Sensitive edits detected for this file. Sensitive file paths and allowed authors can be configured in .dryrunsecurity.yaml. |
🔴 Configured Codepaths Edit in dojo/filters.py
| Vulnerability | Configured Codepaths Edit |
|---|---|
| Description | Sensitive edits detected for this file. Sensitive file paths and allowed authors can be configured in .dryrunsecurity.yaml. |
We've notified @mtesauro.
All finding details can be found in the DryRun Security Dashboard.
|
I asked Sonnet 4.5, can you check if there's some valid point in there? 1. Missing defensive checks in
|
yes both points are valid, I will update the field deletions to protect against missing fields. I’ll also switch the engagement lookup to a safer pattern to avoid unnecessary queries. |
…lter
- Implemented hierarchical context filtering (test > engagement > product > global)
- Created get_finding_group_queryset_for_context() helper function to eliminate code duplication
- Modified FindingFilter and FindingFilterWithoutObjectLookups to accept eid/tid parameters
- Updated filter to show only Finding Groups from current test/engagement/product context
- Added query optimization with .only("id", "name") for Finding Groups
- Fixed user parameter passing to get_authorized_finding_groups_for_queryset()
- Updated finding/views.py and test/views.py to pass context parameters to filters
- Created comprehensive unit tests (8 test methods) covering all context levels
This ensures users only see relevant Finding Groups in the filter dropdown based on
their current page context, preventing confusion from seeing unrelated groups.
Use DojoTestCase instead of plain TestCase to align with DefectDojo testing conventions and ensure proper test setup/teardown.
6fb77ab to
da8f604
Compare
|
Both changes are done as requested, let me know if any other changes are required. |
valentijnscholten
left a comment
There was a problem hiding this comment.
did some manual testing also and looks good to me
thanks for the review, it seems 2 more approvals are required from other maintainers. |
We're all in different timezones so approvals can be scatterd |
Description
Fixes #10268 — the Finding Group filter displayed groups from unrelated Tests or Engagements when viewing findings within a specific context.
This PR makes the Finding Group filter context-aware so that the dropdown only shows relevant groups:
Implementation details
Test results
Added unit tests in dojo/unittests/test_finding_group_filter_context.py covering:
All tests pass locally.
Documentation
No documentation updates required. This change corrects filter behavior without altering user workflows or APIs.
Checklist
dev.