From b2f47797c9ddb3db110cea1f7324e3e287e70871 Mon Sep 17 00:00:00 2001 From: Matthew Burket Date: Fri, 27 Feb 2026 12:34:21 -0600 Subject: [PATCH 1/2] Make autotailor use correct XML namespaces Fixes https://github.com/OpenSCAP/openscap/issues/2309 --- utils/autotailor | 3 +++ 1 file changed, 3 insertions(+) diff --git a/utils/autotailor b/utils/autotailor index 3c3e994eaa..4cc71bee5d 100755 --- a/utils/autotailor +++ b/utils/autotailor @@ -29,6 +29,7 @@ import json NS = "http://checklists.nist.gov/xccdf/1.2" +NS_PREFIX = "xccdf-1.2" DEFAULT_PROFILE_SUFFIX = "_customized" DEFAULT_REVERSE_DNS = "org.ssgproject.content" ROLES = ["full", "unscored", "unchecked"] @@ -440,6 +441,8 @@ if __name__ == "__main__": parser = get_parser() args = parser.parse_args() + ET.register_namespace(NS_PREFIX, NS) + if not args.profile and not args.json_tailoring: parser.error("one of the following arguments has to be provided: " "BASE_PROFILE_ID or --json-tailoring JSON_TAILORING_FILENAME") From 90a58703338984114be708db17c29e1cb4a95df2 Mon Sep 17 00:00:00 2001 From: Matthew Burket Date: Fri, 27 Mar 2026 07:23:52 -0500 Subject: [PATCH 2/2] Add intergation test for proper namespace in autotailor xml --- tests/utils/autotailor_integration_test.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/utils/autotailor_integration_test.sh b/tests/utils/autotailor_integration_test.sh index a535591ca5..98f89d81ef 100755 --- a/tests/utils/autotailor_integration_test.sh +++ b/tests/utils/autotailor_integration_test.sh @@ -21,6 +21,7 @@ assert_exists 1 '/Benchmark/TestResult/rule-result[@idref="xccdf_com.example.www assert_exists 1 '/Benchmark/TestResult/rule-result[@idref="xccdf_com.example.www_rule_R2"]/result[text()="pass"]' assert_exists 1 '/Benchmark/TestResult/rule-result[@idref="xccdf_com.example.www_rule_R3"]/result[text()="pass"]' assert_exists 1 '/Benchmark/TestResult/rule-result[@idref="xccdf_com.example.www_rule_R4"]/result[text()="notselected"]' +grep "xccdf-1.2:" $tailoring # select additional rules R3, R4 python3 $autotailor --id-namespace "com.example.www" --select R3 --select R4 $ds $original_profile > $tailoring @@ -136,4 +137,4 @@ assert_exists 1 '/Benchmark/TestResult/rule-result[@idref="xccdf_com.example.www # use JSON tailoring (P11) with a new profile from the command line python3 $autotailor --id-namespace "com.example.www" --json-tailoring $json_tailoring --tailored-profile-id=CMDL_P --select R3 $ds $original_profile > $tailoring $OSCAP xccdf eval --profile CMDL_P --progress --tailoring-file $tailoring --results $result $ds -assert_exists 1 '/Benchmark/TestResult/rule-result[@idref="xccdf_com.example.www_rule_R3"]/result[text()="pass"]' \ No newline at end of file +assert_exists 1 '/Benchmark/TestResult/rule-result[@idref="xccdf_com.example.www_rule_R3"]/result[text()="pass"]'