public inbox for gentoo-portage-dev@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-portage-dev] [PATCH] portage/glsa.py: only check for revisions based on GLSA DTD
@ 2019-08-13 21:19 Aaron Bauman
  0 siblings, 0 replies; only message in thread
From: Aaron Bauman @ 2019-08-13 21:19 UTC (permalink / raw
  To: gentoo-portage-dev; +Cc: Aaron Bauman

* All GLSA's have been converted to use the revision attribute
* Only check that the revision attribute is populated which defaults to 1 from
tooling (e.g. GLSAMaker)
* If there is no count attribute then raise a GlsaFormatException
* Remove 'try' logic as we already check if the attribute is populated
* We only check if the attribute is populated. Whether it is an int or not is
not a concern as it is only significant to security team.

Signed-off-by: Aaron Bauman <bman@gentoo.org>
---
 lib/portage/glsa.py | 14 ++------------
 1 file changed, 2 insertions(+), 12 deletions(-)

diff --git a/lib/portage/glsa.py b/lib/portage/glsa.py
index ccf93439d..f0ce34f3f 100644
--- a/lib/portage/glsa.py
+++ b/lib/portage/glsa.py
@@ -528,26 +528,16 @@ class Glsa:
 		self.synopsis = getText(myroot.getElementsByTagName("synopsis")[0], format="strip")
 		self.announced = format_date(getText(myroot.getElementsByTagName("announced")[0], format="strip"))
 
-		# Support both formats of revised:
-		# <revised>December 30, 2007: 02</revised>
+		# Support only format defined in GLSA DTD
 		# <revised count="2">2007-12-30</revised>
 		revisedEl = myroot.getElementsByTagName("revised")[0]
 		self.revised = getText(revisedEl, format="strip")
 		count = revisedEl.getAttribute("count")
 		if not count:
-			if self.revised.find(":") >= 0:
-				(self.revised, count) = self.revised.split(":")
-			else:
-				count = 1
+			raise GlsaFormatException("Invalid revision attribute in GLSA: " + myroot.getAttribute("id"))
 
 		self.revised = format_date(self.revised)
 
-		try:
-			self.count = int(count)
-		except ValueError:
-			# TODO should this raise a GlsaFormatException?
-			self.count = 1
-
 		# now the optional and 0-n toplevel, #PCDATA tags and references
 		try:
 			self.access = getText(myroot.getElementsByTagName("access")[0], format="strip")
-- 
2.22.0



^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2019-08-13 21:19 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-08-13 21:19 [gentoo-portage-dev] [PATCH] portage/glsa.py: only check for revisions based on GLSA DTD Aaron Bauman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox