Skip to content

Commit e890d3c

Browse files
Update issue type and component for VRP uploaded bugs (#4580)
1 parent b5e7a55 commit e890d3c

File tree

2 files changed

+39
-0
lines changed

2 files changed

+39
-0
lines changed

src/clusterfuzz/_internal/cron/cleanup.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,9 @@
5757
FUZZ_TARGET_UNUSED_THRESHOLD = 15
5858
UNUSED_HEARTBEAT_THRESHOLD = 15
5959

60+
VRP_UPLOAD_COMPONENT_ID = 1600865
61+
CHROMIUM_COMPONENT_ID = 1363614
62+
6063
ProjectMap = collections.namedtuple('ProjectMap', 'jobs platforms')
6164

6265

@@ -1056,6 +1059,18 @@ def update_component_labels_and_id(policy, testcase, issue):
10561059
component_id = _get_predator_result_item(testcase,
10571060
'suspected_buganizer_component_id')
10581061

1062+
# These bugs were filed via the direct upload and hence specific to the
1063+
# google issue tracker.
1064+
if getattr(issue, 'component_id', None) == VRP_UPLOAD_COMPONENT_ID:
1065+
# Reset the component to the top level for this bug to be triaged properly.
1066+
issue.component_id = CHROMIUM_COMPONENT_ID
1067+
1068+
# Bugs in the direct upload component are filed as type 'Task'.
1069+
if testcase.security_flag:
1070+
issue.labels.add('Type-VULNERABILITY')
1071+
else:
1072+
issue.labels.add('Type-BUG')
1073+
10591074
# Remove components already in issue or whose more specific variants exist.
10601075
filtered_components = []
10611076
for component in components:

src/clusterfuzz/_internal/tests/appengine/handlers/cron/cleanup_test.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1494,6 +1494,30 @@ def test_label_added_for_unrelated_component(self):
14941494
self.assertIn('D', self.issue.components)
14951495
self.assertIn('Test-Predator-Auto-Components', self.issue.labels)
14961496

1497+
def test_vrp_security_upload_overrides_bug_type_and_components(self):
1498+
"""Ensure that the type and component gets reset for a processed VRP direct
1499+
uploaded security bug. This test is specific to the Google Issue Tracker."""
1500+
self.testcase.security_flag = True
1501+
self.testcase.put()
1502+
setattr(self.issue, 'component_id', cleanup.VRP_UPLOAD_COMPONENT_ID)
1503+
1504+
cleanup.update_component_labels_and_id(
1505+
policy=self.policy, testcase=self.testcase, issue=self.issue)
1506+
self.assertIn('Type-VULNERABILITY', self.issue.labels)
1507+
self.assertEqual(cleanup.CHROMIUM_COMPONENT_ID, self.issue.component_id)
1508+
1509+
def test_vrp_non_security_upload_overrides_bug_type_and_components(self):
1510+
"""Ensure that the type and component gets reset for a processed VRP direct
1511+
uploaded non-security bug. This test is specific to the Google Issue Tracker."""
1512+
self.testcase.security_flag = False
1513+
self.testcase.put()
1514+
setattr(self.issue, 'component_id', cleanup.VRP_UPLOAD_COMPONENT_ID)
1515+
1516+
cleanup.update_component_labels_and_id(
1517+
policy=self.policy, testcase=self.testcase, issue=self.issue)
1518+
self.assertIn('Type-BUG', self.issue.labels)
1519+
self.assertEqual(cleanup.CHROMIUM_COMPONENT_ID, self.issue.component_id)
1520+
14971521

14981522
@test_utils.with_cloud_emulators('datastore')
14991523
class UpdateIssueCCsFromOwnersFileTest(unittest.TestCase):

0 commit comments

Comments
 (0)