Skip to content

fix(locations): name the endpoint by the id /api/v2/endpoints/ lists in /api/v2/endpoint_status/ - #16409

Merged
blakeaowens merged 2 commits into
devfrom
fix/endpoint-status-reference-id
Oct 19, 2026
Merged

blakeaowens merged 2 commits into
devfrom
fix/endpoint-status-reference-id

Conversation

@blakeaowens

Copy link
Copy Markdown
Contributor

Description

With Locations enabled, /api/v2/endpoints/ lists Asset References of URL Locations: a row's id is the reference's id, and location_id names the Location. /api/v2/endpoint_status/ should point at those same ids, and its ?endpoint= filter did, but its endpoint field returned the Location id instead. The two ids often coincide, so it mostly looked right; where they differ, an id copied from endpoint_status named the wrong endpoint or none.

  • endpoint now carries the reference id /api/v2/endpoints/ lists for the Finding's Asset, read through one authorized subquery in the viewset's queryset instead of one query per row. It is null when the Finding's Asset has no reference to the Location, or the caller cannot view it.
  • ?endpoint=<id> returns only the statuses of Findings on that reference's Asset, as a legacy Endpoint_Status always belonged to its Endpoint's Asset. It used to include Findings on other Assets sharing the URL. An id the caller cannot view matches nothing.
  • Docs: the endpoint field note on the migration page, and an upgrade note for 3.4.300.

Test results

New unittests/test_v3_endpoint_status_reference_id.py (Locations on): a Location referenced by two Assets with padded reference ids, so reference and Location ids differ. It checks that endpoint equals the id /api/v2/endpoints/ lists for each Finding's Asset (list and detail), that ?endpoint= returns only that Asset's status, that an unknown id matches nothing, that a Finding with no reference names no endpoint, and that the list's query count does not grow with rows. Three of the five fail on dev and all five pass with the change. ruff check (ruff 0.16.10, ruff.toml) is clean on the changed files.

…in /api/v2/endpoint_status/

The endpoint field returned the Location id while the ?endpoint= filter
read a reference id; it now returns the reference id for the finding's
product, from one authorized subquery instead of a query per row. The
filter matches only that product's findings, as an Endpoint_Status
always belonged to its endpoint's product.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The first request warms per-request caches, so comparing it with a
later one counted the warm-up, not the rows. The test now warms up
first and names any query that grows with rows. location_id is read
from the column, so a row's Location is never loaded just for its id.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@blakeaowens
blakeaowens added this pull request to the merge queue Oct 19, 2026
Merged via the queue into dev with commit 492e198 Oct 19, 2026
50 checks passed
@blakeaowens
blakeaowens deleted the fix/endpoint-status-reference-id branch October 19, 2026 07:45
@Maffooch Maffooch modified the milestones: 3.4.300, 3.4.200 Oct 19, 2026
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.

3 participants