Skip to content

Commit

Permalink
Update issue type and component for VRP uploaded bugs (#4580) (#4664)
Browse files Browse the repository at this point in the history
merge #4580 into chrome
  • Loading branch information
pgrace-google authored Feb 5, 2025
1 parent c7f14ff commit 5fdca6b
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/clusterfuzz/_internal/cron/cleanup.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@
FUZZ_TARGET_UNUSED_THRESHOLD = 15
UNUSED_HEARTBEAT_THRESHOLD = 15

VRP_UPLOAD_COMPONENT_ID = 1600865
CHROMIUM_COMPONENT_ID = 1363614

ProjectMap = collections.namedtuple('ProjectMap', 'jobs platforms')


Expand Down Expand Up @@ -1056,6 +1059,18 @@ def update_component_labels_and_id(policy, testcase, issue):
component_id = _get_predator_result_item(testcase,
'suspected_buganizer_component_id')

# These bugs were filed via the direct upload and hence specific to the
# google issue tracker.
if getattr(issue, 'component_id', None) == VRP_UPLOAD_COMPONENT_ID:
# Reset the component to the top level for this bug to be triaged properly.
issue.component_id = CHROMIUM_COMPONENT_ID

# Bugs in the direct upload component are filed as type 'Task'.
if testcase.security_flag:
issue.labels.add('Type-VULNERABILITY')
else:
issue.labels.add('Type-BUG')

# Remove components already in issue or whose more specific variants exist.
filtered_components = []
for component in components:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1494,6 +1494,30 @@ def test_label_added_for_unrelated_component(self):
self.assertIn('D', self.issue.components)
self.assertIn('Test-Predator-Auto-Components', self.issue.labels)

def test_vrp_security_upload_overrides_bug_type_and_components(self):
"""Ensure that the type and component gets reset for a processed VRP direct
uploaded security bug. This test is specific to the Google Issue Tracker."""
self.testcase.security_flag = True
self.testcase.put()
setattr(self.issue, 'component_id', cleanup.VRP_UPLOAD_COMPONENT_ID)

cleanup.update_component_labels_and_id(
policy=self.policy, testcase=self.testcase, issue=self.issue)
self.assertIn('Type-VULNERABILITY', self.issue.labels)
self.assertEqual(cleanup.CHROMIUM_COMPONENT_ID, self.issue.component_id)

def test_vrp_non_security_upload_overrides_bug_type_and_components(self):
"""Ensure that the type and component gets reset for a processed VRP direct
uploaded non-security bug. This test is specific to the Google Issue Tracker."""
self.testcase.security_flag = False
self.testcase.put()
setattr(self.issue, 'component_id', cleanup.VRP_UPLOAD_COMPONENT_ID)

cleanup.update_component_labels_and_id(
policy=self.policy, testcase=self.testcase, issue=self.issue)
self.assertIn('Type-BUG', self.issue.labels)
self.assertEqual(cleanup.CHROMIUM_COMPONENT_ID, self.issue.component_id)


@test_utils.with_cloud_emulators('datastore')
class UpdateIssueCCsFromOwnersFileTest(unittest.TestCase):
Expand Down

0 comments on commit 5fdca6b

Please sign in to comment.