Gate /api/project/{slug}/versions by canViewProject (C-4) #99
No reviewers
Labels
No labels
Compat/Breaking
Kind/Bug
Kind/Documentation
Kind/Enhancement
Kind/Feature
Kind/Security
Kind/Testing
Priority
Critical
Priority
High
Priority
Low
Priority
Medium
Reviewed
Confirmed
Reviewed
Duplicate
Reviewed
Invalid
Reviewed
Won't Fix
Status
Abandoned
Status
Blocked
Status
Need More Info
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
qwc-open/asiakirjat!99
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/api-versions-access-check"
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?
Summary
Workstream item #4. Audit finding C-4 (Critical).
handleAPIVersionsdid no access check and returned the version list — tags, content types, creation timestamps — for any project regardless of visibility, to any caller (including unauthenticated). ContrasthandleAPIProjects(already filtered) andhandleAPISearch(results filtered bycanViewProject).Changes
handleAPIVersionsnow loads the user from context (the route is wrapped inwithSession, so the session-cookie user is available or nil for anonymous) and returns 404 ifcanViewProjectdenies — same status as a missing project so existence isn't leaked.api_versions_access_test.go:Test plan
go test ./...passes/api/project/<private-slug>/versionsfromcurlwithout a cookie, confirm 404FYI: PR #95 (
Honor per-project access on private-visibility projects— the original #94 fix) is still open, not merged. The broader audit assumes it will land — without it, an editor who creates a private project still can't see it (the original #94 symptom). Worth merging alongside.🤖 Generated with Claude Code