Skip to content

Commit 8a101ef

Browse files
author
Dnyaneshwari
committed
mgr/dashboard: Forbid snapshot name "." and any containing "/".
Fixes: https://tracker.ceph.com/issues/68198 Signed-off-by: Dnyaneshwari Talwekar <[email protected]>
1 parent bd51dcf commit 8a101ef

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-snapshot-form/rbd-snapshot-form-modal.component.html

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@
3737
<span *ngIf="snapshotForm.showError('snapshotName', formDir, 'required')"
3838
class="invalid-feedback"
3939
i18n>This field is required.</span>
40+
<span *ngIf="snapshotForm.showError('snapshotName', formDir, 'pattern')"
41+
class="invalid-feedback"
42+
i18n>The snapshot name cannot start with "." and cannot contain "/" and "@".</span>
4043
</ng-template>
4144
</div>
4245

src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-snapshot-form/rbd-snapshot-form-modal.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ export class RbdSnapshotFormModalComponent extends BaseModal implements OnInit {
5353
createForm() {
5454
this.snapshotForm = new CdFormGroup({
5555
snapshotName: new UntypedFormControl('', {
56-
validators: [Validators.required]
56+
validators: [Validators.required, Validators.pattern(/^(?!\.)[^/@]+$/)]
5757
}),
5858
mirrorImageSnapshot: new UntypedFormControl(false, {})
5959
});

0 commit comments

Comments
 (0)