Skip to main content
coreydaley.dev

ITMS-91056: the two hyphens that invalidated my privacy manifest

An early build of Purrchiver came back from App Store Connect with ITMS-91056: Invalid privacy manifest — for the app’s PrivacyInfo.xcprivacy and for the one inside its Quick Look extension. Both files had passed plutil -lint. Both had the right keys. The problem was a comment.

The cause: -- is illegal inside an XML comment

Both manifests opened with a comment block explaining what they declared and how to check them before shipping. That block included a command line I’d left myself as a reminder, and the command had a flag in it:

<!--
  Verify at ship time:
    xcrun privacy --bundle Purrchiver.app
-->

The XML spec doesn’t allow the string -- anywhere inside a comment. It’s not a style rule; a conforming parser has to reject the document. One stray flag turned a valid property list into malformed XML.

The Quick Look extension’s manifest was only a day old. Extensions are separately signed bundles, and each one needs its own privacy manifest covering the APIs it links. I had written that one by copying the host’s comment style, reminder line included. So the same two characters failed validation twice in one upload.

Why nothing local caught it

plutil -lint reads the file and prints OK. So does PropertyListSerialization. Both are lenient about this particular error, so both told me the file was fine. The comment in the extension’s manifest even said to run plutil -lint at ship time, which I had. It was the wrong check.

A strict XML parser disagrees right away:

$ plutil -lint PrivacyInfo.xcprivacy
PrivacyInfo.xcprivacy: OK

$ xmllint --noout PrivacyInfo.xcprivacy
PrivacyInfo.xcprivacy:6: parser error : Double hyphen within comment

Foundation’s XMLParser also refuses it: parse() returns false with an NSXMLParserErrorDomain error. Apple’s upload validation evidently works the same way. If you’ve hit ITMS-91056 and the manifest looks right, run it through xmllint before you go looking anywhere else.

The fix

I deleted every comment from both manifests. The keys and values didn’t change at all. The rationale for each required-reason code moved into source comments and commit messages, where it can’t break the file.

A privacy manifest is a data file that Apple’s tooling parses strictly. It’s not documentation. Keeping it comment-free means there’s nothing in it that a lenient tool can wave through and a strict one can reject.

The test that keeps it fixed

The manifests are now covered by a small test that runs with the rest of the suite. It checks two things that plutil doesn’t:

import Testing
import Foundation

@Test func manifestsHaveNoComments() throws {
    for url in manifestURLs {
        let text = try String(contentsOf: url, encoding: .utf8)
        #expect(!text.contains("<!--"), "\(url.lastPathComponent) has an XML comment")
    }
}

@Test func manifestsParseAsStrictXML() throws {
    for url in manifestURLs {
        let parser = XMLParser(data: try Data(contentsOf: url))
        #expect(parser.parse(), "\(url.lastPathComponent): \(String(describing: parser.parserError))")
    }
}

The strict parse would have caught this exact bug. The no-comments rule is stricter than it needs to be, on purpose. A comment without -- is legal XML, but banning comments outright means nobody has to remember which characters are safe in them.

Point manifestURLs at the source files, not the built bundle, so the test runs in a normal unit-test pass without an archive build.

It came back in a different file

Seventeen days later the same mistake turned up in the app’s .entitlements file. Its header comment explained how to check the signed app’s effective entitlements, and it quoted the codesign invocation, flags and all. A stricter plist parser rejected it with XML Parse Error: Double hyphen within comment.

Entitlements files have a better reason to keep a comment than privacy manifests do. The comment there documents which build settings produce which keys, and I wanted to keep that. XML has no way to escape -- inside a comment, so I rewrote the command lines as prose (“codesign with the -d flag and the entitlements option”) and left the keys alone.

The lint test only covered the two privacy manifests, which is why it didn’t catch this one. The lesson applies to every XML-format plist in an Xcode project, though: Info.plist, .entitlements, .xcprivacy, and anything else Apple’s tools read with a strict parser.

What to take away

  • ITMS-91056 can be an XML problem, not a privacy problem. Before you re-audit your required-reason codes, check that the file is well-formed.
  • plutil -lint is not an XML validator. Use xmllint --noout or XMLParser when strictness matters.
  • Never put a command line in an XML comment. Long options start with --. So do decrement operators and plenty of other things people paste into notes.
  • Every extension needs its own manifest, and anything wrong with the host’s manifest gets copied into it.

Related posts