Skip to content

macos: strip trailing text from profiles command output#152

Merged
Mic92 merged 1 commit intomainfrom
macos-warning
Mar 3, 2026
Merged

macos: strip trailing text from profiles command output#152
Mic92 merged 1 commit intomainfrom
macos-warning

Conversation

@Mic92
Copy link
Member

@Mic92 Mic92 commented Mar 3, 2026

/usr/bin/profiles -P -o stdout-xml appends plain text like "There are no configuration profiles installed" after the closing tag when no profiles exist. The plist parser rejects this as unexpected characters, causing check_suis() to skip the SystemUIServer policy check entirely with a warning.

Strip everything after before parsing so the MDM policy check works reliably on machines with no configuration profiles.

Description
Checklist
  • Added or updated relevant tests (leave unchecked if not applicable)
  • Added or updated relevant documentation (leave unchecked if not applicable)
  • Linked to related issues (leave unchecked if not applicable)

`/usr/bin/profiles -P -o stdout-xml` emits plain text like
"There are no configuration profiles installed" alongside the plist
XML when no profiles exist. The position varies across macOS versions
— some emit it after </plist>, others before <?xml. The plist parser
rejects this as unexpected characters, causing check_suis() to skip
the SystemUIServer policy check entirely with a warning.

Extract just the <?xml...</plist> range before parsing so the MDM
policy check works reliably regardless of surrounding text.
@Mic92 Mic92 enabled auto-merge March 3, 2026 13:23
@Mic92 Mic92 added this pull request to the merge queue Mar 3, 2026
Merged via the queue into main with commit 2cfb455 Mar 3, 2026
21 checks passed
@Mic92 Mic92 deleted the macos-warning branch March 3, 2026 13:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant