Staff user gets 403 retrieving/downloading an object on a project they have no membership in #23
Labels
No labels
breaking
bug
ci
dependencies
documentation
feature
security
skip-changelog
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
thierryade/backend#23
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
HasProjectRole.has_object_permission(apps/orgs/permissions.py, backingCanReadProject/CanWriteProject/CanManageSpace) never special-casesis_staff-- onlyget_queryset()in each viewset does. List/create therefore work fine for staff with noProjectMembership, but any single-object action that goes throughcheck_object_permissions(retrieve, update, delete,PdfExportJobViewSet.download) gets a 403.Reproduced live: staff user
gillescreated PDF export job #6 on project "Bigb" (no membership there, staff only) --POST /api/pdf-export-jobs/succeeded (perform_createhas its own explicitis_staff or ...check), butGET /api/pdf-export-jobs/6/andGET /api/pdf-export-jobs/6/download/both 403'd. Server logs show the same pattern on/api/specs/150/, so this isn't exports-specific -- it affects every model routed throughHasProjectRole(Place/Spec/SpecVersion/SpecTest/Refinement too).CanValidateProject.has_object_permissionhas the identical gap.Fix: add the
is_staffbypass directly to both permission classes'has_object_permission, matching the bypass everyget_queryset()already has.