Loading
Check who may manage a merge request on the server
What does this MR do and why?
The manage merge request page offers its actions to approved community members, team members, and the merge request's author, assignees and reviewers.
On the server, the help, label and request_review API actions only checked that the user was signed in, while the issue actions also check membership.
Api::V1::ManageMergeRequestControllerrunsensure_authorizedbefore those three actions. Community and team members pass as before; anyone else passes only if GitLab lists them as the merge request's author, an assignee or a reviewer. Otherwise the action answers403and posts nothing.GET /manage-merge-request/request-helpredirects to the page's Help action instead of posting a thread. Nothing links to it now, but the triage-ops thank-you note did from August 2024 to April 2025, so those links keep working.get_merge_request_web_urlbecomesget_merge_request, which returns the merge request, ornilwhen GitLab does not return it.doc/openapi.yamland the generated types gain the403of the three actions.
Members cost no extra request; for anyone else the check is one GitLab API read.
!2840 (merged) also changes request_help, so whichever merges second rebases.
Closes #815
Screenshots or screen recordings
Nothing changes for the people the page already shows the actions to.
Validation steps
bundle exec rspec spec/requests/api/v1/manage_merge_request_controller_spec.rb spec/requests/manage_merge_request_controller_spec.rb spec/services/gitlab_rest_service_spec.rb- Signed in as a user who is not a member or a participant, the three actions answer
403; as the merge request's author they work as before. /manage-merge-request/request-help?project_id=<id>&merge_request_iid=<iid>opens the page with Help expanded.
Checks run locally
In the CI images (ruby:4.0.9-bookworm, postgres:18.4-alpine3.23, Node 26.13.0):
- On
main, the new examples that expect403get200, andrequest_helpposts a thread; with this change they pass. bundle exec rspec: 2364 examples, 0 failures.bundle exec rubocop: no offenses.bin/generate_api_typesleaves no diff, andnpm run typecheckpasses.