| 14 |
import security_db |
import security_db |
| 15 |
from web_support import * |
from web_support import * |
| 16 |
|
|
| 17 |
|
class BugFilter: |
| 18 |
|
def __init__(self, params): |
| 19 |
|
self.hide_medium_urgency = int(params.get('hide_medium_urgency', |
| 20 |
|
(0,))[0]) |
| 21 |
|
self.hide_non_remote = int(params.get('hide_non_remote', |
| 22 |
|
(0,))[0]) |
| 23 |
|
|
| 24 |
|
def actions(self, url): |
| 25 |
|
"""Returns a HTML snippet which can be used to change the filter.""" |
| 26 |
|
if self.hide_medium_urgency: |
| 27 |
|
urg = A(url.updateParams(hide_medium_urgency=None), |
| 28 |
|
'Show lower urgencies') |
| 29 |
|
else: |
| 30 |
|
urg = A(url.updateParams(hide_medium_urgency='1'), |
| 31 |
|
'Hide lower urgencies') |
| 32 |
|
if self.hide_non_remote: |
| 33 |
|
rem = A(url.updateParams(hide_non_remote=None), |
| 34 |
|
'Show local vulnerabilities') |
| 35 |
|
else: |
| 36 |
|
rem = A(url.updateParams(hide_non_remote='1'), |
| 37 |
|
'Hide local vulnerabilities') |
| 38 |
|
return P(urg, ' ', rem) |
| 39 |
|
|
| 40 |
|
def urgencyFiltered(self, urg): |
| 41 |
|
"""Returns True if the urgency urg is filtered.""" |
| 42 |
|
return self.hide_medium_urgency and urg not in ("high", "unknown", "") |
| 43 |
|
|
| 44 |
|
def remoteFiltered(self, remote): |
| 45 |
|
"""Returns True if the attack range is filtered.""" |
| 46 |
|
return remote is not None and self.hide_non_remote and not remote |
| 47 |
|
|
| 48 |
class TrackerService(WebService): |
class TrackerService(WebService): |
| 49 |
head_contents = compose(STYLE( |
head_contents = compose(STYLE( |
| 50 |
"""h1 { font-size : 144%; } |
"""h1 { font-size : 144%; } |
| 490 |
this package, but still reference it.""")]) |
this package, but still reference it.""")]) |
| 491 |
|
|
| 492 |
def page_status_release_stable(self, path, params, url): |
def page_status_release_stable(self, path, params, url): |
| 493 |
|
bf = BugFilter(params) |
| 494 |
|
|
| 495 |
def gen(): |
def gen(): |
| 496 |
old_pkg_name = '' |
old_pkg_name = '' |
| 497 |
for (pkg_name, bug_name, archive, urgency, remote) in \ |
for (pkg_name, bug_name, archive, urgency, remote) in \ |
| 498 |
self.db.cursor().execute( |
self.db.cursor().execute( |
| 499 |
"""SELECT package, bug, section, urgency, remote |
"""SELECT package, bug, section, urgency, remote |
| 500 |
FROM stable_status"""): |
FROM stable_status"""): |
| 501 |
|
if bf.urgencyFiltered(urgency): |
| 502 |
|
continue |
| 503 |
|
if bf.remoteFiltered(remote): |
| 504 |
|
continue |
| 505 |
|
|
| 506 |
if pkg_name == old_pkg_name: |
if pkg_name == old_pkg_name: |
| 507 |
pkg_name = '' |
pkg_name = '' |
| 508 |
else: |
else: |
| 526 |
|
|
| 527 |
return self.create_page( |
return self.create_page( |
| 528 |
url, 'Vulnerable source packages in the stable suite', |
url, 'Vulnerable source packages in the stable suite', |
| 529 |
[make_table(gen(), caption=("Package", "Bug", "Urgency", |
[bf.actions(url), |
| 530 |
|
make_table(gen(), caption=("Package", "Bug", "Urgency", |
| 531 |
"Remote"))]) |
"Remote"))]) |
| 532 |
|
|
| 533 |
def page_status_release_testing(self, path, params, url): |
def page_status_release_testing(self, path, params, url): |
| 534 |
|
bf = BugFilter(params) |
| 535 |
|
|
| 536 |
def gen(): |
def gen(): |
| 537 |
old_pkg_name = '' |
old_pkg_name = '' |
| 538 |
for (pkg_name, bug_name, archive, urgency, |
for (pkg_name, bug_name, archive, urgency, |
| 540 |
"""SELECT package, bug, section, urgency, unstable_vulnerable, |
"""SELECT package, bug, section, urgency, unstable_vulnerable, |
| 541 |
testing_security_fixed, remote |
testing_security_fixed, remote |
| 542 |
FROM testing_status"""): |
FROM testing_status"""): |
| 543 |
|
if bf.urgencyFiltered(urgency): |
| 544 |
|
continue |
| 545 |
|
if bf.remoteFiltered(remote): |
| 546 |
|
continue |
| 547 |
|
|
| 548 |
if pkg_name == old_pkg_name: |
if pkg_name == old_pkg_name: |
| 549 |
pkg_name = '' |
pkg_name = '' |
| 550 |
else: |
else: |
| 577 |
url, 'Vulnerable source packages in the testing suite', |
url, 'Vulnerable source packages in the testing suite', |
| 578 |
[make_menu(url.scriptRelative, |
[make_menu(url.scriptRelative, |
| 579 |
("status/dtsa-candidates", "Candidates for DTSAs")), |
("status/dtsa-candidates", "Candidates for DTSAs")), |
| 580 |
|
bf.actions(url), |
| 581 |
make_table(gen(), caption=("Package", "Bug", "Urgency", |
make_table(gen(), caption=("Package", "Bug", "Urgency", |
| 582 |
"Remote"))]) |
"Remote"))]) |
| 583 |
|
|
| 584 |
def page_status_release_unstable(self, path, params, url): |
def page_status_release_unstable(self, path, params, url): |
| 585 |
|
bf = BugFilter(params) |
| 586 |
|
|
| 587 |
def gen(): |
def gen(): |
| 588 |
old_pkg_name = '' |
old_pkg_name = '' |
| 589 |
for (pkg_name, bug_name, section, urgency) \ |
for (pkg_name, bug_name, section, urgency, remote) \ |
| 590 |
in self.db.cursor().execute( |
in self.db.cursor().execute( |
| 591 |
"""SELECT DISTINCT sp.name, st.bug_name, |
"""SELECT DISTINCT sp.name, st.bug_name, |
| 592 |
sp.archive, st.urgency |
sp.archive, st.urgency, |
| 593 |
|
(SELECT range_remote FROM nvd_data |
| 594 |
|
WHERE cve_name = st.bug_name) |
| 595 |
FROM source_package_status AS st, source_packages AS sp |
FROM source_package_status AS st, source_packages AS sp |
| 596 |
WHERE st.vulnerable AND st.urgency <> 'unimportant' |
WHERE st.vulnerable AND st.urgency <> 'unimportant' |
| 597 |
AND sp.rowid = st.package AND sp.release = 'sid' |
AND sp.rowid = st.package AND sp.release = 'sid' |
| 598 |
AND sp.subrelease = '' |
AND sp.subrelease = '' |
| 599 |
ORDER BY sp.name, st.bug_name"""): |
ORDER BY sp.name, st.bug_name"""): |
| 600 |
|
if bf.urgencyFiltered(urgency): |
| 601 |
|
continue |
| 602 |
|
if bf.remoteFiltered(remote): |
| 603 |
|
continue |
| 604 |
|
|
| 605 |
if pkg_name == old_pkg_name: |
if pkg_name == old_pkg_name: |
| 606 |
pkg_name = '' |
pkg_name = '' |
| 607 |
else: |
else: |
| 611 |
else: |
else: |
| 612 |
pkg_name = self.make_xref(url, pkg_name) |
pkg_name = self.make_xref(url, pkg_name) |
| 613 |
|
|
| 614 |
|
if remote is None: |
| 615 |
|
remote = '' |
| 616 |
|
elif remote: |
| 617 |
|
remote = 'yes' |
| 618 |
|
else: |
| 619 |
|
remote = 'no' |
| 620 |
|
|
| 621 |
if urgency == 'unknown': |
if urgency == 'unknown': |
| 622 |
urgency = '' |
urgency = '' |
| 623 |
elif urgency == 'high': |
elif urgency == 'high': |
| 624 |
urgency = self.make_red(urgency) |
urgency = self.make_red(urgency) |
| 625 |
|
|
| 626 |
yield pkg_name, self.make_xref(url, bug_name), urgency |
yield pkg_name, self.make_xref(url, bug_name), urgency, remote |
| 627 |
|
|
| 628 |
|
|
| 629 |
return self.create_page( |
return self.create_page( |
| 633 |
fixed source version has been uploaded to the archive, even |
fixed source version has been uploaded to the archive, even |
| 634 |
if there are still some vulnerably binary packages present |
if there are still some vulnerably binary packages present |
| 635 |
in the archive."""), |
in the archive."""), |
| 636 |
make_table(gen(), caption=('Package', 'Bug', 'Urgency'))]) |
bf.actions(url), |
| 637 |
|
make_table(gen(), caption=('Package', 'Bug', 'Urgency', |
| 638 |
|
'Remote'))]) |
| 639 |
|
|
| 640 |
def page_status_dtsa_candidates(self, path, params, url): |
def page_status_dtsa_candidates(self, path, params, url): |
| 641 |
|
bf = BugFilter(params) |
| 642 |
|
|
| 643 |
def gen(): |
def gen(): |
| 644 |
old_pkg_name = '' |
old_pkg_name = '' |
| 645 |
for (pkg_name, bug_name, archive, urgency, stable_later) \ |
for (pkg_name, bug_name, archive, urgency, stable_later, |
| 646 |
|
remote) \ |
| 647 |
in self.db.cursor().execute( |
in self.db.cursor().execute( |
| 648 |
"""SELECT package, bug, section, urgency, |
"""SELECT package, bug, section, urgency, |
| 649 |
(SELECT testing.version_id < stable.version_id |
(SELECT testing.version_id < stable.version_id |
| 655 |
AND stable.name = testing_status.package |
AND stable.name = testing_status.package |
| 656 |
AND stable.release = 'sarge' |
AND stable.release = 'sarge' |
| 657 |
AND stable.subrelease = 'security' |
AND stable.subrelease = 'security' |
| 658 |
AND stable.archive = testing_status.section) |
AND stable.archive = testing_status.section), |
| 659 |
|
(SELECT range_remote FROM nvd_data |
| 660 |
|
WHERE cve_name = bug) |
| 661 |
FROM testing_status |
FROM testing_status |
| 662 |
WHERE (NOT unstable_vulnerable) |
WHERE (NOT unstable_vulnerable) |
| 663 |
AND (NOT testing_security_fixed)"""): |
AND (NOT testing_security_fixed)"""): |
| 664 |
|
if bf.urgencyFiltered(urgency): |
| 665 |
|
continue |
| 666 |
|
if bf.remoteFiltered(remote): |
| 667 |
|
continue |
| 668 |
|
|
| 669 |
if pkg_name == old_pkg_name: |
if pkg_name == old_pkg_name: |
| 670 |
pkg_name = '' |
pkg_name = '' |
| 671 |
migration = '' |
migration = '' |
| 678 |
else: |
else: |
| 679 |
pkg_name = self.make_source_package_ref(url, pkg_name) |
pkg_name = self.make_source_package_ref(url, pkg_name) |
| 680 |
|
|
| 681 |
|
if remote is None: |
| 682 |
|
remote = '' |
| 683 |
|
elif remote: |
| 684 |
|
remote = 'yes' |
| 685 |
|
else: |
| 686 |
|
remote = 'no' |
| 687 |
|
|
| 688 |
if urgency == 'unknown': |
if urgency == 'unknown': |
| 689 |
urgency = '' |
urgency = '' |
| 690 |
elif urgency == 'high': |
elif urgency == 'high': |
| 696 |
notes = '' |
notes = '' |
| 697 |
|
|
| 698 |
yield (pkg_name, migration, self.make_xref(url, bug_name), |
yield (pkg_name, migration, self.make_xref(url, bug_name), |
| 699 |
urgency, notes) |
urgency, remote, notes) |
| 700 |
|
|
| 701 |
return self.create_page( |
return self.create_page( |
| 702 |
url, "Candidates for DTSAs", |
url, "Candidates for DTSAs", |
| 707 |
make_menu(url.scriptRelative, |
make_menu(url.scriptRelative, |
| 708 |
("status/release/testing", |
("status/release/testing", |
| 709 |
"List of vulnerable packages in testing")), |
"List of vulnerable packages in testing")), |
| 710 |
|
bf.actions(url), |
| 711 |
make_table(gen(), |
make_table(gen(), |
| 712 |
caption=("Package", "Migration", "Bug", "Urgency"))]) |
caption=("Package", "Migration", "Bug", "Urgency", |
| 713 |
|
"Remote"))]) |
| 714 |
|
|
| 715 |
def page_status_todo(self, path, params, url): |
def page_status_todo(self, path, params, url): |
| 716 |
def gen(): |
def gen(): |