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

mozilla / relman-auto-nag / #4495

pending completion
#4495

push

coveralls-python

suhaibmujahid
Replace "open" with "public"

640 of 3228 branches covered (19.83%)

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

1817 of 8049 relevant lines covered (22.57%)

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 hiding the summary
22
        return bug["summary"]
×
23

24
    def handle_bug(self, bug, data):
×
25
        bugid = str(bug["id"])
×
26
        data[bugid] = 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": "sec",
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
        bugs_to_query = {bug["dupe_of"] for bug in bugs.values()}
×
46
        public_sec_bugs = set()
×
47

48
        def bug_handler(bug):
×
49
            bugs_to_query.remove(bug["id"])
×
50
            if (
×
51
                bug["resolution"] in ("FIXED", "DUPLICATE")
52
                and not any("sec" in group for group in bug["groups"])
53
                and any(keyword.startswith("sec-") for keyword in bug["keywords"])
54
            ):
55
                public_sec_bugs.add(bug["id"])
×
56

57
        Bugzilla(
×
58
            bugs_to_query,
59
            include_fields=["id", "resolution", "keywords", "groups"],
60
            bughandler=bug_handler,
61
        ).wait()
62

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

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

71
        return bugs
×
72

73

74
if __name__ == "__main__":
×
75
    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