Blame SOURCES/scap-security-guide-0.1.40-fix-login_d_umask-2.patch

5b3ad7
From 95e9d5130f7b20677af0fd8b23b8fb2ad0900d5b Mon Sep 17 00:00:00 2001
5b3ad7
From: Martin Preisler <mpreisle@redhat.com>
5b3ad7
Date: Tue, 26 Jun 2018 13:28:20 -0400
5b3ad7
Subject: [PATCH] To be on the safe side, force ansible XCCDFs to be
5b3ad7
 interpreted as strings
5b3ad7
5b3ad7
Avoid quotes though because that enables all sorts of escaping rules
5b3ad7
that we would have to work around.
5b3ad7
---
5b3ad7
 ssg/build_remediations.py | 6 +++++-
5b3ad7
 1 file changed, 5 insertions(+), 1 deletion(-)
5b3ad7
5b3ad7
diff --git a/shared/utils/combine-remediations.py
5b3ad7
index ece3765d56..5f61982750 100644
5b3ad7
--- a/shared/utils/combine-remediations.py
5b3ad7
+++ b/shared/utils/combine-remediations.py
5b3ad7
@@ -190,11 +190,15 @@ def expand_xccdf_subs(fix, remediation_type, remediation_functions):
5b3ad7
                 "substituting directly."
5b3ad7
             )
5b3ad7
 
5b3ad7
+        # we use the horrid "!!str |-" syntax to force strings without using
5b3ad7
+        # quotes. quotes enable yaml escaping rules so we'd have to escape all
5b3ad7
+        # the backslashes and at this point we don't know if there are any.
5b3ad7
         fix_text = re.sub(
5b3ad7
             r"- \(xccdf-var\s+(\S+)\)",
5b3ad7
             r"- name: XCCDF Value \1 # promote to variable\n"
5b3ad7
             r"  set_fact:\n"
5b3ad7
-            r'    \1: "(ansible-populate \1)"\n'
5b3ad7
+            r"    \1: !!str |-\n"
5b3ad7
+            r"        (ansible-populate \1)\n"
5b3ad7
             r"  tags:\n"
5b3ad7
             r"    - always",
5b3ad7
             fix_text