Repository navigation
fix(findings-api): honor ?engagement=, ?product= and ?prod_type= on /api/v2/findings/ - #16644
Merged
Merged
Conversation
…api/v2/findings/ A Finding has no engagement, product or prod_type field and ApiFindingFilter declared no filter by those names, so django-filter dropped the parameters and the list answered with every finding the caller could see. Declare them as short names for the test__engagement, test__engagement__product and test__engagement__product__prod_type filters, and document them on the Findings pages. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
Author
Adversarial review: full tierVerdict: changes requested, no blockers. The filter change is correct and does not widen what a caller can see. Two I posted no approval and did not merge. CI (read, not re-run)All 49 checks pass, the unit tests included, so the new What I verified
Findings
Not coveredI did not drive the endpoint against a running instance or a production-sized database. The performance figures come from a synthetic schema that has only the join columns. 🤖 Generated with Claude Code |
…ct member; note the change in the 3.5 upgrade page Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
Author
Review findings: resolution
|
blakeaowens
approved these changes
Oct 30, 2026
devGregA
approved these changes
Oct 30, 2026
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.
Description
GET /api/v2/findings/?engagement=<id>was not a filter. A Finding has noengagementfield andApiFindingFilterdeclared no filter by that name (onlytest__engagement), so django-filter dropped the parameter without an error and the list answered with every finding the caller could see. A request shaped?engagement=<id>&limit=200therefore paged through the whole visible set instead of one engagement.?product=and?prod_type=had the same problem.This declares
engagement,productandprod_typeonApiFindingFilteras short names fortest__engagement,test__engagement__productandtest__engagement__product__prod_type: the sameNumberInFilteron the same path, so each takes a comma-separated list of ids, ORs within the parameter, ANDs with every other filter, and rejects a non-integer with the same 400 as the long form. The filters narrow the queryset the view has already authorized, so nobody sees more than before. A query parameter that is not a filter is still ignored, as before.The English Findings pages (OS and Pro) now mention the three parameters, and the 3.5.x upgrade page describes the behavior change for clients that already send them.
Test results
New
unittests/test_api_finding_relation_filters.py(9 tests): the three names are declared on the long-form fields, each narrows to the right findings, each matches its long form, comma-separated lists, combination withseverityand with each other, non-integer values are invalid, and an API list withlimit/offsetreports the scopedcountand pages while an unknown parameter is still ignored, and a Reader on one product who asks for another product's engagement, product or product type gets an empty page withcount0. Without the filter change 11 assertions fail; with it, all 9 tests pass (python manage.py test unittests.test_api_finding_relation_filters).ruff check(0.16.10) is clean on the changed files.Documentation
docs/content/asset_modelling/engagements_tests/OS__findings.mdandPRO__findings.md(English), anddocs/content/releases/os_upgrading/3.5.md.