Bug 2314223 - Ceph dashboard allows snapshot names containing "/" character
Summary: Ceph dashboard allows snapshot names containing "/" character
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Ceph Storage
Classification: Red Hat Storage
Component: Ceph-Dashboard
Version: 8.0
Hardware: Unspecified
OS: Unspecified
unspecified
medium
Target Milestone: ---
: 8.0
Assignee: dtalweka
QA Contact: Sunil Angadi
Anjana Suparna Sriram
URL:
Whiteboard:
Depends On:
Blocks: 2317218
TreeView+ depends on / blocked
 
Reported: 2024-09-23 14:14 UTC by Imran Imtiaz
Modified: 2024-11-25 09:12 UTC (History)
10 users (show)

Fixed In Version: ceph-19.2.0-5.el9cp
Doc Type: Bug Fix
Doc Text:
Cause: Dashboard was allowing "/" in its snapshot name. Consequence: As a result, user was able to enter snapshot name containing "/'" in it. Fix: With the fix, the snapshot name cannot start with "." and cannot contain "/" and "@". Result: Snapshot name cannot start with "." and cannot contain "/" and "@".
Clone Of:
Environment:
Last Closed: 2024-11-25 09:12:09 UTC
Embargoed:
sangadi: needinfo+


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Issue Tracker RHCEPH-9923 0 None None None 2024-10-07 07:33:04 UTC
Red Hat Issue Tracker RHCSDASH-1654 0 None None None 2024-10-07 07:33:09 UTC
Red Hat Product Errata RHBA-2024:10216 0 None None None 2024-11-25 09:12:14 UTC

Description Imran Imtiaz 2024-09-23 14:14:38 UTC
Description of problem:

Ceph Dashboard allows creation of snapshot that contains "/" in the name, however, it's not possible to create such an object using the Ceph CLI e.g. 

[ceph: root@ceph-plugin-4a /]# rbd snap create vsp-rbd/test3@hello/world
rbd: invalid spec 'vsp-rbd/test3@hello/world'
[ceph: root@ceph-plugin-4a /]#

Version-Release number of selected component (if applicable): 8.0


How reproducible: Can be easily reproduced.


Steps to Reproduce:

1. Use the dashboard and create a snapshot with snapshot name containing "/".
2. Verify that the object is created.
3. Now try the same via the "rbd" CLI and it'll give the following error: rbd: invalid spec 

Actual results:

Dashboard allows names with "/".

Expected results:

The dashboard allows "/" in snapshot name but the same is not possible via the CLI in a default setup. It seems that the dashboard is setting some extra options before invoking the "rbd" command which then bypasses the naming checks.

The code for the rbd CLI suggests that validation should match the following and it seems the dashboard is enabling the spec criteria that's set to "SPEC_VALIDATION_NONE":

int extract_spec(const std::string &spec, std::string *pool_name,
                 std::string *namespace_name, std::string *name,
                 std::string *snap_name, SpecValidation spec_validation) {
  if (!g_ceph_context->_conf.get_val<bool>("rbd_validate_names")) {
    spec_validation = SPEC_VALIDATION_NONE;
  }

  std::regex pattern;
  switch (spec_validation) {
  case SPEC_VALIDATION_FULL:
    // disallow "/" and "@" in all names
    pattern = "^(?:([^/@]+)/(?:([^/@]+)/)?)?([^/@]+)(?:@([^/@]+))?$";
    break;
  case SPEC_VALIDATION_SNAP:
    // disallow "/" and "@" in snap name
    pattern = "^(?:([^/]+)/(?:([^/@]+)/)?)?([^@]+)(?:@([^/@]+))?$";
    break;
  case SPEC_VALIDATION_NONE:
    // relaxed pattern assumes pool is before first "/",
    // namespace is before second "/", and snap name is after first "@"
    pattern = "^(?:([^/]+)/(?:([^/@]+)/)?)?([^@]+)(?:@(.+))?$";
    break;
  default:
    ceph_abort();
    break;
  }



Additional info:

Comment 1 Storage PM bot 2024-09-23 14:14:50 UTC
Please specify the severity of this bug. Severity is defined here:
https://bugzilla.redhat.com/page.cgi?id=fields.html#bug_severity.

Comment 11 errata-xmlrpc 2024-11-25 09:12:09 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (Red Hat Ceph Storage 8.0 security, bug fix, and enhancement updates), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2024:10216


Note You need to log in before you can comment on or make changes to this bug.