/[secure-testing]/bin/tracker_service.py
ViewVC logotype

Diff of /bin/tracker_service.py

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 3597 by fw, Sat Mar 11 18:44:21 2006 UTC revision 5100 by fw, Sun Dec 10 17:35:42 2006 UTC
# Line 15  import security_db Line 15  import security_db
15  from web_support import *  from web_support import *
16    
17  class BugFilter:  class BugFilter:
18      def __init__(self, params):      default_action_list = [("hide_medium_urgency", "lower urgencies"),
19          self.hide_medium_urgency = int(params.get('hide_medium_urgency',                             ("hide_non_remote", "local vulnerabilities")]
20                                                    (0,))[0])      def __init__(self, params, action_list=None):
21          self.hide_non_remote = int(params.get('hide_non_remote',          if action_list is None:
22                                                (0,))[0])              self.action_list = self.default_action_list
23            else:
24                self.action_list = action_list
25            self.params = {}
26            for (prop, desc) in self.action_list:
27                self.params[prop] = int(params.get(prop, (0,))[0])
28    
29      def actions(self, url):      def actions(self, url):
30          """Returns a HTML snippet which can be used to change the filter."""          """Returns a HTML snippet which can be used to change the filter."""
31          if self.hide_medium_urgency:  
32              urg = A(url.updateParams(hide_medium_urgency=None),          l = []
33                      'Show lower urgencies')          for (prop, desc) in self.action_list:
34          else:              if self.params[prop]:
35              urg = A(url.updateParams(hide_medium_urgency='1'),                  a = A(url.updateParamsDict({prop : None}),
36                      'Hide lower urgencies')                        'Show ' + desc)
37          if self.hide_non_remote:              else:
38              rem = A(url.updateParams(hide_non_remote=None),                  a = A(url.updateParamsDict({prop : '1'}),
39                      'Show local vulnerabilities')                        'Hide ' + desc)
40          else:              l.append(a)
41              rem = A(url.updateParams(hide_non_remote='1'),              l.append(' ')
42                      'Hide local vulnerabilities')  
43          return P(urg, ' ', rem)          return apply(P, l[:-1])
44    
45      def urgencyFiltered(self, urg):      def urgencyFiltered(self, urg):
46          """Returns True if the urgency urg is filtered."""          """Returns True if the urgency urg is filtered."""
47          return self.hide_medium_urgency and urg not in ("high", "unknown", "")          return self.params['hide_medium_urgency'] \
48                   and urg not in ("high", "unknown", "")
49    
50      def remoteFiltered(self, remote):      def remoteFiltered(self, remote):
51          """Returns True if the attack range is filtered."""          """Returns True if the attack range is filtered."""
52          return remote is not None and self.hide_non_remote and not remote          return remote is not None and self.params['hide_non_remote'] \
53                   and not remote
54    
55    class BugFilterNoDSA(BugFilter):
56        def __init__(self, params):
57            BugFilter.__init__(self, params, self.default_action_list
58                + [('hide_nodsa', 'non-DSA vulnerabilities')])
59            self.hide_nodsa = int(params.get('hide_nodsa',(0,))[0])
60    
61        def nodsaFiltered(self, nodsa):
62            """Returns True if no DSA will be issued for the bug."""
63            return nodsa and self.params['hide_nodsa']
64    
65  class TrackerService(WebService):  class TrackerService(WebService):
66      head_contents = compose(STYLE(      head_contents = compose(STYLE(
# Line 127  by Debian's security team located in the Line 144  by Debian's security team located in the
144              A("http://nvd.nist.gov/", "National Vulnerability Database"),              A("http://nvd.nist.gov/", "National Vulnerability Database"),
145              """ (NVD), maintained by NIST; and security issues              """ (NVD), maintained by NIST; and security issues
146  discovered in Debian packages as reported in the BTS."""),  discovered in Debian packages as reported in the BTS."""),
147               P("""All exteral data (including Debian bug reports and official Debian               P("""All external data (including Debian bug reports and official Debian
148  security advisories) must be added to this database before it appears  security advisories) must be added to this database before it appears
149  here. Please help us keep this information up-to-date by """,  here. Please help us keep this information up-to-date by """,
150                 A(url.scriptRelative("data/report"), "reporting"),                 A(url.scriptRelative("data/report"), "reporting"),
151                 """ any discrepancies or change of states that you are                 """ any discrepancies or change of states that you are
152  aware of and/or help us improve the quality of this information by """,  aware of and/or help us improve the quality of this information by """,
153                 A(url.scriptRelative("data/report"), "participiating"),                 A(url.scriptRelative("data/report"), "participating"),
154                 "."),                 "."),
155              make_menu(              make_menu(
156              url.scriptRelative,              url.scriptRelative,
# Line 570  this package, but still reference it.""" Line 587  this package, but still reference it."""
587      def page_status_release_stable_oldstable(self, release, params, url):      def page_status_release_stable_oldstable(self, release, params, url):
588          assert release in ('stable', 'oldstable')          assert release in ('stable', 'oldstable')
589    
590          bf = BugFilter(params)          bf = BugFilterNoDSA(params)
591    
592          def gen():          def gen():
593              old_pkg_name = ''              old_pkg_name = ''
594              for (pkg_name, bug_name, archive, urgency, remote) in \              for (pkg_name, bug_name, archive, urgency, remote, no_dsa) in \
595                      self.db.cursor().execute(                      self.db.cursor().execute(
596                  """SELECT package, bug, section, urgency, remote                  """SELECT package, bug, section, urgency, remote, no_dsa
597                  FROM %s_status""" % release):                  FROM %s_status""" % release):
598                  if bf.urgencyFiltered(urgency):                  if bf.urgencyFiltered(urgency):
599                      continue                      continue
600                  if bf.remoteFiltered(remote):                  if bf.remoteFiltered(remote):
601                      continue                      continue
602                    if bf.nodsaFiltered(no_dsa):
603                        continue
604    
605                  if pkg_name == old_pkg_name:                  if pkg_name == old_pkg_name:
606                      pkg_name = ''                      pkg_name = ''
# Line 598  this package, but still reference it.""" Line 617  this package, but still reference it."""
617                      remote = 'no'                      remote = 'no'
618    
619                  if urgency == 'unknown':                  if urgency == 'unknown':
620                      urgency = ''                      if no_dsa:
621                            urgency = 'no DSA'
622                        else:
623                            urgency = ''
624                  elif urgency == 'high':                  elif urgency == 'high':
625                      urgency = self.make_red(urgency)                      urgency = self.make_red(urgency)
626                    else:
627                        if no_dsa:
628                            urgency = urgency + '*'
629    
630                  yield pkg_name, self.make_xref(url, bug_name), urgency, remote                  yield pkg_name, self.make_xref(url, bug_name), urgency, remote
631    
# Line 608  this package, but still reference it.""" Line 633  this package, but still reference it."""
633              url, 'Vulnerable source packages in the %s suite' % release,              url, 'Vulnerable source packages in the %s suite' % release,
634              [bf.actions(url),              [bf.actions(url),
635               make_table(gen(), caption=("Package", "Bug", "Urgency",               make_table(gen(), caption=("Package", "Bug", "Urgency",
636                                          "Remote"))])                                          "Remote")),
637                 P('''(If a "*" is included in the urgency field, no DSA is planned
638    for this vulnerability.)''')])
639    
640      def page_status_release_stable(self, path, params, url):      def page_status_release_stable(self, path, params, url):
641          return self.page_status_release_stable_oldstable('stable', params, url)          return self.page_status_release_stable_oldstable('stable', params, url)
# Line 617  this package, but still reference it.""" Line 644  this package, but still reference it."""
644                                                           params, url)                                                           params, url)
645    
646      def page_status_release_testing(self, path, params, url):      def page_status_release_testing(self, path, params, url):
647          bf = BugFilter(params)          bf = BugFilterNoDSA(params)
648    
649          def gen():          def gen():
650              old_pkg_name = ''              old_pkg_name = ''
651              for (pkg_name, bug_name, archive, urgency,              for (pkg_name, bug_name, archive, urgency,
652                   sid_vulnerable, ts_fixed, remote) in self.db.cursor().execute(                   sid_vulnerable, ts_fixed, remote, no_dsa) \
653                     in self.db.cursor().execute(
654                  """SELECT package, bug, section, urgency, unstable_vulnerable,                  """SELECT package, bug, section, urgency, unstable_vulnerable,
655                  testing_security_fixed, remote                  testing_security_fixed, remote, no_dsa
656                  FROM testing_status"""):                  FROM testing_status"""):
657                  if bf.urgencyFiltered(urgency):                  if bf.urgencyFiltered(urgency):
658                      continue                      continue
659                  if bf.remoteFiltered(remote):                  if bf.remoteFiltered(remote):
660                      continue                      continue
661                    if bf.nodsaFiltered(no_dsa):
662                        continue
663    
664                  if pkg_name == old_pkg_name:                  if pkg_name == old_pkg_name:
665                      pkg_name = ''                      pkg_name = ''
# Line 798  checker to find out why they have not en Line 828  checker to find out why they have not en
828                                   "Remote"))])                                   "Remote"))])
829    
830      def page_status_todo(self, path, params, url):      def page_status_todo(self, path, params, url):
831            hide_check = params.get('hide_check', False)
832            if hide_check:
833                flags = A(url.updateParamsDict({'hide_check' : None}),
834                          'Show "check" TODOs')
835            else:
836                flags = A(url.updateParamsDict({'hide_check' : '1'}),
837                      'Hide "check" TODOs')
838    
839          def gen():          def gen():
840              for (bug, description) in self.db.getTODOs():              for (bug, description) in self.db.getTODOs(hide_check=hide_check):
841                  yield self.make_xref(url, bug), description                  yield self.make_xref(url, bug), description
842          return self.create_page(          return self.create_page(
843              url, "Bugs with TODO items",              url, "Bugs with TODO items",
844              [make_table(gen(),              [P(flags),
845                 make_table(gen(),
846                          caption=("Bug", "Description"))])                          caption=("Bug", "Description"))])
847    
848      def page_status_itp(self, path, params, url):      def page_status_itp(self, path, params, url):

Legend:
Removed from v.3597  
changed lines
  Added in v.5100

  ViewVC Help
Powered by ViewVC 1.1.5