Remove link to GitHub sponsors
[openssl-web.git] / bin / vulnerabilities.xsl
1 <?xml version="1.0"?>
2 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
3
4   <xsl:output indent="yes" encoding="UTF-8" method="html" omit-xml-declaration="yes"/>
5
6   <!-- Format a date like "1960-02-10" into "February 10th, 1960" -->
7   <xsl:template name="dateformat">
8     <xsl:param name="date" select="."/>
9     <xsl:variable name="day" select="number(substring($date,7,2))"/>
10     <xsl:variable name="month" select="number(substring($date,5,2))"/>
11     <xsl:variable name="year" select="number(substring($date,1,4))"/>
12
13     <xsl:if test="$day &gt; 0"> 
14       <xsl:value-of select="$day" />
15       <xsl:choose>
16         <xsl:when test="$day=1 or $day=21 or $day=31">st</xsl:when>
17         <xsl:when test="$day=2 or $day=22">nd</xsl:when>
18         <xsl:when test="$day=3 or $day=23">rd</xsl:when>
19         <xsl:otherwise>th</xsl:otherwise>
20       </xsl:choose>
21       <xsl:text> </xsl:text>
22     </xsl:if>
23     <xsl:choose>
24       <xsl:when test="$month=01">January</xsl:when>
25       <xsl:when test="$month=02">February</xsl:when>
26       <xsl:when test="$month=03">March</xsl:when>
27       <xsl:when test="$month=04">April</xsl:when>
28       <xsl:when test="$month=05">May</xsl:when>
29       <xsl:when test="$month=06">June</xsl:when>
30       <xsl:when test="$month=07">July</xsl:when>
31       <xsl:when test="$month=08">August</xsl:when>
32       <xsl:when test="$month=09">September</xsl:when>
33       <xsl:when test="$month=10">October</xsl:when>
34       <xsl:when test="$month=11">November</xsl:when>
35       <xsl:when test="$month=12">December</xsl:when>
36     </xsl:choose>
37     <xsl:if test="$year&gt;0">
38       <xsl:text> </xsl:text>
39       <xsl:value-of select="$year"/>
40     </xsl:if>
41   </xsl:template>
42
43   <xsl:key name="unique-date" match="@public" use="substring(.,1,4)"/>
44   <xsl:key name="unique-base" match="@base" use="."/>
45
46   <xsl:template match="security">
47     <xsl:comment>
48       Do not edit this file; edit vulnerabilities.xml
49     </xsl:comment>
50
51     <p><a name="toc">Jump to year: </a>
52       <xsl:for-each select="issue/@public[generate-id()=generate-id(key('unique-date',substring(.,1,4)))]">
53         <xsl:sort select="." order="descending"/>
54         <xsl:variable name="year" select="substring(.,1,4)"/>
55         <a href="#y{$year}"><xsl:value-of select="$year"/></a>
56         <xsl:if test="position() != last()">
57            <xsl:text>, </xsl:text>
58         </xsl:if>        
59       </xsl:for-each>
60     </p>
61
62     <xsl:for-each select="issue/@public[generate-id()=generate-id(key('unique-date',substring(.,1,4)))]">
63       <xsl:sort select="." order="descending"/>
64       <xsl:variable name="year" select="substring(.,1,4)"/>
65
66       <h3><a name="y{$year}"><xsl:value-of select="$year"/></a>
67         <!-- don't need an UP on each year.
68         <xsl:text>  </xsl:text><a href="#toc"><img src="/img/up.gif"/></a>
69         -->
70       </h3>
71       <dl>
72         <xsl:apply-templates select="../../issue[substring(@public,1,4)=$year]">
73           <xsl:sort select="./@public" order="descending"/>
74         </xsl:apply-templates>
75       </dl>
76     </xsl:for-each>
77   </xsl:template>
78
79   <xsl:template match="issue">
80     <dt>
81       <xsl:apply-templates select="cve"/>
82       <xsl:text> </xsl:text>
83       <xsl:if test="advisory/@url">
84         <a href="{advisory/@url}">(OpenSSL advisory)</a><xsl:text> </xsl:text>
85       </xsl:if>
86       <xsl:if test="impact/@severity">
87         [<xsl:value-of select="impact/@severity"/> severity]
88       </xsl:if>
89       <xsl:call-template name="dateformat">
90         <xsl:with-param name="date" select="@public"/>
91       </xsl:call-template>
92       <xsl:text disable-output-escaping='yes'>:  &lt;a href="#toc">&lt;img src="/img/up.gif"/>&lt;/a></xsl:text>
93     </dt>
94     <dd>
95       <xsl:copy-of select="string(description)"/>
96       <xsl:for-each select="reported">      
97         <xsl:if test="@source">
98           Reported by <xsl:value-of select="@source"/>
99           <xsl:if test="@date">
100             <xsl:text> on </xsl:text>
101             <xsl:call-template name="dateformat">
102               <xsl:with-param name="date" select="@date"/>
103             </xsl:call-template>
104           </xsl:if>
105           <xsl:text>.</xsl:text>
106         </xsl:if>
107       </xsl:for-each>
108       <ul>
109         <xsl:for-each select="fixed">
110           <li>Fixed in OpenSSL  
111             <xsl:value-of select="@version"/>
112             <xsl:if test="git/@hash">
113               <xsl:text> </xsl:text><a href="https://github.com/openssl/openssl/commit/{git/@hash}">(git commit)</a><xsl:text> </xsl:text>
114             </xsl:if>
115             <xsl:variable name="mybase" select="@base"/>
116             <xsl:for-each select="../affects[@base=$mybase]|../maybeaffects[@base=$mybase]">
117               <xsl:sort select="@version" order="descending"/>
118               <xsl:if test="position() =1">
119                 <xsl:text> (Affected </xsl:text>
120               </xsl:if>
121               <xsl:value-of select="@version"/>
122               <xsl:if test="name() = 'maybeaffects'">
123                 <xsl:text>?</xsl:text>
124               </xsl:if>
125               <xsl:if test="position() != last()">
126                 <xsl:text>, </xsl:text>
127               </xsl:if>
128               <xsl:if test="position() = last()">
129                 <xsl:text>) </xsl:text>
130               </xsl:if>
131             </xsl:for-each>
132           </li>
133         </xsl:for-each>
134       </ul>
135     </dd>
136   </xsl:template>
137
138   <xsl:template match="cve">
139     <xsl:if test="@name != ''">
140       <b><a name="{@name}">
141           <xsl:if test="@description = 'full'">
142             The Common Vulnerabilities and Exposures project
143             has assigned the name 
144           </xsl:if>
145           <a href="https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-{@name}">CVE-<xsl:value-of select="@name"/> </a>
146           <xsl:if test="@description = 'full'">
147             to this issue.
148           </xsl:if>
149       </a></b>
150     </xsl:if>
151   </xsl:template>
152
153 </xsl:stylesheet>