diff --git a/scripts/generate_guidance.py b/scripts/generate_guidance.py index 928cdeaf..d4cf714f 100755 --- a/scripts/generate_guidance.py +++ b/scripts/generate_guidance.py @@ -1522,9 +1522,10 @@ def fill_in_odv(resulting_yaml, parent_values): if "$ODV" in resulting_yaml[field]: resulting_yaml[field] = resulting_yaml[field].replace("$ODV", str(odv)) - for result_value in resulting_yaml["result"]: - if "$ODV" in str(resulting_yaml["result"][result_value]): - resulting_yaml["result"][result_value] = odv + if "result" in resulting_yaml.keys(): + for result_value in resulting_yaml["result"]: + if "$ODV" in str(resulting_yaml["result"][result_value]): + resulting_yaml["result"][result_value] = odv if resulting_yaml["mobileconfig_info"]: for mobileconfig_type in resulting_yaml["mobileconfig_info"]: @@ -2560,7 +2561,8 @@ def main(): rule_srg=srg, ) else: - if version_yaml['platform'] == "iOS/iPadOS": + #using the same rule template for ios/ipados/visionos + if version_yaml['platform'] == "iOS/iPadOS" or version_yaml['platform'] == "visionOS": rule_adoc = adoc_rule_ios_template.substitute( rule_title=rule_yaml['title'].replace('|', r'\|'), rule_id=rule_yaml['id'].replace('|', r'\|'), diff --git a/scripts/generate_mapping.py b/scripts/generate_mapping.py index b3f49f20..938bb6aa 100755 --- a/scripts/generate_mapping.py +++ b/scripts/generate_mapping.py @@ -438,6 +438,15 @@ profile:'''.format(other_header,other_header,version_yaml['os'],version_yaml['ve full_baseline = full_baseline + ''' - {}'''.format(rule) + if len(os_section) != 0 and version_yaml['platform'] == "visionOS": + full_baseline = full_baseline + ''' + - section: "visionOS" + rules:''' + os_section.sort() + for rule in os_section: + full_baseline = full_baseline + ''' + - {}'''.format(rule) + if len(os_section) != 0 and version_yaml['platform'] == "macOS": full_baseline = full_baseline + ''' - section: "macOS" diff --git a/scripts/generate_scap.py b/scripts/generate_scap.py index 546f7ad8..9baa0cde 100755 --- a/scripts/generate_scap.py +++ b/scripts/generate_scap.py @@ -120,13 +120,18 @@ def generate_scap(all_rules, all_baselines, args): if "ios" in version_yaml['cpe']: print("OVAL generation is not available on iOS") exit() - + if "visionOS" in version_yaml['cpe']: + print("OVAL generation is not available on visionOS") + exit() if args.oval == None and args.xccdf == None: export_as = "scap" if "ios" in version_yaml['cpe']: print("iOS will only export as XCCDF") export_as = "xccdf" + if "visionos" in version_yaml['cpe']: + print("visionOS will only export as XCCDF") + export_as = "xccdf" now = datetime.now() date_time_string = now.strftime("%Y-%m-%dT%H:%M:%S") @@ -135,7 +140,8 @@ def generate_scap(all_rules, all_baselines, args): output = "../build/macOS_{0}_Security_Compliance_Benchmark-{1}".format(version_yaml['os'],filenameversion) if "ios" in version_yaml['cpe']: output = "../build/iOS_{0}_Security_Compliance_Benchmark-{1}".format(version_yaml['os'],filenameversion) - + if "visionos" in version_yaml['cpe']: + output = "../build/iOS_{0}_Security_Compliance_Benchmark-{1}".format(version_yaml['os'],filenameversion) if export_as == "xccdf": output = output + "_xccdf.xml" @@ -167,8 +173,11 @@ def generate_scap(all_rules, all_baselines, args): '''.format(date_time_string) ostype = "macOS" - if "ios" in version_yaml['cpe']: + if "ios" in version_yaml['cpe'] or "visionos" in version_yaml['cpe']: ostype = "iOS/iPadOS" + if "visionos" in version_yaml['cpe']: + ostype = "visionOS" + xccdfPrefix = ''' draft