Uploaded image for project: 'Couchbase Server'
  1. Couchbase Server
  2. MB-51543

[CBM] [AWS/Azure/GCP] Staging directory population/syncing fails for archives/repos with invalid regex characters (e.g. Windows path separators)

    XMLWordPrintable

Details

    • Triaged
    • 1
    • Yes
    • Tools 2022-March

    Description

      What's the issue?
      The staging/syncing of the cloud staging directory uses regular expressions, some of which are compiled at runtime; at the moment we've got a couple of places which are not (no longer) escaping characters that need to be matched as a fixed string.

      What does this effect?
      1) Populating/syncing the staging directory on Windows (e.g. backup to S3 no longer works on Windows)
      2) Populating/syncing the staging directory where the archive/repo name contains an invalid regex character (this could lead to users being unable to use existing archives)

      What's the fix?
      The fix is simple, we should be using the 'QuoteMeta' function exposed by the standard library; this takes the given string and escapes it so that once compiled as a regular expression, it matches the given string exactly (e.g. results in valid/invalid regular expression characters being treated as their fixed string alternative).

      Steps to reproduce
      1) Try to configure an archive/repo with an invalid regex character

      alternatively

      1) Try to configure an archive/repo on Windows (the path separator is already an invalid character)

      exit status 1: Backup repository `2a3f893b-0ec7-427e-8aad-9a858f7e10c4` created successfully in archive `s3://storage/archive-172.23.136.106`\\nPost sub-command object store task failed: error parsing regexp: invalid escape sequence: `\\\\c`\\n

      Attachments

        Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

              joe.mitchelljones Joe Mitchell Jones
              joe.mitchelljones Joe Mitchell Jones
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes

                  PagerDuty