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

UI: JS exception if "\." is present in advanced user-to-dn-mapping

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Critical
    • 7.6.0
    • 7.6.0
    • UI
    • Untriaged
    • 0
    • Unknown

    Description

      Bad escaped character in advanced user-to-dn mapping leads to confusing behavior - no error is displayed in UI. Console shows a stacktrace though, but it is not user friendly.

      This could be a very annoying issue because it is very likely that something like "\." will be used in regular expressions (user by mistake uses single backslash instead of double backslash). At the same time it should be super easy to fix. Marking it critical for these two reasons.

      How to reproduce:
      1. Use "\." in advanced user mapping. For example:

      [{"match": "(.+)@domain\.net", "substitution": "cn={0}"}]
      

      2. Press "Test User Authentication"
      3. UI doesn't complain (nothing happens) and stacktrace can be seen in the browser console.

      Stacktrace:

      index-729b989c.js:15574 SyntaxError: Bad escaped character in JSON at position 27 (line 3 column 23)
          at JSON.parse (<anonymous>)
          at getUserDnMapping (mn_add_ldap_dialog_controller.js:217:47)
          at getAuthenticationSettings (mn_add_ldap_dialog_controller.js:261:30)
          at mnAddLDAPDialogController.checkAuthentication (mn_add_ldap_dialog_controller.js:314:34)
          at fn (eval at compile (index-729b989c.js:16425:15), <anonymous>:4:217)
          at callback (index-729b989c.js:28958:13)
          at ChildScope.$eval (index-729b989c.js:19400:23)
          at ChildScope.$apply (index-729b989c.js:19499:25)
          at HTMLButtonElement.<anonymous> (index-729b989c.js:28962:19)
          at defaultHandlerWrapper (index-729b989c.js:3890:11) undefined
      (anonymous) @ index-729b989c.js:15574
      (anonymous) @ index-729b989c.js:11853
      (anonymous) @ mn_exception_reporter.js:45
      $apply @ index-729b989c.js:19504
      (anonymous) @ index-729b989c.js:28962
      defaultHandlerWrapper @ index-729b989c.js:3890
      eventHandler @ index-729b989c.js:3878
      e.invokeTask @ zone.js:19
      onInvokeTask @ core.js:25903
      e.invokeTask @ zone.js:19
      t.runTask @ zone.js:19
      t.invokeTask @ zone.js:19
      _ @ zone.js:50
      m @ zone.js:50
      

      I think the correct behavior in this case is showing and error message about invalid json.

      Attachments

        For Gerrit Dashboard: MB-60050
        # Subject Branch Project Status CR V

        Activity

          People

            jyotsna.nayak Jyotsna Nayak
            timofey.barmin Timofey Barmin
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes

                PagerDuty