adamwill / rpms / openscap

Forked from rpms/openscap 3 years ago
Clone
Blob Blame History Raw
From e957c5104fc8bdd6a272c8e7019b08aec921dc95 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C5=A0imon=20Luka=C5=A1=C3=ADk?= <isimluk@fedoraproject.org>
Date: Tue, 30 Jul 2019 13:28:41 +0200
Subject: [PATCH 1/2] Fix URL link mechanism for Red Hat Errata

Previously, public description of each erratum was available under

    https://rhn.redhat.com/errata/

at some point in time this has changed to

    https://access.redhat.com/errata/

and since not all links redirect properly from old to new, we have to fix
OpenSCAP end as well.

This enables people reviewing XCCDF policy guide or XCCDF result report to click
on RH[SBE]A-YYYY-ABCD acronym and be redirected to public description of the
given erratum.
---
 xsl/xccdf-share.xsl | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/xsl/xccdf-share.xsl b/xsl/xccdf-share.xsl
index 50b6ad950..37a74ffa2 100644
--- a/xsl/xccdf-share.xsl
+++ b/xsl/xccdf-share.xsl
@@ -55,8 +55,8 @@ Authors:
         <xsl:when test="starts-with(@system, 'http://cve.mitre.org')">
             <a href="{concat('https://cve.mitre.org/cgi-bin/cvename.cgi?name=', text())}"><abbr title="{concat(@system, concat(': ', text()))}"><xsl:value-of select="text()"/></abbr></a>
         </xsl:when>
-        <xsl:when test="starts-with(@system, 'https://rhn.redhat.com/errata')">
-            <a href="{concat('https://rhn.redhat.com/errata/', concat(text(), '.html'))}"><abbr title="{concat(@system, concat(': ', text()))}"><xsl:value-of select="text()"/></abbr></a>
+        <xsl:when test="starts-with(@system, 'https://access.redhat.com/errata')">
+            <a href="{concat('https://access.redhat.com/errata/', concat(text(), '.html'))}"><abbr title="{concat(@system, concat(': ', text()))}"><xsl:value-of select="text()"/></abbr></a>
         </xsl:when>
         <xsl:otherwise>
             <abbr title="{concat(@system, concat(': ', text()))}"><xsl:value-of select="text()"/></abbr>

From c142a763dfd92d7b304d76aecc1615729fea8533 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C5=A0imon=20Luka=C5=A1=C3=ADk?= <isimluk@fedoraproject.org>
Date: Tue, 30 Jul 2019 14:06:09 +0200
Subject: [PATCH 2/2] Transformation from OVAL to XCCDF should also assume new
 url for RH Errata

---
 xsl/oval-to-xccdf.xsl | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/xsl/oval-to-xccdf.xsl b/xsl/oval-to-xccdf.xsl
index 850ee97a2..9dd29fd58 100644
--- a/xsl/oval-to-xccdf.xsl
+++ b/xsl/oval-to-xccdf.xsl
@@ -86,9 +86,9 @@ Authors:
     </xsl:template>
 
     <xsl:template match="oval-def:reference[@source='RHSA']">
-        <xsl:if test="starts-with(@ref_url, 'https://rhn.redhat.com/errata')">
-            <xccdf:ident system="https://rhn.redhat.com/errata">
-                <xsl:copy-of select="substring-before(substring-after(@ref_url, 'https://rhn.redhat.com/errata/'), '.html')"/>
+        <xsl:if test="starts-with(@ref_url, 'https://access.redhat.com/errata')">
+            <xccdf:ident system="https://access.redhat.com/errata">
+                <xsl:copy-of select="substring-after(@ref_url, 'https://access.redhat.com/errata/')"/>
             </xccdf:ident>
         </xsl:if>
     </xsl:template>