Blame SOURCES/scap-security-guide-0.1.58-update_stig_mapping_table-PR_7327.patch

76240a
From ea1bab197a17dd944e41a583c82c3cc757bb566b Mon Sep 17 00:00:00 2001
76240a
From: Gabriel Becker <ggasparb@redhat.com>
76240a
Date: Wed, 4 Aug 2021 12:23:05 +0200
76240a
Subject: [PATCH] Update STIG mapping table to reflect statistics of coverage.
76240a
76240a
---
76240a
 .../shared_xccdf-apply-overlay-stig.xslt      | 59 +++++++++++++------
76240a
 .../transforms/shared_xccdf2table-stig.xslt   | 28 +++++++++
76240a
 2 files changed, 68 insertions(+), 19 deletions(-)
76240a
76240a
diff --git a/shared/transforms/shared_xccdf-apply-overlay-stig.xslt b/shared/transforms/shared_xccdf-apply-overlay-stig.xslt
76240a
index 945f709b95..b7c000608c 100644
76240a
--- a/shared/transforms/shared_xccdf-apply-overlay-stig.xslt
76240a
+++ b/shared/transforms/shared_xccdf-apply-overlay-stig.xslt
76240a
@@ -28,26 +28,47 @@
76240a
       <xsl:variable name="overlay_ref" select="@disa"/>
76240a
       <xsl:variable name="overlay_title" select="xccdf:title/@text"/>
76240a
 
76240a
-      <xsl:for-each select="$rules">
76240a
-        <xsl:if test="@id=$overlay_rule">
76240a
-		  <Group id="V-{$overlay_id}">
76240a
-		    <title>SRG-OS-ID</title>
76240a
-		    <description></description>
76240a
-            <Rule id="{$overlay_rule}" severity="{$overlay_severity}" >
76240a
-			<version><xsl:value-of select="$overlay_version"/></version>
76240a
-          	<title><xsl:value-of select="$overlay_title"/></title>
76240a
-          	<description><xsl:copy-of select="xccdf:rationale/node()" /></description>
76240a
-          	<check system="C-{$overlay_id}_chk">
76240a
-              <check-content>
76240a
-					      <xsl:apply-templates select="xccdf:check[@system='http://scap.nist.gov/schema/ocil/2']"/>
76240a
-              </check-content>
76240a
-          	</check>
76240a
-		  	<ident system="https://public.cyber.mil/stigs/cci"><xsl:value-of select="$overlay_ref" /></ident>
76240a
-          	<fixtext><xsl:copy-of select="xccdf:description/node()" /></fixtext>
76240a
-          </Rule> 
76240a
+      <xsl:choose>
76240a
+        <xsl:when test="$overlay_rule='XXXX'">
76240a
+          <Group id="V-{$overlay_id}">
76240a
+            <title>SRG-OS-ID</title>
76240a
+            <description></description>
76240a
+                <Rule id="Missing Rule" severity="{$overlay_severity}" >
76240a
+          <version><xsl:value-of select="$overlay_version"/></version>
76240a
+                <title><xsl:value-of select="$overlay_title"/></title>
76240a
+                <description></description>
76240a
+                <check system="C-{$overlay_id}_chk">
76240a
+                  <check-content>
76240a
+                  </check-content>
76240a
+                </check>
76240a
+                <ident></ident>
76240a
+                <fixtext></fixtext>
76240a
+              </Rule>
76240a
           </Group>
76240a
-        </xsl:if>
76240a
-      </xsl:for-each> 
76240a
+        </xsl:when>
76240a
+        <xsl:otherwise>
76240a
+          <xsl:for-each select="$rules">
76240a
+            <xsl:if test="@id=$overlay_rule">
76240a
+          <Group id="V-{$overlay_id}">
76240a
+            <title>SRG-OS-ID</title>
76240a
+            <description></description>
76240a
+                <Rule id="{$overlay_rule}" severity="{$overlay_severity}" >
76240a
+          <version><xsl:value-of select="$overlay_version"/></version>
76240a
+                <title><xsl:value-of select="$overlay_title"/></title>
76240a
+                <description><xsl:copy-of select="xccdf:rationale/node()" /></description>
76240a
+                <check system="C-{$overlay_id}_chk">
76240a
+                  <check-content>
76240a
+                    <xsl:apply-templates select="xccdf:check[@system='http://scap.nist.gov/schema/ocil/2']"/>
76240a
+                  </check-content>
76240a
+                </check>
76240a
+            <ident system="https://public.cyber.mil/stigs/cci"><xsl:value-of select="$overlay_ref" /></ident>
76240a
+                <fixtext><xsl:copy-of select="xccdf:description/node()" /></fixtext>
76240a
+              </Rule>
76240a
+              </Group>
76240a
+            </xsl:if>
76240a
+          </xsl:for-each>
76240a
+        </xsl:otherwise>
76240a
+    </xsl:choose>
76240a
 
76240a
     </xsl:for-each> 
76240a
     </xsl:copy>
76240a
diff --git a/shared/transforms/shared_xccdf2table-stig.xslt b/shared/transforms/shared_xccdf2table-stig.xslt
76240a
index 3746c386c0..4c477542f4 100644
76240a
--- a/shared/transforms/shared_xccdf2table-stig.xslt
76240a
+++ b/shared/transforms/shared_xccdf2table-stig.xslt
76240a
@@ -20,6 +20,34 @@
76240a
 			
76240a
 			
76240a
 			
76240a
+
76240a
+			
76240a
+			
76240a
+				
76240a
+				  
76240a
+					Total
76240a
+					Missing
76240a
+					Implemented
76240a
+					Coverage
76240a
+					STIG ids missing rule
76240a
+				  
76240a
+				
76240a
+				
76240a
+				  
76240a
+					<xsl:value-of select="number(count(/cdf:Benchmark/cdf:Group/cdf:Rule))"/>
76240a
+					<xsl:value-of select="number(count(/cdf:Benchmark/cdf:Group/cdf:Rule[@id='Missing Rule']))"/>
76240a
+					<xsl:value-of select="number(count(/cdf:Benchmark/cdf:Group/cdf:Rule[@id!='Missing Rule']))"/>
76240a
+					<xsl:value-of select="format-number(count(/cdf:Benchmark/cdf:Group/cdf:Rule[@id!='Missing Rule']) div count(/cdf:Benchmark/cdf:Group/cdf:Rule)*100, '#.00')"/>%
76240a
+					
76240a
+						<xsl:for-each select="/cdf:Benchmark/cdf:Group/cdf:Rule[@id='Missing Rule']">
76240a
+							<xsl:value-of select="cdf:version/node()"/><xsl:text>
</xsl:text>
76240a
+						</xsl:for-each>
76240a
+					
76240a
+				  
76240a
+				
76240a
+				
76240a
+			
76240a
+
76240a
 			<xsl:apply-templates select="cdf:Benchmark"/>
76240a
 		</body>
76240a
 		</html>