• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

mozilla / relman-auto-nag / #4517

pending completion
#4517

push

coveralls-python

web-flow
Send weekly list with security bugs that need to be un-hidden (#1856)

641 of 3228 branches covered (19.86%)

29 of 29 new or added lines in 1 file covered. (100.0%)

1817 of 8048 relevant lines covered (22.58%)

0.23 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/bugbot/rules/security_unhide_dups.py
1
# This Source Code Form is subject to the terms of the Mozilla Public
2
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
3
# You can obtain one at http://mozilla.org/MPL/2.0/.
4

5
from libmozdata.bugzilla import Bugzilla
×
6

7
from bugbot import utils
×
8
from bugbot.bzcleaner import BzCleaner
×
9

10

11
class SecurityUnhideDups(BzCleaner):
×
12
    """Security bugs that could be un-hidden"""
13

14
    def description(self):
×
15
        return "Security bugs that are marked as duplicates of already-public bugs"
×
16

17
    def filter_no_nag_keyword(self):
×
18
        return False
×
19

20
    def get_summary(self, bug):
×
21
        # This will prevent the default behavior of hiding the summary of
22
        # security bugs.
23
        return bug["summary"]
×
24

25
    def handle_bug(self, bug, data):
×
26
        data[str(bug["id"])] = bug
×
27

28
        return bug
×
29

30
    def get_bz_params(self, date):
×
31
        params = {
×
32
            "include_fields": ["dupe_of"],
33
            "resolution": "DUPLICATE",
34
            "f1": "bug_group",
35
            "o1": "substring",
36
            "v1": "core-security",
37
        }
38

39
        return params
×
40

41
    def get_bugs(self, date="today", bug_ids=[], chunk_size=None):
×
42
        bugs = super().get_bugs(date, bug_ids, chunk_size)
×
43

44
        # Filter out bugs that are not marked as duplicates of open security bugs
45
        public_sec_bugs = set()
×
46

47
        def bug_handler(bug):
×
48
            if (
×
49
                bug["resolution"] != "---"
50
                and not bug["groups"]
51
                and any(keyword.startswith("sec-") for keyword in bug["keywords"])
52
            ):
53
                public_sec_bugs.add(bug["id"])
×
54

55
        bugs_to_query = {bug["dupe_of"] for bug in bugs.values()}
×
56
        Bugzilla(
×
57
            bugs_to_query,
58
            include_fields=["id", "resolution", "keywords", "groups"],
59
            bughandler=bug_handler,
60
        ).wait()
61

62
        bugs = {
×
63
            bug_id: bug
64
            for bug_id, bug in bugs.items()
65
            if bug["dupe_of"] in public_sec_bugs
66
        }
67

68
        self.query_url = utils.get_bz_search_url({"bug_id": ",".join(bugs.keys())})
×
69

70
        return bugs
×
71

72

73
if __name__ == "__main__":
×
74
    SecurityUnhideDups().run()
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc