mirror of
https://github.com/usnistgov/macos_security.git
synced 2026-02-09 00:09:55 +00:00
Scutil is referenced without full path #188
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 @wintererik on GitHub.
Summary
If /usr/sbin is not on the $PATH then running the guidance script in "check" mode will fail for some rules. This is due to that the CURRENT_USER is determined running the scutil command without specifying its full path.
Steps to reproduce
Run the guidance script in "check" mode from a cron job.
Operating System version
Ventura 13.2.1
Intel or Apple Silicon
Apple Silicon
What is the current bug behavior?
system_settings_bluetooth_sharing_disable fails when running the guidance script in "check" mode from a cron job, with the following output.
This is due to that the CURRENT_USER variable is empty when running in a cron job. In the cron jobs then /usr/sbin is not in the $PATH.
What is the expected correct behavior?
No difference in result although running in an environment which does not have /usr/sbin included in the $PATH.
E.g. in our case we tried to run the script scheduled with cron.
Relevant logs and/or screenshots
Output of checks
Possible fixes
The guidance script defines CURRENT_USER here:
3c8162a1fc/scripts/generate_guidance.py (L609)In the documentation instead the full path is used to reference the scutil command.
Possible fix is to do as in the documentation, i.e. use the full path in the guidance script. I can provide a pull request.
@wintererik commented on GitHub:
Pull request created #239
@robertgendler commented on GitHub:
Pull request would be awesome. If you do, make it against an OS branch, not main please
We're always trying to make sure we use full path as much as possible, but definitely have missed occasional spots through out the project.
@wintererik commented on GitHub:
Ok, perfect. Will get back with a pull request.