Backport of 'Add write option for Repositories in job token fine-grained permissions' to 19.0
What does this MR do and why?
Cherry-picks !236612 (merged) (merge commit 33a5f044) into 19-0-stable-ee.
The 19.0 release post (gitlab-19-0-released.md, section "Cross-project pushes using CI/CD job tokens") announced this feature and instructs Self-Managed admins to enable the allow_push_to_allowlisted_projects feature flag. However, on 19.0 the allowlist UI is missing the Repositories: Read and write (POLICY_ADMIN_REPOSITORIES) option, which is the only way to grant the admin_repositories policy that a cross-project push requires. Admins who follow the release-post instructions today must drop down to the GraphQL API to grant the policy.
This backport restores the documented UX path on 19.0.
Risk: Very low. Frontend-only, constants + test mock only (2 files, 10 additions). The added option is inert without the FF (which is default: off on Self-Managed and gated by three other independent project-level settings).
A follow-up backport will gate the new option behind glFeatures.allowPushToAllowlistedProjects on 19.0; see the "Follow-up" section below.
Follow-up: A separate MR on master (TBD) will gate the affected token-access UI bits (policies_selector.vue and the cross-project push checkbox in token_permissions.vue) behind the allow_push_to_allowlisted_projects frontend feature flag. Once merged + deployed, it will be cherry-picked into 19-0-stable-ee so the 19.0 UI exposure matches the FF state.
References:
- Original MR (master): !236612 (merged)
- Backend implementation: !229671 (merged)
- Original frontend (cross-project push checkbox, already in 19.0): !232351 (merged)
- Feature issue: #479907 (closed)
- Rollout issue: #597258 (closed)
Database: No DB changes.
How to set up and validate locally:
- On a 19.0 worktree with the FF enabled (
Feature.enable(:allow_push_to_allowlisted_projects)in rails console), navigate to Settings > CI/CD > Token Access on a project. - Add a source project to the inbound allowlist with fine-grained permissions.
- Confirm the Repositories dropdown shows three options: None, Read, Read and write (previously only None and Read).
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
- This MR is backporting a bug fix, documentation update, or spec fix, previously merged in the default branch.
- The MR that fixed the bug on the default branch has been deployed to GitLab.com (not applicable for documentation or spec changes).
- The MR title is descriptive (e.g. "Backport of 'title of default branch MR'"). This is important, since the title will be copied to the patch blog post.
- Required labels have been applied to this merge request
- severity label and bug subtype labels (if applicable)
- If this MR fixes a bug that affects customers, the customer label has been applied.
- This MR has been approved by a maintainer (only one approval is required).
- Ensure the
e2e:test-on-omnibus-eejob has succeeded, or if it has failed, investigate the failures. If you determine the failures are unrelated, you may proceed. If you need assistance investigating, reach out to a Software Engineer in Test in #s_developer_experience.
Note to the merge request author and maintainer
If you have questions about the patch release process, please:
- Refer to the patch release runbook for engineers and maintainers for guidance.
- Ask questions on the
#releasesSlack channel (internal only). - Once the backport has been merged, the commit changes will be automatically deployed to a release environment that can be used for manual validation. See after merging runbook for details.