Uploaded image for project: 'Puppet Server'
  1. Puppet Server
  2. SERVER-1270

HOCON auth.conf, regex backslashes need to be escaped


    • Type: Bug
    • Status: Closed
    • Priority: Normal
    • Resolution: Won't Do
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: DOCS
    • Labels:
    • Template:


      Expectation: provide ruby regex string to path parameter, without needing to escape backslashes.

      Actual Results: A ruby regex that does not have backslashes escaped will cause the server to crash.

      Authorization block I'm working with. In this example I have the escaped the backslashes and puppetserver is happy.

                  match-request: {
                      path: "/puppet/v3/catalog/((\\w*?)(?:\\d+|-\\w+|_|\\.)[^/]*)$"
                      type: regex
                      method: [get, post]
                  allow: [ "$2_cluster", "$2_shared", "$1" ]
                  name: "my catalog"
                  sort-order: 300

      Puppet Server fails to start when using

      path: "/puppet/v3/catalog/((\w*?)(?:\d+|-\w+|_|\.)[^/]*)$"

      Exception in thread "main" com.typesafe.config.ConfigException$Parse: /etc/puppetlabs/puppetserver/conf.d/auth.conf: 7: Reserved character '\' is not allowed outside quotes (if you intended '\' (Reserved character '\' is not allowed outside quotes) to be part of the value for 'path', try enclosing the value in double quotes)

      If I use double and single quotes together, I get a slightly different error

      path: "'/puppet/v3/catalog/((\w*?)(?:\d+|-\w+|_|\.)[^/]*)$'"

      Exception in thread "main" com.typesafe.config.ConfigException$Parse: /etc/puppetlabs/puppetserver/conf.d/auth.conf: 28: in value for key 'path': backslash followed by 'w', this is not a valid escape sequence (quoted strings use JSON escaping, so use double-backslash \\ for literal backslash)

      This seems consistent with the HOCON documentation https://github.com/typesafehub/config/blob/master/HOCON.md#unchanged-from-json

      quoted strings are in the same format as JSON strings

      JSON strings must be escaped

      My non-developer/sysadmin suggestion would be to automatically escape backslash before sending the config file to tk-load-config for the path parameter.




            • Assignee:
              pyther Matthew Gyurgyik
            • Votes:
              0 Vote for this issue
              7 Start watching this issue


              • Created:

                Zendesk Support