Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update issue type and component for VRP uploaded bugs #4580

Merged
merged 1 commit into from
Feb 5, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading