Example #1
0
    def setUp(self):
        self.maxDiff = None
        tests.reset_emulator()

        self.original_clone = pygit2.clone_repository
        tests.mock_clone(self, func=self.mock_clone)

        tests.mock_datetime(self)
        repo = tests.mock_repository(self)
        self.remote_source_repo_path = repo.path

        # Initialise fake source_repo.
        self.tmp_dir = tempfile.TemporaryDirectory()

        self.mock_repo = tests.mock_repository(self)
        self.mock_repo.add_file(
            'BLAH-123.yaml',
            self._load_test_data(os.path.join(TEST_DATA_DIR, 'BLAH-123.yaml')))
        self.mock_repo.add_file(
            'BLAH-124.yaml',
            self._load_test_data(os.path.join(TEST_DATA_DIR, 'BLAH-124.yaml')))
        self.mock_repo.add_file(
            'BLAH-125.yaml',
            self._load_test_data(os.path.join(TEST_DATA_DIR, 'BLAH-125.yaml')))
        self.mock_repo.commit('User', 'user@email')

        osv.SourceRepository(id='source',
                             name='source',
                             repo_url='file://' + self.remote_source_repo_path,
                             repo_username='').put()

        osv.Bug(id='BLAH-123',
                project='blah.com/package',
                ecosystem='golang',
                source_id='source:BLAH-123.yaml',
                source_of_truth=osv.SourceOfTruth.SOURCE_REPO).put()
        osv.Bug(id='BLAH-124',
                regressed='eefe8ec3f1f90d0e684890e810f3f21e8500a4cd',
                project='blah.com/package',
                ecosystem='golang',
                source_id='source:BLAH-124.yaml',
                source_of_truth=osv.SourceOfTruth.SOURCE_REPO).put()
        osv.Bug(id='BLAH-125',
                regressed='eefe8ec3f1f90d0e684890e810f3f21e8500a4cd',
                fixed='8d8242f545e9cec3e6d0d2e3f5bde8be1c659735',
                project='blah.com/package',
                ecosystem='golang',
                source_id='source:BLAH-125.yaml',
                source_of_truth=osv.SourceOfTruth.SOURCE_REPO).put()
Example #2
0
    def setUp(self):
        self.maxDiff = None  # pylint: disable=invalid-name
        self.tmp_dir = tempfile.mkdtemp()

        tests.mock_datetime(self)
        self.mock_repo = tests.mock_repository(self)

        storage_patcher = mock.patch('google.cloud.storage.Client')
        self.addCleanup(storage_patcher.stop)
        self.mock_storage_client = storage_patcher.start()

        self.remote_source_repo_path = self.mock_repo.path
        self.source_repo = osv.SourceRepository(id='oss-fuzz',
                                                name='oss-fuzz',
                                                repo_url='file://' +
                                                self.remote_source_repo_path,
                                                repo_username='')
        self.source_repo.put()

        osv.Bug(
            id='2017-134',
            affected=['FILE5_29', 'FILE5_30'],
            affected_fuzzy=['5-29', '5-30'],
            details=(
                'OSS-Fuzz report: '
                'https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=1064\n\n'
                'Crash type: Heap-buffer-overflow READ 1\n'
                'Crash state:\ncdf_file_property_info\ncdf_file_summary_info\n'
                'cdf_check_summary_info\n'),
            ecosystem='OSS-Fuzz',
            fixed='19ccebafb7663c422c714e0c67fa4775abf91c43',
            has_affected=True,
            issue_id='1064',
            project='file',
            public=True,
            reference_urls=[
                'https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=1064'
            ],
            regressed='17ee4cf670c363de8d2ea4a4897d7a699837873f',
            repo_url='https://github.com/file/file.git',
            search_indices=['file', '2017-134', '2017', '134'],
            severity='MEDIUM',
            sort_key='2017-0000134',
            source_id='oss-fuzz:5417710252982272',
            source_of_truth=osv.SourceOfTruth.INTERNAL,
            status=1,
            summary='Heap-buffer-overflow in cdf_file_property_info',
            timestamp=datetime.datetime(2021, 1, 15, 0, 0, 24, 559102)).put()
Example #3
0
  def setUp(self):
    tests.reset_emulator()
    self.maxDiff = None  # pylint: disable=invalid-name
    self.tmp_dir = tempfile.mkdtemp()

    tests.mock_datetime(self)
    self.mock_repo = tests.mock_repository(self)

    storage_patcher = mock.patch('google.cloud.storage.Client')
    self.addCleanup(storage_patcher.stop)
    self.mock_storage_client = storage_patcher.start()

    self.remote_source_repo_path = self.mock_repo.path
    self.source_repo = osv.SourceRepository(
        id='oss-fuzz',
        name='oss-fuzz',
        repo_url='file://' + self.remote_source_repo_path,
        repo_username='')
    self.source_repo.put()