[Secure-testing-commits] r3859 - bin
Florian Weimer
fw at costa.debian.org
Sun Apr 23 13:24:06 UTC 2006
Author: fw
Date: 2006-04-23 13:24:05 +0000 (Sun, 23 Apr 2006)
New Revision: 3859
Modified:
bin/tracker_service.py
Log:
Implement filtering vulnerabilities for which no DSA is scheduled.
bin/tracker_service.py (BugFilter):
Refactor for better extensibility.
(BugFilterNoDSA):
New class.
(TrackerService.page_status_release_stable_oldstable):
Add no-dsa filter.
Modified: bin/tracker_service.py
===================================================================
--- bin/tracker_service.py 2006-04-23 12:46:41 UTC (rev 3858)
+++ bin/tracker_service.py 2006-04-23 13:24:05 UTC (rev 3859)
@@ -15,36 +15,53 @@
from web_support import *
class BugFilter:
- def __init__(self, params):
- self.hide_medium_urgency = int(params.get('hide_medium_urgency',
- (0,))[0])
- self.hide_non_remote = int(params.get('hide_non_remote',
- (0,))[0])
+ default_action_list = [("hide_medium_urgency", "lower urgencies"),
+ ("hide_non_remote", "local vulnerabilities")]
+ def __init__(self, params, action_list=None):
+ if action_list is None:
+ self.action_list = self.default_action_list
+ else:
+ self.action_list = action_list
+ self.params = {}
+ for (prop, desc) in action_list:
+ self.params[prop] = int(params.get(prop, (0,))[0])
def actions(self, url):
"""Returns a HTML snippet which can be used to change the filter."""
- if self.hide_medium_urgency:
- urg = A(url.updateParams(hide_medium_urgency=None),
- 'Show lower urgencies')
- else:
- urg = A(url.updateParams(hide_medium_urgency='1'),
- 'Hide lower urgencies')
- if self.hide_non_remote:
- rem = A(url.updateParams(hide_non_remote=None),
- 'Show local vulnerabilities')
- else:
- rem = A(url.updateParams(hide_non_remote='1'),
- 'Hide local vulnerabilities')
- return P(urg, ' ', rem)
+ l = []
+ for (prop, desc) in self.action_list:
+ if self.params[prop]:
+ a = A(url.updateParamsDict({prop : None}),
+ 'Show ' + desc)
+ else:
+ a = A(url.updateParamsDict({prop : '1'}),
+ 'Hide ' + desc)
+ l.append(a)
+ l.append(' ')
+
+ return apply(P, l[:-1])
+
def urgencyFiltered(self, urg):
"""Returns True if the urgency urg is filtered."""
- return self.hide_medium_urgency and urg not in ("high", "unknown", "")
+ return self.params['hide_medium_urgency'] \
+ and urg not in ("high", "unknown", "")
def remoteFiltered(self, remote):
"""Returns True if the attack range is filtered."""
- return remote is not None and self.hide_non_remote and not remote
+ return remote is not None and self.params['hide_non_remote'] \
+ and not remote
+class BugFilterNoDSA(BugFilter):
+ def __init__(self, params):
+ BugFilter.__init__(self, params, self.default_action_list
+ + [('hide_nodsa', 'non-DSA vulnerabilities')])
+ self.hide_nodsa = int(params.get('hide_nodsa',(0,))[0])
+
+ def nodsaFiltered(self, nodsa):
+ """Returns True if no DSA will be issued for the bug."""
+ return nodsa and self.params['hide_nodsa']
+
class TrackerService(WebService):
head_contents = compose(STYLE(
"""h1 { font-size : 144%; }
@@ -570,18 +587,20 @@
def page_status_release_stable_oldstable(self, release, params, url):
assert release in ('stable', 'oldstable')
- bf = BugFilter(params)
+ bf = BugFilterNoDSA(params)
def gen():
old_pkg_name = ''
- for (pkg_name, bug_name, archive, urgency, remote) in \
+ for (pkg_name, bug_name, archive, urgency, remote, no_dsa) in \
self.db.cursor().execute(
- """SELECT package, bug, section, urgency, remote
+ """SELECT package, bug, section, urgency, remote, no_dsa
FROM %s_status""" % release):
if bf.urgencyFiltered(urgency):
continue
if bf.remoteFiltered(remote):
continue
+ if bf.nodsaFiltered(no_dsa):
+ continue
if pkg_name == old_pkg_name:
pkg_name = ''
@@ -598,9 +617,15 @@
remote = 'no'
if urgency == 'unknown':
- urgency = ''
+ if no_dsa:
+ urgency = 'no DSA'
+ else:
+ urgency = ''
elif urgency == 'high':
urgency = self.make_red(urgency)
+ else:
+ if no_dsa:
+ urgency = urgency + '*'
yield pkg_name, self.make_xref(url, bug_name), urgency, remote
@@ -608,7 +633,9 @@
url, 'Vulnerable source packages in the %s suite' % release,
[bf.actions(url),
make_table(gen(), caption=("Package", "Bug", "Urgency",
- "Remote"))])
+ "Remote")),
+ P('''(If a "*" is included in the urgency field, no DSA is planned
+for this vulnerability.)''')])
def page_status_release_stable(self, path, params, url):
return self.page_status_release_stable_oldstable('stable', params, url)
More information about the Secure-testing-commits
mailing list