Skip to content

Commit

Permalink
Merge branch 'main' into add-epss-to-vts
Browse files Browse the repository at this point in the history
  • Loading branch information
timopollmeier authored Jun 5, 2024
2 parents d748db4 + f834093 commit 12c5bec
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 18 deletions.
39 changes: 26 additions & 13 deletions src/manage_sql_secinfo.c
Original file line number Diff line number Diff line change
Expand Up @@ -2491,7 +2491,6 @@ static int
insert_cve_from_entry (element_t entry, element_t last_modified,
GHashTable *hashed_cpes, int *transaction_size)
{
gboolean cvss_is_v3;
element_t published, summary, cvss, score, base_metrics, cvss_vector, list;
double severity_dbl;
gchar *quoted_id, *quoted_summary, *quoted_cvss_vector;
Expand All @@ -2518,21 +2517,36 @@ insert_cve_from_entry (element_t entry, element_t last_modified,
return -1;
}

cvss = element_child (entry, "vuln:cvss3");
gchar *base_metrics_element = "cvss:base_metrics";
gchar *score_element = "cvss:score";
gchar *cvss_vector_element = "cvss:vector-string";

cvss = element_child (entry, "vuln:cvss4");
if (cvss == NULL)
{
cvss = element_child (entry, "vuln:cvss");
cvss_is_v3 = FALSE;
cvss = element_child (entry, "vuln:cvss3");
if (cvss == NULL)
{
cvss = element_child (entry, "vuln:cvss");
}
else
{
base_metrics_element = "cvss3:base_metrics";
score_element = "cvss3:base-score";
cvss_vector_element = "cvss3:vector-string";
}
}
else
cvss_is_v3 = TRUE;
{
base_metrics_element = "cvss4:base_metrics";
score_element = "cvss4:base-score";
cvss_vector_element = "cvss4:vector-string";
}

if (cvss == NULL)
base_metrics = NULL;
else
base_metrics = element_child (cvss,
cvss_is_v3 ? "cvss3:base_metrics"
: "cvss:base_metrics");
base_metrics = element_child (cvss, base_metrics_element);

if (base_metrics == NULL)
{
Expand All @@ -2541,18 +2555,17 @@ insert_cve_from_entry (element_t entry, element_t last_modified,
}
else
{
score = element_child (base_metrics,
cvss_is_v3 ? "cvss3:base-score" : "cvss:score");
score = element_child (base_metrics, score_element);

if (score == NULL)
{
g_warning ("%s: cvss:score missing for %s", __func__, id);
g_free (id);
return -1;
}

cvss_vector = element_child (base_metrics,
cvss_is_v3 ? "cvss3:vector-string"
: "cvss:vector-string");
cvss_vector = element_child (base_metrics, cvss_vector_element);

if (cvss_vector == NULL)
{
g_warning ("%s: cvss:access-vector missing for %s", __func__, id);
Expand Down
13 changes: 8 additions & 5 deletions src/schema_formats/HTML/HTML.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.

<xsl:apply-templates select="description"/>

<details>
<details open="">
<xsl:call-template name="details-summary-4">
<xsl:with-param name="text" select="concat($index, '.1 RNC')"/>
</xsl:call-template>
Expand Down Expand Up @@ -427,7 +427,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
<xsl:with-param name="text" select="concat($index, '.1 Structure')"/>
</xsl:call-template>

<ul style="list-style: none">
<ul style="list-style: none; padding-left: 10px;">
<li>
<xsl:call-template name="command-structure"/>
</li>
Expand Down Expand Up @@ -656,11 +656,14 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
</xsl:template>

<xsl:template name="command-structure">
<ul style="list-style: none">
<ul style="list-style: none; border: 1px solid #F5F5F5; border-radius: 4px; margin-left: 2%; padding: 10px; background: #F5F5F5;">
<xsl:choose>
<xsl:when test="(count(pattern/*) = 0) and (string-length(normalize-space(pattern)) = 0)">
<i>Empty single element.</i>
</xsl:when>
<xsl:when test="(count(pattern/*) = 0)">
<xsl:value-of select="pattern"/>
</xsl:when>
<xsl:otherwise>
<xsl:variable name="command" select="."/>
<xsl:for-each select="pattern/*">
Expand Down Expand Up @@ -693,11 +696,11 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.

<ul style="list-style: none">
<li>
<i>Command</i>
<div style="padding-bottom: 5px;"><i>Command</i></div>
<xsl:call-template name="command-structure"/>
</li>
<li style="margin-top: 15px;">
<i>Response</i>
<div style="padding-bottom: 5px;"><i>Response</i></div>
<xsl:for-each select="response">
<xsl:call-template name="command-structure"/>
</xsl:for-each>
Expand Down

0 comments on commit 12c5bec

Please sign in to comment.