"check" script in system_settings_screensaver_ask_for_password_delay_enforce.yaml throws a syntax error #72

Closed
opened 2026-01-19 18:29:08 +00:00 by michael · 2 comments
Owner

Originally created by @maniqui on GitHub.

e22bb0bc02/rules/system_settings/system_settings_screensaver_ask_for_password_delay_enforce.yaml (L7-L18)

This "check" script throws the following error

152:174: syntax error: Error on line 3: SyntaxError: Unexpected token ')' (-2700)

The version below (taken from here), which looks exactly the same, does not throw the error:

/usr/bin/osascript -l JavaScript << EOS
function run() {
let delay = ObjC.unwrap($.NSUserDefaults.alloc.initWithSuiteName('com.apple.screensaver')\
.objectForKey('askForPasswordDelay'))
if ( delay <= 5 ) {
return("true")
} else {
return("false")
}
}
EOS
Originally created by @maniqui on GitHub. https://github.com/usnistgov/macos_security/blob/e22bb0bc02290c54cb968bc3749942fa37ad752b/rules/system_settings/system_settings_screensaver_ask_for_password_delay_enforce.yaml#L7-L18 This "check" script throws the following error `152:174: syntax error: Error on line 3: SyntaxError: Unexpected token ')' (-2700)` The version below ([taken from here](https://www.stigviewer.com/stig/apple_macos_14_sonoma/2024-02-06/finding/V-259420)), which looks **exactly** the same, does not throw the error: ``` /usr/bin/osascript -l JavaScript << EOS function run() { let delay = ObjC.unwrap($.NSUserDefaults.alloc.initWithSuiteName('com.apple.screensaver')\ .objectForKey('askForPasswordDelay')) if ( delay <= 5 ) { return("true") } else { return("false") } } EOS ```
Author
Owner

@maniqui commented on GitHub:

@brodjieski you are right, my bad 🤦 Thank you!

@maniqui commented on GitHub: @brodjieski you are right, my bad 🤦 Thank you!
Author
Owner

@brodjieski commented on GitHub:

Hello!
If you copy/paste the check code as-is from the .yaml file for this rule, it will still have the $ODV placeholder that gets filled in during the generation processes. This value needs to be an integer for the check to work. Notice that in the example you provided that worked contains the value of 5 where $ODV is in the code. Leaving the $ODV placeholder in will generate the syntax error you are seeing.

@brodjieski commented on GitHub: Hello! If you copy/paste the check code as-is from the .yaml file for this rule, it will still have the `$ODV` placeholder that gets filled in during the generation processes. This value needs to be an integer for the check to work. Notice that in the example you provided that worked contains the value of 5 where `$ODV` is in the code. Leaving the `$ODV` placeholder in will generate the syntax error you are seeing.
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: usnistgov/macos_security#72