JXA Checks are causing the generated baseline_compliance.sh to break #261

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

Originally created by @jordanburnette on GitHub.

Summary

When running generate_guidance.py on dev_cis_moneterey branch for cis_lvl1 rules, the newly updated checks that leverage javascript are preventing the created to break. See Screenshot below of an example from the generated script:

Steps to reproduce

  • Pull dev_cis_monterey and run generate_guidance.py baselines/cis_lvl1.yaml -s to generate the compliance script
  • Attempts to run the cis_lvl1_compliance.sh return parse errors
  • Viewing the script in VSCode shows where things start to get a little wonky (see picture in the screenshots section)

Operating System version

macOS Monterey 12.X

What is the current bug behavior?

When running the script on a targeted machine, parse errors show

What is the expected correct behavior?

The compliance script should be able to run properly without giving parse error, allowing one to run

Relevant logs and/or screenshots

(contents of cis_lvl1_compliance.sh created from generate_guidance.py at the point of the first jxa check @ Line 1003)
Screen Shot 2022-02-10 at 3 37 54 PM

Output of checks

(line items will vary on your testing since I am not using all the rules)
cis_lvl1_compliance.sh:5089: parse error
cis_lvl1_compliance.sh:5275: parse error near 'result_value=$(/usr/...'

Possible fixes

Not sure TBH. May require some work on the generate_guidance.py script to allow the compiled script to maintain the Javascript checks when they are being used.

Originally created by @jordanburnette on GitHub. <!--- Please read this! Before opening a new issue, make sure to search for keywords in the issues filtered by the "regression" or "bug" label and verify the issue you're about to submit isn't a duplicate. ---> ### Summary When running `generate_guidance.py` on dev_cis_moneterey branch for cis_lvl1 rules, the newly updated checks that leverage javascript are preventing the created to break. See Screenshot below of an example from the generated script: ### Steps to reproduce - Pull dev_cis_monterey and run `generate_guidance.py baselines/cis_lvl1.yaml -s` to generate the compliance script - Attempts to run the cis_lvl1_compliance.sh return parse errors - Viewing the script in VSCode shows where things start to get a little wonky (see picture in the screenshots section) ### Operating System version macOS Monterey 12.X ### What is the current *bug* behavior? When running the script on a targeted machine, parse errors show ### What is the expected *correct* behavior? The compliance script should be able to run properly without giving parse error, allowing one to run ### Relevant logs and/or screenshots (contents of cis_lvl1_compliance.sh created from generate_guidance.py at the point of the first jxa check @ Line 1003) ![Screen Shot 2022-02-10 at 3 37 54 PM](https://user-images.githubusercontent.com/65682475/153495197-6125df5d-cf1a-4566-9265-101b68461293.png) ### Output of checks (line items will vary on your testing since I am not using all the rules) `cis_lvl1_compliance.sh:5089: parse error` `cis_lvl1_compliance.sh:5275: parse error near 'result_value=$(/usr/...'` ### Possible fixes Not sure TBH. May require some work on the `generate_guidance.py` script to allow the compiled script to maintain the Javascript checks when they are being used.
Author
Owner

@robertgendler commented on GitHub:

Fixed in dev_monterey!

1 rule had
check: not check:|

@robertgendler commented on GitHub: Fixed in dev_monterey! 1 rule had check: not check:|
Author
Owner

@jordanburnette commented on GitHub:

Confirmed to be fixed.

@jordanburnette commented on GitHub: Confirmed to be fixed.
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#261