Allow Update secrets permission without Create

What does this MR do and why?

Lets Owners grant the Update secrets permission without also granting Create. A new update permission action maps to OpenBao update on the data and metadata paths, and the permissions modal no longer ties the Update checkbox to Create.

This MR also moves the Delete secrets permission to the bottom of the permissions modal UI.

🤖 Justification

  • Before this change, an update-only grant was deliberately not representable: write meant create + update, and the modal disabled Update unless Create was checked.
  • The update flow needs only update on the data path and update on the metadata path. UpdateService already reads metadata with write_capability: update (added in !264890 (merged)), so no read grant is needed.
  • Backend (BaseSecretsPermission):
    • Adds update to ACTIONS, mapped to data update and metadata update in management_capabilities.
    • actions= collapses create + update into write and drops create/update when write is present, so a readback matches the grant.
    • set_actions_from_capabilities emits write (create + update), create (create only) or update (update only).
  • GraphQL: adds UPDATE to SecretsManagementAction and regenerates doc/api/graphql/reference/enums.md. The legacy permissions string on SecretPermission already passes update through.
  • Frontend:
    • The Update checkbox is enabled whenever Read metadata is checked, and the watcher that cleared it when Create was unchecked is removed.
    • Submitted actions are: create + update => WRITE, update only => UPDATE, create only => CREATE.
    • The permissions table labels an UPDATE grant as "Update". No new locale strings were needed.
  • Docs: services.md, openbao_client.md, the Secrets Manager user doc, and the permissions tables in doc/user/permissions.md.

References

  • Open MRs
    • !260976 (merged) Add UPDATE secrets permission action and deprecate WRITE (open)
    • !260975 (merged) Deprecate WRITE secrets permission action (open, the docs side of the same change)
  • Merged MRs

Screenshots or screen recordings

Before After

How to set up and validate locally

  1. Enable Secrets Manager for a group - or select a project and provision it.
  2. Visit the permissions table.
    1. For groups go to Settings > Secure > GitLab Secrets Manager and select Add under User permissions
    2. For projects go to Settings > General > Visibility, project features, permissions > GitLab Secrets Manager and select Add under User permissions.
  3. Select a Reporter or Developer user and check Read metadata and Read value. Update is now enabled without Create.
  4. Check only Update and save. The table shows "Read metadata, Read value, Update".
  5. Check Create and Update together and save. The table shows "Create, Update" (the WRITE action).
  6. As the update-only user, update an existing secret (this succeeds), then try to create a new secret (this is denied).

🤖 Testing

  • Jest: yarn jest ee/spec/frontend/pages/projects/shared/permissions/secrets_manager ran locally. The modal and table specs pass, along with all other suites in that directory except the failure below.
  • Existing failure: secret_manager_settings_spec.js › "renders skeleton loader" fails identically on a clean master, so it is unrelated to this change.
  • ESLint on the touched JS and Vue files reported only graphql-eslint schema-loading errors on untouched .graphql files, because tmp/tests/graphql/gitlab_schema_apollo.graphql is not generated locally. Prettier passes.
  • RuboCop passes on the touched Ruby files.
  • Not run locally: the RSpec specs (model shared examples, permission update and list services, GraphQL mutation and enum, project and group UpdateService). They need PostgreSQL and OpenBao, which were not available. CI is the first real run of them.
    • A standalone Ruby check of actions=, management_capabilities and set_actions_from_capabilities gave the expected results.
  • Specs added or updated:
    • Model shared examples: update-only now maps to update instead of emitting no write action, plus actions= normalization cases.
    • Permission update service: update-only policy capabilities.
    • Permission list service: update-only readback.
    • GraphQL mutation: update-only grant.
    • GraphQL enum spec: UPDATE value.
    • Project and group UpdateService: a user with update + read_value can update an existing secret but cannot create one.
    • Jest: Update enabled without Create; payloads for update-only, create-only, and create + update.

🤖 Risk

Low. Existing grants are unaffected, and no migration is needed because permissions live in OpenBao policies and are read back from them. The write, create, read and delete mappings are unchanged. The only new behavior is the new update action: a policy with update and no create is now read back as update instead of dropping the write action.

How to revert

Revert this MR. Any update-only policies created in the meantime would then read back with no write action, and affected users would need their permission re-saved.

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 Sayo Bittencourt

Merge request reports

Loading
Loading