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

Ensure XML plist data has UTF-8 encoding before parsing

    XMLWordPrintable

    Details

    • Template:
    • Team:
      Night's Watch
    • Story Points:
      1
    • Sprint:
      NW - 2020-01-22, NW - 2020-02-05
    • Release Notes:
      Bug Fix
    • Release Notes Summary:
      Fixed an issue where Puppet would try to parse an XML property list file as ASCII instead of UTF-8.
    • QA Risk Assessment:
      Needs Assessment

      Description

      When creating a user/group resource on macOS Catalina, the directoryservice provider would fail with the following:

      Debug: Failed with ArgumentError on : #<ArgumentError: invalid byte sequence in US-ASCII>
      Error: Could not prefetch user provider 'directoryservice': undefined method `each' for nil:NilClass
      

      This issue is caused by the Puppet::Util::Plist.parse_plist method receiving XML plist_data in ASCII instead of UTF-8 encoding (see https://github.com/puppetlabs/puppet/blob/master/lib/puppet/provider/user/directoryservice.rb#L95 for an example).

      XML plists begin with <?xml version="1.0" encoding="UTF-8"?>. Based on this, we can force the encoding of the plist data to be UTF-8. We do this conditionally, since the parse_plist method can also be called with plist data in binary format.

      This issue seems to have been present from the beginning, but luckily no non-ASCII plist data snuck through until now.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              gabriel.nagy Gabriel Nagy
              Reporter:
              gabriel.nagy Gabriel Nagy
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:

                  Zendesk Support