From ace43479e725e524a7c2b168adcd5dcddd512868 Mon Sep 17 00:00:00 2001 From: Yi Zhao Date: Fri, 7 Feb 2020 21:49:04 +0800 Subject: scap-security-guide: fix xml parsing error when build remediation files Backport 2 patches to fix the build error: Processing fix.text for: java_jre_configure_crypto_policy rule Unable to extract part of the fix.text after inclusion of remediation functions. Aborting.. jre/CMakeFiles/generate-internal-jre-bash-fixes.xml.dir/build.make:60: recipe for target 'jre/bash-fixes.xml' failed make[2]: *** [jre/bash-fixes.xml] Error 1 make[2]: *** Deleting file 'jre/bash-fixes.xml' Signed-off-by: Yi Zhao Signed-off-by: Armin Kuster --- ...parsing-of-the-remediation-functions-file.patch | 39 ++++++++++++++++++++++ ...roken-fix-when-greedy-regex-ate-the-whole.patch | 35 +++++++++++++++++++ .../scap-security-guide/scap-security-guide_git.bb | 5 ++- 3 files changed, 78 insertions(+), 1 deletion(-) create mode 100644 meta-security-compliance/recipes-openscap/scap-security-guide/files/0001-Fix-XML-parsing-of-the-remediation-functions-file.patch create mode 100644 meta-security-compliance/recipes-openscap/scap-security-guide/files/0002-Fixed-the-broken-fix-when-greedy-regex-ate-the-whole.patch diff --git a/meta-security-compliance/recipes-openscap/scap-security-guide/files/0001-Fix-XML-parsing-of-the-remediation-functions-file.patch b/meta-security-compliance/recipes-openscap/scap-security-guide/files/0001-Fix-XML-parsing-of-the-remediation-functions-file.patch new file mode 100644 index 0000000..c0b93e4 --- /dev/null +++ b/meta-security-compliance/recipes-openscap/scap-security-guide/files/0001-Fix-XML-parsing-of-the-remediation-functions-file.patch @@ -0,0 +1,39 @@ +From 174293162e5840684d967e36840fc1f9f57c90be Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Mat=C4=9Bj=20T=C3=BD=C4=8D?= +Date: Thu, 5 Dec 2019 15:02:05 +0100 +Subject: [PATCH] Fix XML "parsing" of the remediation functions file. + +A proper fix is not worth the effort, as we aim to kill shared Bash remediation +with Jinja2 macros. + +Upstream-Status: Backport +[https://github.com/ComplianceAsCode/content/commit/174293162e5840684d967e36840fc1f9f57c90be] + +Signed-off-by: Yi Zhao +--- + ssg/build_remediations.py | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/ssg/build_remediations.py b/ssg/build_remediations.py +index 7da807bd6..13e90f732 100644 +--- a/ssg/build_remediations.py ++++ b/ssg/build_remediations.py +@@ -56,11 +56,11 @@ def get_available_functions(build_dir): + remediation_functions = [] + with codecs.open(xmlfilepath, "r", encoding="utf-8") as xmlfile: + filestring = xmlfile.read() +- # This regex looks implementation dependent but we can rely on +- # ElementTree sorting XML attrs alphabetically. Hidden is guaranteed +- # to be the first attr and ID is guaranteed to be second. ++ # This regex looks implementation dependent but we can rely on the element attributes ++ # being present on one line. ++ # We can't rely on ElementTree sorting XML attrs in any way since Python 3.7. + remediation_functions = re.findall( +- r'