Loading
Add live validation and immutability hint to secret name field
What does this MR do and why?
Adds a label description to the secret Name field making it clear the name can't be changed once the secret is created, and validates the name as you type instead of waiting for the server to reject it.
- New label description under "Name": "Secret name cannot be changed after form submission." This replaces the old "should be unique within this project/group…" help text under the input.
- Live validation on the name, shown under the input:
- Empty after the field has been touched: "This field is required."
- More than 255 characters: "Name must be 255 characters or fewer."
- Anything outside
[a-zA-Z0-9_]: "Name can only contain letters, digits, and '_'."
- Submit is blocked while the name is invalid.
SECRET_NAME_REGEXandSECRET_NAME_MAX_LENGTHinee/app/assets/javascripts/ci/secrets/constants.jsmirrorSECRET_NAME_FORMATand the length limit inee/app/models/secrets_management/base_secret.rb, so the client and server agree.- Edit mode is unchanged: the Name field still isn't shown.
- Docs updated to list the name rules and that it can't be changed.
References
- Closes #623923 (closed)
- Design: https://www.figma.com/design/pktcB91wtBIp9g3WYfkCVR/Secrets-Manager?node-id=4186-56001
Screenshots or screen recordings
Project form on GDK at 1280px. The group form is identical apart from the page text.
| Before | After |
|---|---|
![]() |
![]() |
Validation as you type:
| Input | Result |
|---|---|
Invalid characters (my-secret name&) |
![]() |
| 256 characters | ![]() |
| Typed, then cleared | ![]() |
Typing an invalid name, selecting Add secret (nothing is submitted; the name error is the only error on the form), then fixing it:
Notes for reviewers
- The "should be unique within this project/group" hint has been removed, as in the design.
- I've added a trailing period to the label description ("Secret name cannot be changed after form submission."). The Figma copy doesn't have one.
- Both of these need UX sign-off from @sayobittencourt.
How to set up and validate locally
- Make sure you have an Ultimate license and OpenBao running in your GDK (see
doc/howto/openbao.mdin the GDK repo). - Enable the feature flags in a Rails console:
Feature.enable(:secrets_manager) Feature.enable(:group_secrets_manager) Feature.enable(:secrets_manager_instance_enrollment) - Enroll the instance in Admin > Settings > General > GitLab Secrets Manager (
/admin/application_settings/general#js-secrets-manager-instance-enrollment-settings). - As a group Owner, enable Secrets Manager for a group and a project in it, then wait for provisioning to finish.
- Go to
/<group>/<project>/-/secrets/new:- Check the description "Secret name cannot be changed after form submission." sits under the Name label, above the input.
- Type
my-secret name&. The format error appears straight away, without leaving the field. - Paste 256 characters. The length error appears. 255 characters is accepted.
- Type
MY_SECRET_1. No error. - Clear the field. "This field is required." appears.
- Fill in every other field (value, description, environment, branch), then enter an invalid name and select Add secret. Nothing is submitted. Fix the name and submit, and the secret is created.
- Repeat on the group form at
/groups/<group>/-/secrets/new. - Open an existing secret's edit page (
/-/secrets/<name>/edit) and check the Name field isn't there.
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.





