Commit de61f86
Apply object-level permission check to finding duplicate API actions (#14866)
* Apply object-level permission check to finding duplicate API actions
`FindingViewSet.reset_finding_duplicate_status` and
`FindingViewSet.set_finding_as_original` were never calling
`self.get_object()`, so DRF never invoked
`UserHasFindingRelatedObjectPermission.has_object_permission`. The
`has_permission` method on that class always returns `True`, so the
per-finding check was effectively skipped. Sibling actions like `close`,
`verify`, and `remove_tags` already call `self.get_object()` at the top.
Adds `self.get_object()` at the top of both action bodies and regression
tests in `unittests/test_rest_framework.py` (`FindingActionAuthzTest`).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* Update test_finding_reset_duplicate_reader to expect 403
The existing assertion documented the prior bypass behavior (Reader
reaching the internal helper and getting 400). With the object-level
permission check now running on these actions, a Reader is denied
upfront with 403.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* Use versioned fixtures in FindingActionAuthzTest
The sibling `RequestResponsePairsAuthzTest` already uses
`@versioned_fixtures` so the suite picks up `dojo_testdata_locations.json`
when V3_FEATURE_LOCATIONS is enabled. Matching that decorator avoids
the Endpoint-deprecation fixture-load error in the V3 CI variant.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent b50728e commit de61f86
3 files changed
Lines changed: 71 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1546 | 1546 | | |
1547 | 1547 | | |
1548 | 1548 | | |
| 1549 | + | |
1549 | 1550 | | |
1550 | 1551 | | |
1551 | 1552 | | |
| |||
1566 | 1567 | | |
1567 | 1568 | | |
1568 | 1569 | | |
| 1570 | + | |
1569 | 1571 | | |
1570 | 1572 | | |
1571 | 1573 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1571 | 1571 | | |
1572 | 1572 | | |
1573 | 1573 | | |
1574 | | - | |
1575 | | - | |
1576 | | - | |
1577 | | - | |
| 1574 | + | |
| 1575 | + | |
| 1576 | + | |
1578 | 1577 | | |
1579 | 1578 | | |
1580 | | - | |
| 1579 | + | |
1581 | 1580 | | |
1582 | 1581 | | |
1583 | 1582 | | |
1584 | | - | |
1585 | | - | |
| 1583 | + | |
1586 | 1584 | | |
1587 | 1585 | | |
1588 | 1586 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1849 | 1849 | | |
1850 | 1850 | | |
1851 | 1851 | | |
| 1852 | + | |
| 1853 | + | |
| 1854 | + | |
| 1855 | + | |
| 1856 | + | |
| 1857 | + | |
| 1858 | + | |
| 1859 | + | |
| 1860 | + | |
| 1861 | + | |
| 1862 | + | |
| 1863 | + | |
| 1864 | + | |
| 1865 | + | |
| 1866 | + | |
| 1867 | + | |
| 1868 | + | |
| 1869 | + | |
| 1870 | + | |
| 1871 | + | |
| 1872 | + | |
| 1873 | + | |
| 1874 | + | |
| 1875 | + | |
| 1876 | + | |
| 1877 | + | |
| 1878 | + | |
| 1879 | + | |
| 1880 | + | |
| 1881 | + | |
| 1882 | + | |
| 1883 | + | |
| 1884 | + | |
| 1885 | + | |
| 1886 | + | |
| 1887 | + | |
| 1888 | + | |
| 1889 | + | |
| 1890 | + | |
| 1891 | + | |
| 1892 | + | |
| 1893 | + | |
| 1894 | + | |
| 1895 | + | |
| 1896 | + | |
| 1897 | + | |
| 1898 | + | |
| 1899 | + | |
| 1900 | + | |
| 1901 | + | |
| 1902 | + | |
| 1903 | + | |
| 1904 | + | |
| 1905 | + | |
| 1906 | + | |
| 1907 | + | |
| 1908 | + | |
| 1909 | + | |
| 1910 | + | |
| 1911 | + | |
| 1912 | + | |
| 1913 | + | |
| 1914 | + | |
| 1915 | + | |
1852 | 1916 | | |
1853 | 1917 | | |
1854 | 1918 | | |
| |||
0 commit comments