From: Dnyaneshwari Date: Tue, 24 Sep 2024 06:23:01 +0000 (+0530) Subject: mgr/dashboard: Forbid snapshot name "." and any containing "/". X-Git-Tag: v20.0.0~964^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F59946%2Fhead;p=ceph.git mgr/dashboard: Forbid snapshot name "." and any containing "/". Fixes: https://tracker.ceph.com/issues/68198 Signed-off-by: Dnyaneshwari Talwekar --- 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 1b160b18130..ba55c9f2a4d 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 @@ -37,6 +37,9 @@ This field is required. + 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 00f84fcc860..0247a5c61f4 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 @@ -53,7 +53,7 @@ export class RbdSnapshotFormModalComponent extends BaseModal implements OnInit { createForm() { this.snapshotForm = new CdFormGroup({ snapshotName: new UntypedFormControl('', { - validators: [Validators.required] + validators: [Validators.required, Validators.pattern(/^(?!\.)[^/@]+$/)] }), mirrorImageSnapshot: new UntypedFormControl(false, {}) });