Uploaded image for project: 'Bitbucket Server'
  1. Bitbucket Server
  2. BSERV-10928

Branch permission pattern with backslash break the settings

    XMLWordPrintable

    Details

      Description

      Summary

      If branch permission with backslash ( \ ) is mistakenly created, none of the existing branch permissions in the repository or project can be edited anymore.

      Steps to Reproduce

      1. Create a few branch permissions in the repository or project
      2. Create a branch permission with pattern "release\" (backslash instead forward slash)
      3. Save the setting
        It will take some time for the page to reload
      4. Try to create a new or edit other branch permissions

      Expected Results

      1. The incorrect branch permission with the pattern "release\" will not be saved
      2. Can create and edit other branch permissions

      Actual Results

      1. The incorrect branch permission with the pattern "release\" does not appear in the list but the database table "AO_6978BB_RESTRICTED_REF" have this setting
      2. Can't create and edit other branch permissions
      3. The below exception is thrown in the browser Console:
        Uncaught Error: Syntax error, unrecognized expression: tbody[data-branch-value="release\"][data-branch-type="PATTERN"][data-effective-scope-type="REPOSITORY"]
        

      Workaround

      1. Retrieve branch permissions via REST to find the ID (should be a number) of the offending permission:
        curl -v -H "Accept:application/json" <USERNAME>:<PASSWORD>@<INSTANCE_URL>/rest/branch-permissions/latest/projects/<PROJECT_KEY>/repos/<REPO_SLUG>/restrictions/

        If you have Python installed you can append the following to this command to make the output more readable:

        | python -m json.tool
      2. Delete the offending permission via REST:
        curl -v -X DELETE <USERNAME>:<PASSWORD>@<INSTANCE_URL>/rest/branch-permissions/latest/projects/<PROJECT_KEY>/repos/<REPO_SLUG>/restrictions/<PERMISSION_ID>
        
      3. Verify the permission has been deleted by repeating step 1.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              istephens Isabella Stephens
              Reporter:
              klfoong Kah Loun Foong
              Votes:
              1 Vote for this issue
              Watchers:
              7 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: