Blame SOURCES/scap-security-guide-0.1.53-handle_non_package_cpes-PR_6292.patch

fe0dde
From bde4b709e8c3e91a3fd0b3699146ad88a2897ce0 Mon Sep 17 00:00:00 2001
fe0dde
From: Watson Sato <wsato@redhat.com>
fe0dde
Date: Thu, 22 Oct 2020 22:20:30 +0200
fe0dde
Subject: [PATCH] Add workround to skip non package CPEs
fe0dde
fe0dde
Do not add checks for package installed for CPEs that are not related to
fe0dde
package installed.
fe0dde
---
fe0dde
 ssg/build_remediations.py | 12 ++++++++++++
fe0dde
 ssg/constants.py          |  1 +
fe0dde
 2 files changed, 13 insertions(+)
fe0dde
fe0dde
diff --git a/ssg/build_remediations.py b/ssg/build_remediations.py
fe0dde
index 6759b6c963..9c7824560f 100644
fe0dde
--- a/ssg/build_remediations.py
fe0dde
+++ b/ssg/build_remediations.py
fe0dde
@@ -298,6 +298,12 @@ def parse_from_file_with_jinja(self, env_yaml):
fe0dde
                 if platform in self.local_env_yaml["platform_package_overrides"]:
fe0dde
                     platform = self.local_env_yaml["platform_package_overrides"].get(platform)
fe0dde
 
fe0dde
+                    # Workaround for plaforms that are not Package CPEs
fe0dde
+                    # Skip platforms that are not about packages installed
fe0dde
+                    # These should be handled in the remediation itself
fe0dde
+                    if not platform:
fe0dde
+                        continue
fe0dde
+
fe0dde
                 # Adjust package check command according to the pkg_manager
fe0dde
                 pkg_manager = self.local_env_yaml["pkg_manager"]
fe0dde
                 pkg_check_command = PKG_MANAGER_TO_PACKAGE_CHECK_COMMAND[pkg_manager]
fe0dde
@@ -452,6 +458,12 @@ def update_when_from_rule(self, to_update):
fe0dde
                 if platform in self.local_env_yaml["platform_package_overrides"]:
fe0dde
                     platform = self.local_env_yaml["platform_package_overrides"].get(platform)
fe0dde
 
fe0dde
+                    # Workaround for plaforms that are not Package CPEs
fe0dde
+                    # Skip platforms that are not about packages installed
fe0dde
+                    # These should be handled in the remediation itself
fe0dde
+                    if not platform:
fe0dde
+                        continue
fe0dde
+
fe0dde
                 additional_when.append('"' + platform + '" in ansible_facts.packages')
fe0dde
                 # After adding the conditional, we need to make sure package_facts are collected.
fe0dde
                 # This is done via inject_package_facts_task()
fe0dde
diff --git a/ssg/constants.py b/ssg/constants.py
fe0dde
index f1b64e6827..c2f72f66df 100644
fe0dde
--- a/ssg/constants.py
fe0dde
+++ b/ssg/constants.py
fe0dde
@@ -464,6 +464,7 @@
fe0dde
   "login_defs": "login",
fe0dde
   "sssd": "sssd-common",
fe0dde
   "zipl": "s390utils-base",
fe0dde
+  "sssd-ldap": None,  # Force package check wrapping skip
fe0dde
 }
fe0dde
 
fe0dde
 # _version_name_map = {