Commit ae9d47b
refactor(locations): consistent object lookups in endpoint views (#15173)
* refactor(locations): use a shared helper for endpoint view object lookups
The endpoint (Location) views each resolved their object with an ad-hoc
get_object_or_404 (and one Location.objects.get). Route them all through a
single helper that fetches the Location from the standard location queryset,
consistent with the list and host views. Adds regression coverage for the
endpoint view lookups.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* test(locations): assert real cross-product denial status (400) for endpoint views
The cross-product tests asserted 404, but these views are guarded by the
AuthorizationMiddleware object check (URL_PERMISSIONS -> (object, Location, ...)),
and DefectDojo renders PermissionDenied via custom_unauthorized_view as HTTP 400
app-wide. Assert the actual denial status so the suite passes under
V3_FEATURE_LOCATIONS; the view-level get_authorized_locations lookup remains as
defense-in-depth. Security property (deny + object unchanged) is unchanged.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Co-authored-by: Cody Maffucci <46459665+Maffooch@users.noreply.github.com>1 parent 73b9a68 commit ae9d47b
2 files changed
Lines changed: 111 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
43 | 43 | | |
44 | 44 | | |
45 | 45 | | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
46 | 60 | | |
47 | 61 | | |
48 | 62 | | |
| |||
95 | 109 | | |
96 | 110 | | |
97 | 111 | | |
98 | | - | |
| 112 | + | |
99 | 113 | | |
100 | 114 | | |
101 | 115 | | |
| |||
288 | 302 | | |
289 | 303 | | |
290 | 304 | | |
291 | | - | |
| 305 | + | |
292 | 306 | | |
293 | 307 | | |
294 | 308 | | |
| |||
366 | 380 | | |
367 | 381 | | |
368 | 382 | | |
369 | | - | |
| 383 | + | |
370 | 384 | | |
371 | 385 | | |
372 | 386 | | |
| |||
399 | 413 | | |
400 | 414 | | |
401 | 415 | | |
402 | | - | |
| 416 | + | |
403 | 417 | | |
404 | 418 | | |
405 | 419 | | |
| |||
624 | 638 | | |
625 | 639 | | |
626 | 640 | | |
627 | | - | |
| 641 | + | |
628 | 642 | | |
629 | 643 | | |
630 | 644 | | |
631 | 645 | | |
632 | | - | |
| 646 | + | |
633 | 647 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
0 commit comments