Scope the report endpoint prefetch to the requesting user's findings - #15435
Open
svader0 wants to merge 4 commits into
Open
Scope the report endpoint prefetch to the requesting user's findings#15435svader0 wants to merge 4 commits into
svader0 wants to merge 4 commits into
Conversation
`prefetch_related_endpoints_for_report` built its prefetched LocationFindingReference queryset from the whole table. Locations are deduplicated across products, so the Location queryset's own authorization check is satisfied by any one associated product, and the findings attached to a shared Location were not reduced to the caller's scope. Filter the prefetched references through `get_authorized_findings`, the same predicate the direct finding routes enforce, and thread the requesting user through the three call sites. `user=None` resolves to the current user and to no findings when there is none, so the change fails closed. The equivalent reduction already exists in the Location branch of `generate_report`; this brings the widget and product report paths in line.
|
This pull request contains critical findings where files in the sensitive
🔴 Configured Sensitive Codepath Modified by Non-Allowed Author in
|
| Vulnerability | Configured Sensitive Codepath Modified by Non-Allowed Author |
|---|---|
| Description | File 'dojo/reports/queries.py' matches configured sensitive codepath pattern 'dojo/reports/*.py' and was modified by 'svader0' (commit 0fd23e8) who is not in the allowed authors list. |
🔴 Configured Sensitive Codepath Modified by Non-Allowed Author in dojo/reports/widgets.py (drs_53237e10)
| Vulnerability | Configured Sensitive Codepath Modified by Non-Allowed Author |
|---|---|
| Description | File 'dojo/reports/widgets.py' matches configured sensitive codepath pattern 'dojo/reports/*.py' and was modified by 'svader0' (commit 0fd23e8) who is not in the allowed authors list. |
We've notified @mtesauro.
Comment to provide feedback on these findings.
Report false positive: @dryrunsecurity fp [FINDING ID] [FEEDBACK]
Report low-impact: @dryrunsecurity nit [FINDING ID] [FEEDBACK]
Example: @dryrunsecurity fp drs_90eda195 This code is not user-facing
All finding details can be found in the DryRun Security Dashboard.
Bare asserts trip ruff S101; unittests/** ignores S105 and S108 but not S101, and the sibling authorization test uses self.assert* throughout.
The fixture granted product access through Product_Member only. Legacy authorization reads authorized_users, so the reader was authorized for nothing and the report rendered none of her own findings. Grant both.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hardening / consistency improvement to report generation. Reduces a prefetched queryset to the requesting user's authorized scope, matching the check the equivalent path in this module already applies, and threads the user through the three call sites. Adds a regression test.
No functional change for correctly-permissioned users: superusers and in-scope members see exactly what they saw before.
The new test only exercises the Locations code path, so it needs a CI run with that feature enabled.