Uploaded image for project: 'Puppet'
  1. Puppet
  2. PUP-7665

Puppet 5 fails when facter facts contain ampersands

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Critical
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: PUP 5.0.0
    • Component/s: None
    • Labels:
      None
    • Template:
    • Team:
      Agent
    • Story Points:
      1
    • Sprint:
      Agent 2017-06-28
    • Method Found:
      Needs Assessment
    • Release Notes:
      Not Needed
    • Release Notes Summary:
      Hide
      See https://tickets.puppetlabs.com/browse/PUP-7661 for pre-docs.

      This issue was encountered during development, and will ensure current functionality continues to work when using JSON instead of PSON. As a result, it's not a new feature or bug fix, so I'm marking it as Not Needed.
      Show
      See https://tickets.puppetlabs.com/browse/PUP-7661 for pre-docs. This issue was encountered during development, and will ensure current functionality continues to work when using JSON instead of PSON. As a result, it's not a new feature or bug fix, so I'm marking it as Not Needed.
    • QA Risk Assessment:
      Manual
    • QA Risk Assessment Reason:
      Covered by spec test

      Description

      This is related to PUP-7658, except that it applies to when the agent sends the catalog request in JSON, as we do not currently escape the fact values. So the & is interpreted as a query parameter delimiter instead of a fact value.

      To repro. Create external facts with the following in either /etc/puppetlabs/facter/facts.d if running as root, or ~/.facter/facts.d:

      ---
      space: "foo bar"
      plus: "foo+bar"
      star: "foo*bar"
      hash: "foo#bar"
      percent: "foo%bar"
      ampersand: "foo & bar"
      

      Do an agent run, and it will fail with:

      <- "POST /puppet/v3/catalog/chara.corp.puppetlabs.net?environment=production HTTP/1.1\r\nAccept: application/json, application/x-msgpack, text/pson\r\nX-Puppet-Version: 5.0.0\r\nAccept-Encoding: gzip;q=1.0,deflate;q=0.6,identity;q=0.3\r\nUser-Agent: Puppet/5.0.0 Ruby/2.4.1-p111 (x86_64-darwin15)\r\nHost: chara.corp.puppetlabs.net:8140\r\nContent-Length: 5599\r\nContent-Type: application/x-www-form-urlencoded\r\n\r\n"
      <- "environment=production&facts_format=application%2Fjson&facts=%7B%22name%22%3A%22XXX.corp.puppetlabs.net%22%2C%22values%22%3A%7B%22puppetversion%22%3A%225.0.0%22%2C%22architecture%22%3A%22x86_64%22%2C%22kernel%22%3A%22Darwin%22%2C%22space%22%3A%22foo%20bar%22%2C%22plus%22%3A%22foo%2Bbar%22%2C%22star%22%3A%22foo%2Abar%22%2C%22hash%22%3A%22foo%23bar%22%2C%22percent%22%3A%22foo%25bar%22%2C%22ampersand%22%3A%22foo%20&%20bar%22%2C...
      Error: Could not retrieve catalog from remote server: Error 500 on SERVER: Server Error: Could not intern from json: 743: unexpected token at '{"name":"chara.corp.puppetlabs.net","values":{"puppetversion":"5.0.0","architecture":"x86_64","kernel":"Darwin","space":"foo bar","plus":"foo+bar","star":"foo*bar","hash":"foo#bar","percent":"foo%bar","ampersand":"foo '
      

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              Unassigned Unassigned
              Reporter:
              josh Josh Cooper
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:

                  Zendesk Support