Merge lp:~cjwatson/launchpad/cve-update-namespace into lp:launchpad

Proposed by Colin Watson
Status: Merged
Merged at revision: 18178
Proposed branch: lp:~cjwatson/launchpad/cve-update-namespace
Merge into: lp:launchpad
Diff against target: 328 lines (+242/-19)
4 files modified
lib/lp/bugs/doc/cve-update.txt (+29/-18)
lib/lp/bugs/scripts/cveimport.py (+1/-1)
lib/lp/bugs/tests/data/cvedb_init.xml (+85/-0)
lib/lp/bugs/tests/data/cvedb_update.xml (+127/-0)
To merge this branch: bzr merge lp:~cjwatson/launchpad/cve-update-namespace
Reviewer Review Type Date Requested Status
William Grant code Approve
Review via email: mp+303041@code.launchpad.net

Commit message

Update CVE database XML namespace to match current file on cve.mitre.org.

Description of the change

It seems that cve.mitre.org recently made a slight change to the format of their allitems.xml.gz file (appending "/1.0" to the XML namespace), so update-cve is failing with OOPS-7f53d265afdaa4bfc02ea74330c001e6 and similar. This updates our parser to cope.

To post a comment you must log in.
Revision history for this message
William Grant (wgrant) :
review: Approve (code)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/lp/bugs/doc/cve-update.txt'
2--- lib/lp/bugs/doc/cve-update.txt 2011-12-29 05:29:36 +0000
3+++ lib/lp/bugs/doc/cve-update.txt 2016-08-16 16:14:41 +0000
4@@ -12,7 +12,12 @@
5 and it does not attempt to connect to the outside world to verify that is
6 the case.
7
8- >>> import subprocess, os.path, sys
9+ >>> import gzip
10+ >>> import os.path
11+ >>> import shutil
12+ >>> import subprocess
13+ >>> import sys
14+ >>> import tempfile
15 >>> import transaction
16 >>> from lp.services.config import config
17
18@@ -24,18 +29,28 @@
19 10
20
21 >>> script = os.path.join(config.root, 'cronscripts', 'update-cve.py')
22- >>> url_base = os.path.join(
23- ... config.root, 'lib', 'lp', 'bugs', 'tests', 'data'
24- ... )
25+ >>> base = os.path.join(config.root, 'lib', 'lp', 'bugs', 'tests', 'data')
26
27 Now run the cronscript.
28
29- >>> url = 'file://%s' % os.path.join(url_base, 'cvedb_init.xml.gz')
30- >>> process = subprocess.Popen(
31- ... [sys.executable, script, '-u', url], stdin=subprocess.PIPE,
32- ... stdout=subprocess.PIPE, stderr=subprocess.STDOUT,
33- ... )
34- >>> (output, empty) = process.communicate()
35+ >>> def update_from_file(path):
36+ ... tempdir = tempfile.mkdtemp()
37+ ... compressed_path = os.path.join(
38+ ... tempdir, os.path.basename(path) + '.gz')
39+ ... try:
40+ ... with open(path, 'rb') as uncompressed:
41+ ... with gzip.open(compressed_path, 'wb') as compressed:
42+ ... shutil.copyfileobj(uncompressed, compressed)
43+ ... url = 'file://%s' % compressed_path
44+ ... process = subprocess.Popen(
45+ ... [sys.executable, script, '-u', url],
46+ ... stdin=subprocess.PIPE, stdout=subprocess.PIPE,
47+ ... stderr=subprocess.STDOUT)
48+ ... return process.communicate()
49+ ... finally:
50+ ... shutil.rmtree(tempdir)
51+
52+ >>> output, empty = update_from_file(os.path.join(base, 'cvedb_init.xml'))
53 >>> print output
54 INFO Creating lockfile: /var/lock/launchpad-updatecve.lock
55 ...
56@@ -63,7 +78,7 @@
57 ...
58 <BLANKLINE>
59
60-And lets make sure we got the right number of CVE entries.
61+And let's make sure we got the right number of CVE entries.
62
63 >>> transaction.commit()
64 >>> print Cve.select().count()
65@@ -84,12 +99,8 @@
66
67 Now, let's run an import of the update db.
68
69- >>> url = 'file://%s' % os.path.join(url_base, 'cvedb_update.xml.gz')
70- >>> process = subprocess.Popen(
71- ... [sys.executable, script, '-u', url], stdin=subprocess.PIPE,
72- ... stdout=subprocess.PIPE, stderr=subprocess.STDOUT,
73- ... )
74- >>> (output, empty) = process.communicate()
75+ >>> output, empty = update_from_file(
76+ ... os.path.join(base, 'cvedb_update.xml'))
77 >>> print output
78 INFO Creating lockfile: /var/lock/launchpad-updatecve.lock
79 ...
80@@ -129,7 +140,7 @@
81 >>> print Cve.select().count()
82 21
83
84-And lets make sure the modification time of 2005-2734 was updated, as were
85+And let's make sure the modification time of 2005-2734 was updated, as were
86 the number of comments.
87
88 >>> c.sync()
89
90=== modified file 'lib/lp/bugs/scripts/cveimport.py'
91--- lib/lp/bugs/scripts/cveimport.py 2015-07-08 16:05:11 +0000
92+++ lib/lp/bugs/scripts/cveimport.py 2016-08-16 16:14:41 +0000
93@@ -33,7 +33,7 @@
94 )
95
96
97-CVEDB_NS = '{http://cve.mitre.org/cve/downloads}'
98+CVEDB_NS = '{http://cve.mitre.org/cve/downloads/1.0}'
99
100
101 def getText(elem):
102
103=== added file 'lib/lp/bugs/tests/data/cvedb_init.xml'
104--- lib/lp/bugs/tests/data/cvedb_init.xml 1970-01-01 00:00:00 +0000
105+++ lib/lp/bugs/tests/data/cvedb_init.xml 2016-08-16 16:14:41 +0000
106@@ -0,0 +1,85 @@
107+<?xml version="1.0"?>
108+<cve xmlns="http://cve.mitre.org/cve/downloads/1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
109+
110+<item type="CVE" name="CVE-1999-0002" seq="1999-0002">
111+<desc>Buffer overflow in NFS mountd gives root access to remote attackers, mostly in Linux systems.</desc>
112+<refs>
113+<ref source="SGI">19981006-01-I</ref>
114+<ref source="BID">121</ref>
115+<ref source="XF">linux-mountd-bo</ref>
116+</refs>
117+</item>
118+
119+<item type="CVE" name="CVE-1999-0003" seq="1999-0003">
120+<desc>Execute commands as root via buffer overflow in Tooltalk database server (rpc.ttdbserverd)</desc>
121+<refs>
122+<ref source="CERT">CA-98.11.tooltalk</ref>
123+<ref source="SGI">19981101-01-A</ref>
124+<ref source="XF">aix-ttdbserver</ref>
125+<ref source="XF">tooltalk</ref>
126+</refs>
127+</item>
128+
129+<item type="CVE" name="CVE-1999-0005" seq="1999-0005">
130+<desc>Arbitrary command execution via IMAP buffer overflow in authenticate command.</desc>
131+<refs>
132+<ref source="CERT">CA-98.09.imapd</ref>
133+<ref source="BID">130</ref>
134+</refs>
135+</item>
136+
137+<item type="CVE" name="CVE-1999-0007" seq="1999-0007">
138+<desc>Information from encrypted sessions via PKCS #1</desc>
139+<refs>
140+<ref source="CERT">CA-98.07.PKCS</ref>
141+<ref source="XF">nt-ssl-fix</ref>
142+</refs>
143+</item>
144+
145+<item type="CAN" name="CAN-2005-2761" seq="2005-2761">
146+<phase date="20050831">Assigned</phase>
147+<desc>Cross-site scripting (XSS) vulnerability in phpGroupWare 0.9.16.000 allows administrators to inject arbitrary web script or HTML by modifying the main screen message.</desc>
148+<refs>
149+<ref source="MISC" url="http://savannah.gnu.org/bugs/?func=detailitem&amp;item_id=13863">http://savannah.gnu.org/bugs/?func=detailitem&amp;item_id=13863</ref>
150+<ref source="DEBIAN" url="http://www.debian.org/security/2005/dsa-798">DSA-798</ref>
151+</refs>
152+<votes>
153+</votes>
154+<comments>
155+</comments>
156+</item>
157+
158+<item type="CAN" name="CAN-2005-2762" seq="2005-2762">
159+<phase date="20050831">Assigned</phase>
160+<desc>** RESERVED ** This candidate has been reserved by an organization or individual that will use it when announcing a new security problem. When the candidate has been publicized, the details for this candidate will be provided.</desc>
161+<refs>
162+</refs>
163+<votes>
164+</votes>
165+<comments>
166+</comments>
167+</item>
168+
169+<item type="CAN" name="CAN-2005-2763" seq="2005-2763">
170+<phase date="20050901">Assigned</phase>
171+<desc>** RESERVED ** This candidate has been reserved by an organization or individual that will use it when announcing a new security problem. When the candidate has been publicized, the details for this candidate will be provided.</desc>
172+<refs>
173+</refs>
174+<votes>
175+</votes>
176+<comments>
177+</comments>
178+</item>
179+
180+<item type="CAN" name="CAN-2005-2764" seq="2005-2764">
181+<phase date="20050901">Assigned</phase>
182+<desc>** RESERVED ** This candidate has been reserved by a company or individual that will use it when announcing a new security problem. When the candidate has been publicized, the details for this candidate will be provided.</desc>
183+<refs>
184+</refs>
185+<votes>
186+</votes>
187+<comments>
188+</comments>
189+</item>
190+
191+</cve>
192
193=== removed file 'lib/lp/bugs/tests/data/cvedb_init.xml.gz'
194Binary files lib/lp/bugs/tests/data/cvedb_init.xml.gz 2011-12-21 18:40:25 +0000 and lib/lp/bugs/tests/data/cvedb_init.xml.gz 1970-01-01 00:00:00 +0000 differ
195=== added file 'lib/lp/bugs/tests/data/cvedb_update.xml'
196--- lib/lp/bugs/tests/data/cvedb_update.xml 1970-01-01 00:00:00 +0000
197+++ lib/lp/bugs/tests/data/cvedb_update.xml 2016-08-16 16:14:41 +0000
198@@ -0,0 +1,127 @@
199+<?xml version="1.0"?>
200+<cve xmlns="http://cve.mitre.org/cve/downloads/1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
201+<item type="CVE" name="CVE-1999-0002" seq="1999-0002">
202+<desc>Buffer overflow in NFS mountd gives root access to remote attackers, mostly in Linux systems.</desc>
203+<refs>
204+<ref source="SGI">19981006-01-I</ref>
205+<ref source="CERT">CA-98.12.mountd</ref>
206+<ref source="CIAC">J-006</ref>
207+<ref source="BID">121</ref>
208+<ref source="XF">linux-mountd-bo</ref>
209+</refs>
210+</item>
211+
212+<item type="CVE" name="CVE-1999-0003" seq="1999-0003">
213+<desc>Execute commands as root via buffer overflow in Tooltalk database server (rpc.ttdbserverd)</desc>
214+<refs>
215+<ref source="NAI">NAI-29</ref>
216+<ref source="CERT">CA-98.11.tooltalk</ref>
217+<ref source="SGI">19981101-01-A</ref>
218+<ref source="SGI">19981101-01-PX</ref>
219+<ref source="XF">aix-ttdbserver</ref>
220+<ref source="XF">tooltalk</ref>
221+<ref source="BID">122</ref>
222+</refs>
223+</item>
224+
225+<item type="CVE" name="CVE-1999-0005" seq="1999-0005">
226+<desc>Arbitrary command execution via IMAP buffer overflow in authenticate command.</desc>
227+<refs>
228+<ref source="CERT">CA-98.09.imapd</ref>
229+<ref source="SUN">00177</ref>
230+<ref source="BID">130</ref>
231+<ref source="XF">imap-authenticate-bo</ref>
232+</refs>
233+</item>
234+
235+<item type="CVE" name="CVE-1999-0006" seq="1999-0006">
236+<desc>Buffer overflow in POP servers based on BSD/Qualcomm's qpopper allows remote attackers to gain root access using a long PASS command.</desc>
237+<refs>
238+<ref source="CERT">CA-98.08.qpopper_vul</ref>
239+<ref source="SGI">19980801-01-I</ref>
240+<ref source="AUSCERT">AA-98.01</ref>
241+<ref source="XF">qpopper-pass-overflow</ref>
242+<ref source="BID">133</ref>
243+</refs>
244+</item>
245+
246+<item type="CVE" name="CVE-1999-0007" seq="1999-0007">
247+<desc>Information from SSL-encrypted sessions via PKCS #1</desc>
248+<refs>
249+<ref source="CERT">CA-98.07.PKCS</ref>
250+<ref source="XF">nt-ssl-fix</ref>
251+</refs>
252+</item>
253+
254+<item type="CAN" name="CAN-2005-2761" seq="2005-2761">
255+<phase date="20050831">Assigned</phase>
256+<desc>Cross-site scripting (XSS) vulnerability in phpGroupWare 0.9.16.000 allows administrators to inject arbitrary web script or HTML by modifying the main screen message.</desc>
257+<refs>
258+<ref source="MISC" url="http://savannah.gnu.org/bugs/?func=detailitem&amp;item_id=13863">http://savannah.gnu.org/bugs/?func=detailitem&amp;item_id=13863</ref>
259+<ref source="DEBIAN" url="http://www.debian.org/security/2005/dsa-798">DSA-798</ref>
260+<ref source="SECUNIA" url="http://secunia.com/advisories/16558">16558</ref>
261+</refs>
262+<votes>
263+</votes>
264+<comments>
265+</comments>
266+</item>
267+
268+<item type="CAN" name="CAN-2005-2734" seq="2005-2734">
269+<phase date="20050831">Assigned</phase>
270+<desc>** RESERVED ** This candidate has been reserved by an organization or individual that will use it when announcing a new security problem. When the candidate has been publicized, the details for this candidate will be provided.</desc>
271+<refs>
272+</refs>
273+<votes>
274+</votes>
275+<comments>
276+</comments>
277+</item>
278+
279+<item type="CAN" name="CAN-2005-2763" seq="2005-2763">
280+<phase date="20050901">Assigned</phase>
281+<desc>** RESERVED ** This candidate has been reserved by an organization or individual that will use it when announcing a new security problem. When the candidate has been publicized, the details for this candidate will be provided.</desc>
282+<refs>
283+</refs>
284+<votes>
285+</votes>
286+<comments>
287+</comments>
288+</item>
289+
290+<item type="CAN" name="CAN-2005-2764" seq="2005-2764">
291+<phase date="20050901">Assigned</phase>
292+<desc>** RESERVED ** This candidate has been reserved by an organization or individual that will use it when announcing a new security problem. When the candidate has been publicized, the details for this candidate will be provided.</desc>
293+<refs>
294+</refs>
295+<votes>
296+</votes>
297+<comments>
298+</comments>
299+</item>
300+
301+<item type="CAN" name="CAN-2005-2765" seq="2005-2765">
302+<phase date="20050901">Assigned</phase>
303+<desc>The user interface in the Windows Firewall does not properly display certain malformed entries in the Windows Registry, which makes it easier for attackers with administrator privileges to hide activities if the administrator only uses the Windows Firewall interface to monitor exceptions. NOTE: the vendor disputes this issue, saying that since administrative privileges are already required, it is not a vulnerability. CVE has not yet formally decided if such &quot;information hiding&quot; issues should be included.</desc>
304+<refs>
305+<ref source="MSKB" url="http://www.microsoft.com/technet/security/advisory/897663.mspx">897663</ref>
306+</refs>
307+<votes>
308+</votes>
309+<comments>
310+</comments>
311+</item>
312+
313+<item type="CAN" name="CAN-2005-2766" seq="2005-2766">
314+<phase date="20050902">Assigned</phase>
315+<desc>Symantec AntiVirus Corporate Edition 9.0.1.x and 9.0.4.x, and possibly other versions, when obtaining updates from an internal LiveUpdate server, stored sensitive information in cleartext in the Log.Liveupdate log file, which allows attackers to obtain the username and password to the internal LiveUpdate server.</desc>
316+<refs>
317+<ref source="BUGTRAQ" url="http://marc.theaimsgroup.com/?l=bugtraq&amp;m=112552401413998&amp;w=2">20050831 Vulnerability in Symantec Anti Virus Corporate Edition v9.x</ref>
318+</refs>
319+<votes>
320+</votes>
321+<comments>
322+</comments>
323+</item>
324+
325+</cve>
326
327=== removed file 'lib/lp/bugs/tests/data/cvedb_update.xml.gz'
328Binary files lib/lp/bugs/tests/data/cvedb_update.xml.gz 2011-12-21 18:40:25 +0000 and lib/lp/bugs/tests/data/cvedb_update.xml.gz 1970-01-01 00:00:00 +0000 differ