From 8a101ef9be5cfaaa9d9703e4ccdda9106416c362 Mon Sep 17 00:00:00 2001 From: Dnyaneshwari Date: Tue, 24 Sep 2024 11:53:01 +0530 Subject: [PATCH] mgr/dashboard: Forbid snapshot name "." and any containing "/". Fixes: https://tracker.ceph.com/issues/68198 Signed-off-by: Dnyaneshwari Talwekar --- .../rbd-snapshot-form/rbd-snapshot-form-modal.component.html | 3 +++ .../rbd-snapshot-form/rbd-snapshot-form-modal.component.ts | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) 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 1b160b18130a0..ba55c9f2a4dab 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 00f84fcc860d4..0247a5c61f4d6 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, {}) }); -- 2.39.5