changeset 13:db2a02fff101

Improve validation
author Benoît Allard <benoit.allard@greenbone.net>
date Wed, 08 Oct 2014 14:49:49 +0200
parents 848fd86d9cbc
children 640b88744523
files CHANGES farolluz/cvrf.py
diffstat 2 files changed, 12 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/CHANGES	Wed Oct 08 12:48:32 2014 +0200
+++ b/CHANGES	Wed Oct 08 14:49:49 2014 +0200
@@ -13,6 +13,7 @@
 * Add method to get a Vulnerability Note per ordinal.
 * Fix issue where Acknowledgment could only have one Name and Organization.
 * Complete the CVRF template with missing elements
+* Improve validation.
 
 
 FarolLuz 0.1 (2014-09-23)
--- a/farolluz/cvrf.py	Wed Oct 08 12:48:32 2014 +0200
+++ b/farolluz/cvrf.py	Wed Oct 08 14:49:49 2014 +0200
@@ -685,10 +685,21 @@
             cwe.validate()
         for status in self._productstatuses:
             status.validate(productids)
+        pids = set()
+        for status in self._productstatuses:
+            for pid in status._productids:
+                if pid in pids:
+                    raise ValidationError('ProductID %s mentionned in two different ProductStatuses for Vulnerability %d' % (pid, self._ordinal))
+                pids.add(pid)
         for threat in self._threats:
             threat.validate(productids, groupids)
         for cvss in self._cvsss:
             cvss.validate(productids)
+        for cvss in self._cvsss:
+            for pid in (cvss._productids or productids):
+                if pid in pids:
+                    raise ValidationError('ProductID %s mentionned in two different CVSS Score Sets for Vulnerability %d' % (pid, self._ordinal))
+                pids.add(pid)
         for remediation in self._remediations:
             remediation.validate(productids, groupids)
         for reference in self._references:
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)