[PATCH 02 of 54] Add support for AggregateSeverity
Wald Commits
scm-commit at wald.intevation.org
Wed Jan 7 10:56:19 CET 2015
# HG changeset patch
# User Benoît Allard <benoit.allard at greenbone.net>
# Date 1411540016 -7200
# Node ID d47e1164740f5372a1b1126b7b605ff36b5f40f5
# Parent e18b61a73a68e17b99c5db604f133eed4e20aa2f
Add support for AggregateSeverity
diff -r e18b61a73a68 -r d47e1164740f farolluz/cvrf.py
--- a/farolluz/cvrf.py Tue Sep 23 15:19:14 2014 +0200
+++ b/farolluz/cvrf.py Wed Sep 24 08:26:56 2014 +0200
@@ -200,6 +200,14 @@
return self._note
+class CVRFAggregateSeverity(object):
+ def __init__(self, severity):
+ self._severity = severity
+ self._namespace = None
+
+ def setNamespace(self, namespace):
+ self._namespace = namespace
+
class CVRFReference(object):
TYPES = ('Self', 'External')
def __init__(self, url, description, _type=None):
@@ -885,6 +893,7 @@
self._tracking = None
self._notes = []
self._distribution = None
+ self._aggregateseverity = None
self._references = []
self._acknowledgments = []
self._producttree = None
@@ -902,6 +911,9 @@
def setDistribution(self, distribution):
self._distribution = distribution
+ def setAggregateSeverity(self, aggregateseverity):
+ self._aggregateseverity = aggregateseverity
+
def addReference(self, ref):
self._references.append(ref)
diff -r e18b61a73a68 -r d47e1164740f farolluz/parsers/cvrf.py
--- a/farolluz/parsers/cvrf.py Tue Sep 23 15:19:14 2014 +0200
+++ b/farolluz/parsers/cvrf.py Wed Sep 24 08:26:56 2014 +0200
@@ -42,7 +42,7 @@
CVRFAcknowledgment, CVRFProductBranch, CVRFFullProductName, CVRFGenerator,
CVRFRelationship, CVRFVulnerability, CVRFVulnerabilityID, CVRFThreat,
CVRFProductStatus, CVRFCVSSSet, CVRFReference, CVRFRemediation, CVRFGroup,
- CVRFInvolvement, CVRFCWE, CVRFTrackingID)
+ CVRFInvolvement, CVRFCWE, CVRFTrackingID, CVRFAggregateSeverity)
NAMESPACES = {
'cvrf': "http://www.icasi.org/CVRF/schema/cvrf/1.1",
@@ -298,6 +298,11 @@
# This is in a quite free format, not sure how to do something with it ...
xmlaggsev = cvrfdoc.find(UN('cvrf', 'AggregateSeverity'))
+ if xmlaggsev is not None:
+ aggsev = CVRFAggregateSeverity(xmlaggsev.text.strip())
+ if 'Namespace' in xmlaggsev.attrib:
+ aggsev.setNamespace(xmlaggsev.attrib['Namespace'])
+ doc.setAggregateSeverity(aggsev)
for xmlref in cvrfdoc.findall('/'.join([UN('cvrf', 'DocumentReferences'), UN('cvrf', 'Reference')])):
doc.addReference(parseReference(xmlref))
diff -r e18b61a73a68 -r d47e1164740f farolluz/templates/cvrf.j2
--- a/farolluz/templates/cvrf.j2 Tue Sep 23 15:19:14 2014 +0200
+++ b/farolluz/templates/cvrf.j2 Wed Sep 24 08:26:56 2014 +0200
@@ -99,7 +99,11 @@
{%- if cvrf._distribution %}
<DocumentDistribution>{{ cvrf._distribution }}</DocumentDistribution>
{%- endif %}
- {#- AggregateSeverity is missing #}
+ {%- if cvrf._aggregateseverity %}
+ <AggregateSeverity{{ {'Namespace': cvrf._aggregateseverity._namespace} | xmlattr }}>
+ {{- cvrf._aggregateseverity._severity -}}
+ </AggregateSeverity>
+ {%- endif %}
{%- if cvrf._references %}
<DocumentReferences>
{%- for reference in cvrf._references %}
More information about the Farol-commits
mailing list