From: Dnyaneshwari Date: Tue, 24 Sep 2024 06:23:01 +0000 (+0530) Subject: reef: mgr/dashboard: Forbid snapshot name "." and any containing "/". X-Git-Tag: v18.2.5~378^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F59994%2Fhead;p=ceph.git reef: mgr/dashboard: Forbid snapshot name "." and any containing "/". Fixes: https://tracker.ceph.com/issues/68198 Signed-off-by: Dnyaneshwari Talwekar (cherry picked from commit 8a101ef9be5cfaaa9d9703e4ccdda9106416c362) Conflicts: src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-snapshot-form/rbd-snapshot-form-modal.component.html --- diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-snapshot-form/rbd-snapshot-form-modal.component.html b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-snapshot-form/rbd-snapshot-form-modal.component.html index e84ecab695a..a42ecf1e021 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-snapshot-form/rbd-snapshot-form-modal.component.html +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-snapshot-form/rbd-snapshot-form-modal.component.html @@ -27,6 +27,9 @@ i18n>This field is required. Snapshot mode is enabled on image {{ imageName }}: snapshot names are auto generated + The snapshot name cannot start with "." and cannot contain "/" and "@". diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-snapshot-form/rbd-snapshot-form-modal.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-snapshot-form/rbd-snapshot-form-modal.component.ts index a9fb074261e..3c455565b6c 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-snapshot-form/rbd-snapshot-form-modal.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-snapshot-form/rbd-snapshot-form-modal.component.ts @@ -51,7 +51,7 @@ export class RbdSnapshotFormModalComponent implements OnInit { createForm() { this.snapshotForm = new CdFormGroup({ snapshotName: new UntypedFormControl('', { - validators: [Validators.required] + validators: [Validators.required, Validators.pattern(/^(?!\.)[^/@]+$/)] }), mirrorImageSnapshot: new UntypedFormControl(false, {}) });