mirror of
https://github.com/usnistgov/macos_security.git
synced 2026-02-03 05:53:24 +00:00
icloud_appleid_system_settings_disable checking script seems to be returning inconsistent data #218
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @cipineda on GitHub.
Summary
It seems that the code to check the status for icloud_appleid_system_settings_disable is not fetching the correct information.
It returns a 0 even though the profile to restrict access to appleid is being enforced on the tested endpoint with MacOS Ventura 13.1.
Steps to reproduce
Remove the grep command from the original checking script and run as follows:
/usr/bin/profiles show -output stdout-xml | /usr/bin/xmllint --xpath 'string(//*[contains(text(), "DisabledSystemSettings")]/following-sibling::*[1])' -The code returns a single line and the result changes each time it is executed:
Sample outputs:
/usr/bin/profiles show -output stdout-xml | /usr/bin/xmllint --xpath 'string(//*[contains(text(), "DisabledSystemSettings")]/following-sibling::*[1])' - com.apple.ScreenSaver-Settings.extension root@AMR-20ZMQ6X8 Preferences # /usr/bin/profiles show -output stdout-xml | /usr/bin/xmllint --xpath 'string(//*[contains(text(), "DisabledSystemSettings")]/following-sibling::*[1])' - com.apple.WalletSettingsExtension root@AMR-20ZMQ6X8 Preferences # /usr/bin/profiles show -output stdout-xml | /usr/bin/xmllint --xpath 'string(//*[contains(text(), "DisabledSystemSettings")]/following-sibling::*[1])' - com.apple.Internet-Accounts-Settings.extension root@AMR-20ZMQ6X8 Preferences # /usr/bin/profiles show -output stdout-xml | /usr/bin/xmllint --xpath 'string(//*[contains(text(), "DisabledSystemSettings")]/following-sibling::*[1])' - com.apple.Wallpaper-Settings.extension root@AMR-20ZMQ6X8 Preferences # /usr/bin/profiles show -output stdout-xml | /usr/bin/xmllint --xpath 'string(//*[contains(text(), "DisabledSystemSettings")]/following-sibling::*[1])' - com.apple.Wallpaper-Settings.extension root@AMR-20ZMQ6X8 Preferences # /usr/bin/profiles show -output stdout-xml | /usr/bin/xmllint --xpath 'string(//*[contains(text(), "DisabledSystemSettings")]/following-sibling::*[1])' - com.apple.BluetoothSettingsOperating System version
Ventura 13.1
(macOS Version and build)
Version 13.1 Beta (22C5033e)
Intel or Apple Silicon
Silicon
What is the current bug behavior?
The validation script shows as failed (finding) even though the proper profile exits
This is a snippet of the profiles installed on the computer:
<key>ProfileInstallDate</key> <string>2022-10-20 22:35:33 +0000</string> <key>ProfileItems</key> <array> <dict> <key>PayloadContent</key> <dict> <key>DisabledSystemSettings</key> <array> <string>com.apple.systempreferences.AppleIDSettings</string> </array> </dict>What is the expected correct behavior?
The expected behavior is for the validation script to properly read the profiles xml output and detect the correct profile being enforced
Output of checks
`/usr/bin/profiles show -output stdout-xml | /usr/bin/xmllint --xpath 'string(//[contains(text(), "DisabledSystemSettings")]/following-sibling::[1])' - | /usr/bin/grep -c com.apple.systempreferences.AppleIDSettings
0
`
Possible fixes
(If you can, link to the line of code that might be responsible for the problem)
@brodjieski commented on GitHub:
Are you able to post the entire output of
sudo /usr/bin/profiles show -output stdout-xml?@cipineda commented on GitHub:
I tried this on Ventura 13.0 22A380 and the same behavior occurs.
@cipineda commented on GitHub:
I am running with sudo.
@robertgendler commented on GitHub:
Are you running the profiles check with
sudobefore it.sudo /usr/bin/profiles show -output stdout-xml | /usr/bin/xmllint --xpath 'string(//[contains(text(), "DisabledSystemSettings")]/following-sibling::[1])' - | /usr/bin/grep -c com.apple.systempreferences.AppleIDSettingsIt must be ran with root privileges. It's best to run all checks with root privs.
@brodjieski commented on GitHub:
Ok... looks like you have multiple profiles deployed that are disabling various system settings. We will have to test and figure out if we can account for that use case. Since the output of the
profilescommand isn't always consistent (the order of which profiles seems random), we have to see if there is a different way to report the status.@robertgendler commented on GitHub:
Perfect. Ya we'll update the other branches and stuff.
@cipineda commented on GitHub:
I tried this fix and it worked as expected.
Are you also updating the other locations where the old code was used?
If, yes, this can be closed.
@robertgendler commented on GitHub:
Check out branch
dev_ventura_issue193and let us know if that fixes it.I updated the xpath from
string(//*[contains(text(), "DisabledPreferencePanes")]/following-sibling::*[1])to
//key[text()="DisabledPreferencePanes"]/following-sibling::*[1]You can try the full command
/usr/bin/profiles show -output stdout-xml | /usr/bin/xmllint --xpath '//key[text()="DisabledSystemSettings"]/following-sibling::*[1]' - | /usr/bin/grep -c com.apple.systempreferences.AppleIDSettings