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

mozilla / relman-auto-nag / #4876

27 Dec 2023 07:07AM CUT coverage: 21.897% (-0.002%) from 21.899%
#4876

push

coveralls-python

shubham-s-del
Unified way of accessing security keywords

716 of 3590 branches covered (0.0%)

0 of 2 new or added lines in 2 files covered. (0.0%)

1928 of 8805 relevant lines covered (21.9%)

0.22 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
×
NEW
9
from bugbot.constants import SECURITY_KEYWORDS
×
10

11

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

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

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

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

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

29
        return bug
×
30

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

40
        return params
×
41

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

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

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

56
        bugs_to_query = {bug["dupe_of"] for bug in bugs.values()}
×
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