Replace Write scope with Create and Update in secrets modal

What does this MR do and why?

This MR replaces the Write checkbox with two checkboxes, Create and Update, in the Add user and Add role permissions modal for GitLab Secrets Manager.

  • Create: "Can create new secrets."
  • Update: "Can update secrets. When unselected, users cannot update any secrets, including secrets they have created."

The new order is Read metadata, Read value, Delete, Create, Update. This matches the design.

Update stays disabled until you select Create. If you clear Create, Update is also cleared.

This is the second and last frontend MR for the work item. The first MR changes the permissions table. The two MRs do not depend on each other. Until the first MR merges, the table still shows "Write" for a Create + Update grant.

The MR also changes these files:

  • A Jest spec covers the new rules.
  • The QA page object maps update to the "Update" label. Six QA end-to-end specs now pass create update in place of write.
  • locale/gitlab.pot adds the new strings. It removes the unused string "Can create and update secrets."
  • doc/ci/secrets/secrets_manager/_index.md lists the scopes as read metadata, read value, delete, create, and update. It says that update needs create.

Out of scope: the GraphQL API keeps WRITE. A separate follow-up can change the API if desired.

How the checkboxes map to the API There is no backend change.
  • Create alone sends the existing CREATE action. This action creates secrets only. It was added in !254325 (merged).
  • Create + Update sends CREATE and WRITE.
  • The backend already drops create when write is present. So the result is a WRITE grant, the same as before.
  • The Update checkbox keeps the write data key in the component. A code comment explains this.

References

Screenshots or screen recordings

Step Screenshot
Nothing selected Nothing selected
Read metadata selected: Update stays disabled Update disabled
Create and Update selected Create and Update selected
Create cleared: Update cleared Update cleared
Create-only user: no Edit button No Edit button
Create-only user: edit denied Edit denied
Create + Update user: edit works Edit works

How to set up and validate locally

  1. Use a project with GitLab Secrets Manager enabled.
  2. Sign in as an Owner. Go to Settings > General > Visibility, project features, permissions. Select Add > Users.
  3. Check the order of the checkboxes in the modal. Check that Update stays disabled until you select Create. Check that Update clears when you clear Create.
  4. Grant a Reporter user Read metadata and Create. Sign in as that user and create a secret. This works. Then edit the secret. This is denied with the message "The resource that you are attempting to access does not exist or you don't have permission to perform this action".
  5. Sign in as the Owner. Grant the same user Read metadata, Create, and Update. Sign in as that user and edit the secret again. This works.

Use a Reporter user, not a Maintainer or Developer. The default role grants also apply to those roles.

MR acceptance checklist

Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Chaya Danzinger

Merge request reports

Loading
Loading