Skip to content

security: require admin for repo settings API endpoints - #8327

Merged
unknwon merged 2 commits into
mainfrom
ghsa-268j-37xf-pp52
Jun 6, 2026
Merged

unknwon merged 2 commits into
mainfrom
ghsa-268j-37xf-pp52

Conversation

@unknwon

@unknwon unknwon commented Jun 6, 2026

Copy link
Copy Markdown
Member

Summary

  • The PATCH /api/v1/repos/:owner/:repo/issue-tracker, PATCH /api/v1/repos/:owner/:repo/wiki, and POST /api/v1/repos/:owner/:repo/mirror-sync endpoints were gated by reqRepoWriter(), while the equivalent web UI operations require repo admin. This allowed write-level collaborators to mutate admin-only settings via the API.
  • All three endpoints now use reqRepoAdmin(), matching the web UI's authorization policy.

Reference: GHSA-268j-37xf-pp52

Test plan

  • moon run gogs:lint
  • moon run gogs:build
  • Verify a write-level collaborator receives 403 on the three endpoints.
  • Verify a repo admin can still call all three endpoints.

The issue-tracker, wiki, and mirror-sync API endpoints were gated by
reqRepoWriter(), letting write-level collaborators flip settings that
the web UI restricts to repo admins. Align the API with the UI by
switching all three to reqRepoAdmin().
@unknwon unknwon added this to the 0.14.3 milestone Jun 6, 2026
@unknwon
unknwon merged commit 6283462 into main Jun 6, 2026
8 checks passed
@unknwon
unknwon deleted the ghsa-268j-37xf-pp52 branch June 6, 2026 03:21
unknwon added a commit that referenced this pull request Jun 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant