[PATCH 14 of 54] Improve validation

Wald Commits scm-commit at wald.intevation.org
Wed Jan 7 10:56:31 CET 2015


# HG changeset patch
# User Benoît Allard <benoit.allard at greenbone.net>
# Date 1412772589 -7200
# Node ID db2a02fff10159cc9f78ed37f4e619ad19261cb2
# Parent  848fd86d9cbcc1d605ec9d73a5fb0846d8d98e26
Improve validation

diff -r 848fd86d9cbc -r db2a02fff101 CHANGES
--- 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)
diff -r 848fd86d9cbc -r db2a02fff101 farolluz/cvrf.py
--- 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:


More information about the Farol-commits mailing list