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

Ensure XML plist data has UTF-8 encoding before parsing

    XMLWordPrintable

Details

    • Night's Watch
    • 1
    • NW - 2020-01-22, NW - 2020-02-05
    • Bug Fix
    • Fixed an issue where Puppet would try to parse an XML property list file as ASCII instead of UTF-8.
    • 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

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

              Dates

                Created:
                Updated:
                Resolved:

                Zendesk Support