diff --git a/docker/worker/testdata/BLAH-123.yaml b/docker/worker/testdata/OSV-123.yaml similarity index 97% rename from docker/worker/testdata/BLAH-123.yaml rename to docker/worker/testdata/OSV-123.yaml index 234fa5ae616..0d93ff864ce 100644 --- a/docker/worker/testdata/BLAH-123.yaml +++ b/docker/worker/testdata/OSV-123.yaml @@ -1,4 +1,4 @@ -id: BLAH-123 +id: OSV-123 summary: A vulnerability details: | Blah blah blah diff --git a/docker/worker/testdata/BLAH-124.yaml b/docker/worker/testdata/OSV-124.yaml similarity index 96% rename from docker/worker/testdata/BLAH-124.yaml rename to docker/worker/testdata/OSV-124.yaml index 2c578cdacbe..4d2eedef66a 100644 --- a/docker/worker/testdata/BLAH-124.yaml +++ b/docker/worker/testdata/OSV-124.yaml @@ -1,4 +1,4 @@ -id: BLAH-124 +id: OSV-124 summary: A vulnerability details: | Blah blah blah diff --git a/docker/worker/testdata/BLAH-125.yaml b/docker/worker/testdata/OSV-125.yaml similarity index 98% rename from docker/worker/testdata/BLAH-125.yaml rename to docker/worker/testdata/OSV-125.yaml index 2db446fd8a6..1d10d5409df 100644 --- a/docker/worker/testdata/BLAH-125.yaml +++ b/docker/worker/testdata/OSV-125.yaml @@ -1,4 +1,4 @@ -id: BLAH-125 +id: OSV-125 summary: A vulnerability details: | Blah blah blah diff --git a/docker/worker/testdata/BLAH-126.yaml b/docker/worker/testdata/OSV-126.yaml similarity index 97% rename from docker/worker/testdata/BLAH-126.yaml rename to docker/worker/testdata/OSV-126.yaml index 77d3d69ce85..a8ae7ed1e32 100644 --- a/docker/worker/testdata/BLAH-126.yaml +++ b/docker/worker/testdata/OSV-126.yaml @@ -1,4 +1,4 @@ -id: BLAH-126 +id: OSV-126 summary: A vulnerability details: | Blah blah blah diff --git a/docker/worker/testdata/BLAH-127.yaml b/docker/worker/testdata/OSV-127.yaml similarity index 91% rename from docker/worker/testdata/BLAH-127.yaml rename to docker/worker/testdata/OSV-127.yaml index 637ce2f7f98..a1a76f16f4f 100644 --- a/docker/worker/testdata/BLAH-127.yaml +++ b/docker/worker/testdata/OSV-127.yaml @@ -1,4 +1,4 @@ -id: BLAH-127 +id: OSV-127 summary: A vulnerability details: | Blah blah blah @@ -11,7 +11,7 @@ affected: name: blah.com/package ecosystem: Go versions: - - branch-v0.1.1 + - branch-v0.1.1 ranges: - type: GIT repo: https://osv-test/repo/url diff --git a/docker/worker/testdata/BLAH-128.yaml b/docker/worker/testdata/OSV-128.yaml similarity index 86% rename from docker/worker/testdata/BLAH-128.yaml rename to docker/worker/testdata/OSV-128.yaml index cea90a02ab9..9b928c1f457 100644 --- a/docker/worker/testdata/BLAH-128.yaml +++ b/docker/worker/testdata/OSV-128.yaml @@ -1,4 +1,4 @@ -id: BLAH-128 +id: OSV-128 summary: A vulnerability details: | Blah blah blah @@ -11,7 +11,7 @@ affected: name: grpcio ecosystem: PyPI versions: - - branch-v0.1.1 + - branch-v0.1.1 ranges: - type: GIT repo: https://osv-test/repo/url @@ -22,4 +22,4 @@ affected: events: - introduced: 1.13.0 - limit: 1.14.2 -modified: '2020-01-01T00:00:00Z' \ No newline at end of file +modified: '2020-01-01T00:00:00Z' diff --git a/docker/worker/testdata/BLAH-129.yaml b/docker/worker/testdata/OSV-129.yaml similarity index 97% rename from docker/worker/testdata/BLAH-129.yaml rename to docker/worker/testdata/OSV-129.yaml index 82469ad5f16..d9eb33d1c97 100644 --- a/docker/worker/testdata/BLAH-129.yaml +++ b/docker/worker/testdata/OSV-129.yaml @@ -1,4 +1,4 @@ -id: BLAH-129 +id: OSV-129 summary: A vulnerability details: | Blah blah blah diff --git a/docker/worker/testdata/BLAH-130.yaml b/docker/worker/testdata/OSV-130.yaml similarity index 98% rename from docker/worker/testdata/BLAH-130.yaml rename to docker/worker/testdata/OSV-130.yaml index 5fd414efd4b..d2d319bf552 100644 --- a/docker/worker/testdata/BLAH-130.yaml +++ b/docker/worker/testdata/OSV-130.yaml @@ -1,4 +1,4 @@ -id: BLAH-130 +id: OSV-130 summary: A vulnerability details: | Blah blah blah diff --git a/docker/worker/testdata/BLAH-131.yaml b/docker/worker/testdata/OSV-131.yaml similarity index 97% rename from docker/worker/testdata/BLAH-131.yaml rename to docker/worker/testdata/OSV-131.yaml index cd390dd82e6..d62b1b10840 100644 --- a/docker/worker/testdata/BLAH-131.yaml +++ b/docker/worker/testdata/OSV-131.yaml @@ -1,4 +1,4 @@ -id: BLAH-131 +id: OSV-131 summary: A vulnerability details: | Blah blah blah diff --git a/docker/worker/testdata/TEST-last-affected-01.yaml b/docker/worker/testdata/OSV-TEST-last-affected-01.yaml similarity index 92% rename from docker/worker/testdata/TEST-last-affected-01.yaml rename to docker/worker/testdata/OSV-TEST-last-affected-01.yaml index fa8cc1b92c6..86e69d4f5d0 100644 --- a/docker/worker/testdata/TEST-last-affected-01.yaml +++ b/docker/worker/testdata/OSV-TEST-last-affected-01.yaml @@ -1,4 +1,4 @@ -id: TEST-last-affected-01 +id: OSV-TEST-last-affected-01 summary: A vulnerability details: | Blah blah blah diff --git a/docker/worker/testdata/UpdateTest_diff_last_affected_git.txt b/docker/worker/testdata/UpdateTest_diff_last_affected_git.txt index 6374ba142c7..a4e7ec4ad27 100644 --- a/docker/worker/testdata/UpdateTest_diff_last_affected_git.txt +++ b/docker/worker/testdata/UpdateTest_diff_last_affected_git.txt @@ -1,7 +1,8 @@ -('diff --git a/TEST-last-affected-01.yaml b/TEST-last-affected-01.yaml\n' - 'index fa8cc1b..77df150 100644\n' - '--- a/TEST-last-affected-01.yaml\n' - '+++ b/TEST-last-affected-01.yaml\n' +('diff --git a/OSV-TEST-last-affected-01.yaml ' + 'b/OSV-TEST-last-affected-01.yaml\n' + 'index 86e69d4..236ac2c 100644\n' + '--- a/OSV-TEST-last-affected-01.yaml\n' + '+++ b/OSV-TEST-last-affected-01.yaml\n' '@@ -3,7 +3,7 @@ summary: A vulnerability\n' ' details: |\n' ' Blah blah blah\n' diff --git a/docker/worker/testdata/UpdateTest_diff_update.txt b/docker/worker/testdata/UpdateTest_diff_update.txt index 7df2fede041..50bb3fe33e7 100644 --- a/docker/worker/testdata/UpdateTest_diff_update.txt +++ b/docker/worker/testdata/UpdateTest_diff_update.txt @@ -1,7 +1,7 @@ -('diff --git a/BLAH-123.yaml b/BLAH-123.yaml\n' - 'index 234fa5a..9305b68 100644\n' - '--- a/BLAH-123.yaml\n' - '+++ b/BLAH-123.yaml\n' +('diff --git a/OSV-123.yaml b/OSV-123.yaml\n' + 'index 0d93ff8..be4b7e7 100644\n' + '--- a/OSV-123.yaml\n' + '+++ b/OSV-123.yaml\n' '@@ -3,13 +3,9 @@ summary: A vulnerability\n' ' details: |\n' ' Blah blah blah\n' diff --git a/docker/worker/testdata/UpdateTest_diff_update_add_fix.txt b/docker/worker/testdata/UpdateTest_diff_update_add_fix.txt index ad52ec61bb9..907f8569531 100644 --- a/docker/worker/testdata/UpdateTest_diff_update_add_fix.txt +++ b/docker/worker/testdata/UpdateTest_diff_update_add_fix.txt @@ -1,7 +1,7 @@ -('diff --git a/BLAH-124.yaml b/BLAH-124.yaml\n' - 'index 2c578cd..e987270 100644\n' - '--- a/BLAH-124.yaml\n' - '+++ b/BLAH-124.yaml\n' +('diff --git a/OSV-124.yaml b/OSV-124.yaml\n' + 'index 4d2eede..9aa0b53 100644\n' + '--- a/OSV-124.yaml\n' + '+++ b/OSV-124.yaml\n' '@@ -3,6 +3,7 @@ summary: A vulnerability\n' ' details: |\n' ' Blah blah blah\n' diff --git a/docker/worker/testdata/UpdateTest_diff_update_limit.txt b/docker/worker/testdata/UpdateTest_diff_update_limit.txt index dc225df487a..2c3251d8d54 100644 --- a/docker/worker/testdata/UpdateTest_diff_update_limit.txt +++ b/docker/worker/testdata/UpdateTest_diff_update_limit.txt @@ -1,7 +1,7 @@ -('diff --git a/BLAH-128.yaml b/BLAH-128.yaml\n' - 'index cea90a0..26ea605 100644\n' - '--- a/BLAH-128.yaml\n' - '+++ b/BLAH-128.yaml\n' +('diff --git a/OSV-128.yaml b/OSV-128.yaml\n' + 'index 9b928c1..c55073f 100644\n' + '--- a/OSV-128.yaml\n' + '+++ b/OSV-128.yaml\n' '@@ -3,6 +3,7 @@ summary: A vulnerability\n' ' details: |\n' ' Blah blah blah\n' @@ -15,7 +15,7 @@ ' name: grpcio\n' ' ecosystem: PyPI\n' '- versions:\n' - '- - branch-v0.1.1\n' + '- - branch-v0.1.1\n' ' ranges:\n' ' - type: GIT\n' ' repo: https://osv-test/repo/url\n' @@ -24,7 +24,6 @@ ' - introduced: 1.13.0\n' ' - limit: 1.14.2\n' "-modified: '2020-01-01T00:00:00Z'\n" - '\\ No newline at end of file\n' '+ versions:\n' '+ - branch-v0.1.1\n' '+ - 1.13.0\n' diff --git a/docker/worker/testdata/UpdateTest_diff_update_no_introduced.txt b/docker/worker/testdata/UpdateTest_diff_update_no_introduced.txt index 63eb6bd69a8..2301aa0313a 100644 --- a/docker/worker/testdata/UpdateTest_diff_update_no_introduced.txt +++ b/docker/worker/testdata/UpdateTest_diff_update_no_introduced.txt @@ -1,7 +1,7 @@ -('diff --git a/BLAH-127.yaml b/BLAH-127.yaml\n' - 'index 637ce2f..727f36f 100644\n' - '--- a/BLAH-127.yaml\n' - '+++ b/BLAH-127.yaml\n' +('diff --git a/OSV-127.yaml b/OSV-127.yaml\n' + 'index a1a76f1..38a0d96 100644\n' + '--- a/OSV-127.yaml\n' + '+++ b/OSV-127.yaml\n' '@@ -3,6 +3,7 @@ summary: A vulnerability\n' ' details: |\n' ' Blah blah blah\n' @@ -15,7 +15,7 @@ ' name: blah.com/package\n' ' ecosystem: Go\n' '- versions:\n' - '- - branch-v0.1.1\n' + '- - branch-v0.1.1\n' ' ranges:\n' ' - type: GIT\n' ' repo: https://osv-test/repo/url\n' diff --git a/docker/worker/testdata/UpdateTest_last_affected_git.txt b/docker/worker/testdata/UpdateTest_last_affected_git.txt index b91cca84fd3..28b29a3e56b 100644 --- a/docker/worker/testdata/UpdateTest_last_affected_git.txt +++ b/docker/worker/testdata/UpdateTest_last_affected_git.txt @@ -16,7 +16,7 @@ 'aliases': [], 'credits': [], 'database_specific': None, - 'db_id': 'TEST-last-affected-01', + 'db_id': 'OSV-TEST-last-affected-01', 'details': 'Blah blah blah\nBlah\n', 'ecosystem': ['GIT'], 'fixed': '', @@ -36,15 +36,16 @@ 'git', 'https://osv-test/repo/url', 'last', + 'osv', + 'osv-test-last-affected-01', 'osv-test/repo/url', 'repo', 'test', - 'test-last-affected-01', 'url'], 'semver_fixed_indexes': [], 'severities': [], 'source': 'source', - 'source_id': 'source:TEST-last-affected-01.yaml', + 'source_id': 'source:OSV-TEST-last-affected-01.yaml', 'source_of_truth': 2, 'status': 1, 'summary': 'A vulnerability', diff --git a/docker/worker/testdata/UpdateTest_update.txt b/docker/worker/testdata/UpdateTest_update.txt index 9d14e5b5aed..fc89279912a 100644 --- a/docker/worker/testdata/UpdateTest_update.txt +++ b/docker/worker/testdata/UpdateTest_update.txt @@ -26,7 +26,7 @@ 'name': 'Foo bar', 'type': None}], 'database_specific': {'specific': 1337.0}, - 'db_id': 'BLAH-123', + 'db_id': 'OSV-123', 'details': 'Blah blah blah\nBlah\n', 'ecosystem': ['Go'], 'fixed': '', @@ -43,11 +43,12 @@ 'related': [], 'search_indices': [ '123', 'blah', - 'blah-123', 'blah.com/package', 'com', 'go', 'https://osv-test/repo/url', + 'osv', + 'osv-123', 'osv-test/repo/url', 'package', 'repo', @@ -56,7 +57,7 @@ 'severities': [ { 'score': 'CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:L', 'type': 'CVSS_V3'}], 'source': 'source', - 'source_id': 'source:BLAH-123.yaml', + 'source_id': 'source:OSV-123.yaml', 'source_of_truth': 2, 'status': 1, 'summary': 'A vulnerability', diff --git a/docker/worker/testdata/UpdateTest_update_add_fix.txt b/docker/worker/testdata/UpdateTest_update_add_fix.txt index 3cee1642790..d23076d7260 100644 --- a/docker/worker/testdata/UpdateTest_update_add_fix.txt +++ b/docker/worker/testdata/UpdateTest_update_add_fix.txt @@ -24,7 +24,7 @@ 'aliases': [], 'credits': [], 'database_specific': None, - 'db_id': 'BLAH-124', + 'db_id': 'OSV-124', 'details': 'Blah blah blah\nBlah\n', 'ecosystem': ['Go'], 'fixed': '', @@ -41,11 +41,12 @@ 'related': [], 'search_indices': [ '124', 'blah', - 'blah-124', 'blah.com/package', 'com', 'go', 'https://osv-test/repo/url', + 'osv', + 'osv-124', 'osv-test/repo/url', 'package', 'repo', @@ -53,7 +54,7 @@ 'semver_fixed_indexes': [], 'severities': [], 'source': 'source', - 'source_id': 'source:BLAH-124.yaml', + 'source_id': 'source:OSV-124.yaml', 'source_of_truth': 2, 'status': 1, 'summary': 'A vulnerability', diff --git a/docker/worker/testdata/UpdateTest_update_limit.txt b/docker/worker/testdata/UpdateTest_update_limit.txt index 856a8639ec3..46457d2b428 100644 --- a/docker/worker/testdata/UpdateTest_update_limit.txt +++ b/docker/worker/testdata/UpdateTest_update_limit.txt @@ -38,7 +38,7 @@ 'aliases': [], 'credits': [], 'database_specific': None, - 'db_id': 'BLAH-128', + 'db_id': 'OSV-128', 'details': 'Blah blah blah\nBlah\n', 'ecosystem': ['PyPI'], 'fixed': '', @@ -54,10 +54,10 @@ 'regressed': '', 'related': [], 'search_indices': [ '128', - 'blah', - 'blah-128', 'grpcio', 'https://osv-test/repo/url', + 'osv', + 'osv-128', 'osv-test/repo/url', 'pypi', 'repo', @@ -65,7 +65,7 @@ 'semver_fixed_indexes': [], 'severities': [], 'source': 'source', - 'source_id': 'source:BLAH-128.yaml', + 'source_id': 'source:OSV-128.yaml', 'source_of_truth': 2, 'status': 1, 'summary': 'A vulnerability', diff --git a/docker/worker/testdata/UpdateTest_update_new.txt b/docker/worker/testdata/UpdateTest_update_new.txt index 6b5cb77e9ec..a907cc85b5b 100644 --- a/docker/worker/testdata/UpdateTest_update_new.txt +++ b/docker/worker/testdata/UpdateTest_update_new.txt @@ -24,7 +24,7 @@ 'aliases': [], 'credits': [], 'database_specific': None, - 'db_id': 'BLAH-126', + 'db_id': 'OSV-126', 'details': 'Blah blah blah\nBlah\n', 'ecosystem': ['Go'], 'fixed': '', @@ -41,11 +41,12 @@ 'related': [], 'search_indices': [ '126', 'blah', - 'blah-126', 'blah.com/package', 'com', 'go', 'https://osv-test/repo/url', + 'osv', + 'osv-126', 'osv-test/repo/url', 'package', 'repo', @@ -53,7 +54,7 @@ 'semver_fixed_indexes': [], 'severities': [], 'source': 'source', - 'source_id': 'source:BLAH-126.yaml', + 'source_id': 'source:OSV-126.yaml', 'source_of_truth': 2, 'status': 1, 'summary': 'A vulnerability', diff --git a/docker/worker/testdata/UpdateTest_update_no_introduced.txt b/docker/worker/testdata/UpdateTest_update_no_introduced.txt index 18b291ec199..5ea97faf60f 100644 --- a/docker/worker/testdata/UpdateTest_update_no_introduced.txt +++ b/docker/worker/testdata/UpdateTest_update_no_introduced.txt @@ -24,7 +24,7 @@ 'aliases': [], 'credits': [], 'database_specific': None, - 'db_id': 'BLAH-127', + 'db_id': 'OSV-127', 'details': 'Blah blah blah\nBlah\n', 'ecosystem': ['Go'], 'fixed': '', @@ -41,11 +41,12 @@ 'related': [], 'search_indices': [ '127', 'blah', - 'blah-127', 'blah.com/package', 'com', 'go', 'https://osv-test/repo/url', + 'osv', + 'osv-127', 'osv-test/repo/url', 'package', 'repo', @@ -53,7 +54,7 @@ 'semver_fixed_indexes': [], 'severities': [], 'source': 'source', - 'source_id': 'source:BLAH-127.yaml', + 'source_id': 'source:OSV-127.yaml', 'source_of_truth': 2, 'status': 1, 'summary': 'A vulnerability', diff --git a/docker/worker/testdata/UpdateTest_update_partly_bad_ecosystem_new.txt b/docker/worker/testdata/UpdateTest_update_partly_bad_ecosystem_new.txt index ba87811d548..c3391f8ce20 100644 --- a/docker/worker/testdata/UpdateTest_update_partly_bad_ecosystem_new.txt +++ b/docker/worker/testdata/UpdateTest_update_partly_bad_ecosystem_new.txt @@ -22,7 +22,7 @@ 'aliases': [], 'credits': [], 'database_specific': None, - 'db_id': 'BLAH-130', + 'db_id': 'OSV-130', 'details': 'Blah blah blah\nBlah\n', 'ecosystem': ['ecosystem'], 'fixed': '', @@ -39,11 +39,12 @@ 'related': [], 'search_indices': [ '130', 'blah', - 'blah-130', 'blah.com/package', 'com', 'ecosystem', 'https://osv-test/repo/url', + 'osv', + 'osv-130', 'osv-test/repo/url', 'package', 'repo', @@ -51,7 +52,7 @@ 'semver_fixed_indexes': [], 'severities': [], 'source': 'source', - 'source_id': 'source:BLAH-130.yaml', + 'source_id': 'source:OSV-130.yaml', 'source_of_truth': 2, 'status': 1, 'summary': 'A vulnerability', diff --git a/docker/worker/worker_test.py b/docker/worker/worker_test.py index addb0049e7d..61bfab20293 100644 --- a/docker/worker/worker_test.py +++ b/docker/worker/worker_test.py @@ -705,28 +705,28 @@ def setUp(self): self.mock_repo = tests.mock_repository(self) self.remote_source_repo_path = self.mock_repo.path self.mock_repo.add_file( - 'BLAH-123.yaml', - self._load_test_data(os.path.join(TEST_DATA_DIR, 'BLAH-123.yaml')), + 'OSV-123.yaml', + self._load_test_data(os.path.join(TEST_DATA_DIR, 'OSV-123.yaml')), ) self.mock_repo.add_file( - 'BLAH-124.yaml', - self._load_test_data(os.path.join(TEST_DATA_DIR, 'BLAH-124.yaml')), + 'OSV-124.yaml', + self._load_test_data(os.path.join(TEST_DATA_DIR, 'OSV-124.yaml')), ) self.mock_repo.add_file( - 'BLAH-125.yaml', - self._load_test_data(os.path.join(TEST_DATA_DIR, 'BLAH-125.yaml')), + 'OSV-125.yaml', + self._load_test_data(os.path.join(TEST_DATA_DIR, 'OSV-125.yaml')), ) self.mock_repo.add_file( - 'BLAH-127.yaml', - self._load_test_data(os.path.join(TEST_DATA_DIR, 'BLAH-127.yaml')), + 'OSV-127.yaml', + self._load_test_data(os.path.join(TEST_DATA_DIR, 'OSV-127.yaml')), ) self.mock_repo.add_file( - 'BLAH-128.yaml', - self._load_test_data(os.path.join(TEST_DATA_DIR, 'BLAH-128.yaml')), + 'OSV-128.yaml', + self._load_test_data(os.path.join(TEST_DATA_DIR, 'OSV-128.yaml')), ) self.mock_repo.add_file( - 'BLAH-131.yaml', - self._load_test_data(os.path.join(TEST_DATA_DIR, 'BLAH-131.yaml')), + 'OSV-131.yaml', + self._load_test_data(os.path.join(TEST_DATA_DIR, 'OSV-131.yaml')), ) self.mock_repo.commit('User', 'user@email') @@ -742,45 +742,45 @@ def setUp(self): self.source_repo.put() osv.Bug( - db_id='BLAH-123', + db_id='OSV-123', project=['blah.com/package'], ecosystem=['Go'], - source_id='source:BLAH-123.yaml', + source_id='source:OSV-123.yaml', import_last_modified=datetime.datetime(2021, 1, 1, 0, 0), source_of_truth=osv.SourceOfTruth.SOURCE_REPO, ).put() osv.Bug( - db_id='BLAH-124', + db_id='OSV-124', regressed='eefe8ec3f1f90d0e684890e810f3f21e8500a4cd', project=['blah.com/package'], ecosystem=['Go'], - source_id='source:BLAH-124.yaml', + source_id='source:OSV-124.yaml', import_last_modified=datetime.datetime(2021, 1, 1, 0, 0), source_of_truth=osv.SourceOfTruth.SOURCE_REPO, ).put() osv.Bug( - db_id='BLAH-125', + db_id='OSV-125', regressed='eefe8ec3f1f90d0e684890e810f3f21e8500a4cd', fixed='8d8242f545e9cec3e6d0d2e3f5bde8be1c659735', project=['blah.com/package'], ecosystem=['Go'], - source_id='source:BLAH-125.yaml', + source_id='source:OSV-125.yaml', import_last_modified=datetime.datetime(2021, 1, 1, 0, 0), source_of_truth=osv.SourceOfTruth.SOURCE_REPO, ).put() osv.Bug( - db_id='BLAH-127', + db_id='OSV-127', project=['blah.com/package'], ecosystem=['Go'], - source_id='source:BLAH-127.yaml', + source_id='source:OSV-127.yaml', import_last_modified=datetime.datetime(2021, 1, 1, 0, 0), source_of_truth=osv.SourceOfTruth.SOURCE_REPO, ).put() osv.Bug( - db_id='BLAH-131', + db_id='OSV-131', project=['blah.com/package'], ecosystem=['ecosystem'], - source_id='source:BLAH-131.yaml', + source_id='source:OSV-131.yaml', import_last_modified=datetime.datetime(2021, 1, 1, 0, 0), source_of_truth=osv.SourceOfTruth.SOURCE_REPO, ).put() @@ -807,8 +807,8 @@ def test_update(self): message = mock.Mock() message.attributes = { 'source': 'source', - 'path': 'BLAH-123.yaml', - 'original_sha256': _sha256('BLAH-123.yaml'), + 'path': 'OSV-123.yaml', + 'original_sha256': _sha256('OSV-123.yaml'), 'deleted': 'false', } task_runner._source_update(message) @@ -818,11 +818,11 @@ def test_update(self): self.assertEqual('infra@osv.dev', commit.author.email) self.assertEqual('OSV', commit.author.name) - self.assertEqual('Update BLAH-123', commit.message) + self.assertEqual('Update OSV-123', commit.message) diff = repo.diff(commit.parents[0], commit) self.expect_equal('diff_update', diff.patch) - self.expect_dict_equal('update', osv.Bug.get_by_id('BLAH-123')._to_dict()) + self.expect_dict_equal('update', osv.Bug.get_by_id('OSV-123')._to_dict()) affected_commits = list(osv.AffectedCommits.query()) self.assertEqual(1, len(affected_commits)) @@ -848,8 +848,8 @@ def test_update_limit(self): message = mock.Mock() message.attributes = { 'source': 'source', - 'path': 'BLAH-128.yaml', - 'original_sha256': _sha256('BLAH-128.yaml'), + 'path': 'OSV-128.yaml', + 'original_sha256': _sha256('OSV-128.yaml'), 'deleted': 'false', } task_runner._source_update(message) @@ -859,12 +859,12 @@ def test_update_limit(self): self.assertEqual('infra@osv.dev', commit.author.email) self.assertEqual('OSV', commit.author.name) - self.assertEqual('Update BLAH-128', commit.message) + self.assertEqual('Update OSV-128', commit.message) diff = repo.diff(commit.parents[0], commit) self.expect_equal('diff_update_limit', diff.patch) self.expect_dict_equal('update_limit', - osv.Bug.get_by_id('BLAH-128')._to_dict()) + osv.Bug.get_by_id('OSV-128')._to_dict()) affected_commits = list(osv.AffectedCommits.query()) self.assertEqual(1, len(affected_commits)) @@ -883,7 +883,7 @@ def test_update_limit(self): def test_update_add_fix(self): """Test basic update adding a fix.""" fix_result = osv.FixResult( - id='source:BLAH-124.yaml', + id='source:OSV-124.yaml', repo_url='https://osv-test/repo/url', commit='8d8242f545e9cec3e6d0d2e3f5bde8be1c659735', ) @@ -893,8 +893,8 @@ def test_update_add_fix(self): message = mock.Mock() message.attributes = { 'source': 'source', - 'path': 'BLAH-124.yaml', - 'original_sha256': _sha256('BLAH-124.yaml'), + 'path': 'OSV-124.yaml', + 'original_sha256': _sha256('OSV-124.yaml'), 'deleted': 'false', } task_runner._source_update(message) @@ -904,12 +904,12 @@ def test_update_add_fix(self): self.assertEqual('infra@osv.dev', commit.author.email) self.assertEqual('OSV', commit.author.name) - self.assertEqual('Update BLAH-124', commit.message) + self.assertEqual('Update OSV-124', commit.message) diff = repo.diff(commit.parents[0], commit) self.expect_equal('diff_update_add_fix', diff.patch) self.expect_dict_equal('update_add_fix', - osv.Bug.get_by_id('BLAH-124')._to_dict()) + osv.Bug.get_by_id('OSV-124')._to_dict()) affected_commits = list(osv.AffectedCommits.query()) self.assertEqual(1, len(affected_commits)) @@ -934,8 +934,8 @@ def test_update_no_introduced(self): message = mock.Mock() message.attributes = { 'source': 'source', - 'path': 'BLAH-127.yaml', - 'original_sha256': _sha256('BLAH-127.yaml'), + 'path': 'OSV-127.yaml', + 'original_sha256': _sha256('OSV-127.yaml'), 'deleted': 'false', } task_runner._source_update(message) @@ -945,11 +945,11 @@ def test_update_no_introduced(self): self.assertEqual('infra@osv.dev', commit.author.email) self.assertEqual('OSV', commit.author.name) - self.assertEqual('Update BLAH-127', commit.message) + self.assertEqual('Update OSV-127', commit.message) diff = repo.diff(commit.parents[0], commit) self.expect_dict_equal('update_no_introduced', - osv.Bug.get_by_id('BLAH-127')._to_dict()) + osv.Bug.get_by_id('OSV-127')._to_dict()) self.expect_equal('diff_update_no_introduced', diff.patch) affected_commits = list(osv.AffectedCommits.query()) @@ -980,8 +980,8 @@ def test_update_no_introduced(self): def test_update_new(self): """Test update with new vulnerability added.""" self.mock_repo.add_file( - 'BLAH-126.yaml', - self._load_test_data(os.path.join(TEST_DATA_DIR, 'BLAH-126.yaml')), + 'OSV-126.yaml', + self._load_test_data(os.path.join(TEST_DATA_DIR, 'OSV-126.yaml')), ) self.mock_repo.commit('User', 'user@email') @@ -990,8 +990,8 @@ def test_update_new(self): message = mock.Mock() message.attributes = { 'source': 'source', - 'path': 'BLAH-126.yaml', - 'original_sha256': _sha256('BLAH-126.yaml'), + 'path': 'OSV-126.yaml', + 'original_sha256': _sha256('OSV-126.yaml'), 'deleted': 'false', } task_runner._source_update(message) @@ -1001,27 +1001,27 @@ def test_update_new(self): self.assertEqual('infra@osv.dev', commit.author.email) self.assertEqual('OSV', commit.author.name) - self.assertEqual('Update BLAH-126', commit.message) + self.assertEqual('Update OSV-126', commit.message) self.expect_dict_equal('update_new', - osv.Bug.get_by_id('BLAH-126')._to_dict()) + osv.Bug.get_by_id('OSV-126')._to_dict()) def test_update_delete(self): """Test deletion.""" task_runner = worker.TaskRunner(ndb_client, None, self.tmp_dir.name, None, None) - self.mock_repo.delete_file('BLAH-123.yaml') + self.mock_repo.delete_file('OSV-123.yaml') self.mock_repo.commit('User', 'user@email') message = mock.Mock() message.attributes = { 'source': 'source', - 'path': 'BLAH-123.yaml', - 'original_sha256': _sha256('BLAH-123.yaml'), + 'path': 'OSV-123.yaml', + 'original_sha256': _sha256('OSV-123.yaml'), 'deleted': 'true', } task_runner._source_update(message) - bug = osv.Bug.get_by_id('BLAH-123') + bug = osv.Bug.get_by_id('OSV-123') self.assertEqual(osv.BugStatus.INVALID, bug.status) def test_update_no_changes(self): @@ -1031,8 +1031,8 @@ def test_update_no_changes(self): message = mock.Mock() message.attributes = { 'source': 'source', - 'path': 'BLAH-125.yaml', - 'original_sha256': _sha256('BLAH-125.yaml'), + 'path': 'OSV-125.yaml', + 'original_sha256': _sha256('OSV-125.yaml'), 'deleted': 'false', } task_runner._source_update(message) @@ -1050,7 +1050,7 @@ def test_update_conflict(self): message = mock.Mock() message.attributes = { 'source': 'source', - 'path': 'BLAH-123.yaml', + 'path': 'OSV-123.yaml', 'original_sha256': 'invalid', 'deleted': 'false', } @@ -1060,7 +1060,7 @@ def test_update_conflict(self): self.assertEqual( logs.output, [ - f'WARNING:root:sha256sum of BLAH-123.yaml no longer matches (expected=invalid vs current={_sha256("BLAH-123.yaml")}).' + f'WARNING:root:sha256sum of OSV-123.yaml no longer matches (expected=invalid vs current={_sha256("OSV-123.yaml")}).' ], ) @@ -1076,7 +1076,7 @@ def test_update_conflict_while_pushing(self): original_push_source_changes = osv.push_source_changes def mock_push_source_changes(*args, **kwargs): - self.mock_repo.add_file('BLAH-123.yaml', 'changed') + self.mock_repo.add_file('OSV-123.yaml', 'changed') self.mock_repo.commit('Another user', 'user@email') original_push_source_changes(*args, **kwargs) @@ -1090,8 +1090,8 @@ def mock_push_source_changes(*args, **kwargs): message = mock.Mock() message.attributes = { 'source': 'source', - 'path': 'BLAH-123.yaml', - 'original_sha256': _sha256('BLAH-123.yaml'), + 'path': 'OSV-123.yaml', + 'original_sha256': _sha256('OSV-123.yaml'), 'deleted': 'false', } @@ -1105,11 +1105,11 @@ def mock_push_source_changes(*args, **kwargs): ) self.assertRegex( logs.output[1], - r'WARNING:root:Upstream hash for .*/BLAH-123.yaml changed \(expected=.* vs current=.*\)', + r'WARNING:root:Upstream hash for .*/OSV-123.yaml changed \(expected=.* vs current=.*\)', ) self.assertEqual( logs.output[2], - 'WARNING:root:Discarding changes for BLAH-123 due to conflicts.', + 'WARNING:root:Discarding changes for OSV-123 due to conflicts.', ) repo = pygit2.Repository(self.remote_source_repo_path) @@ -1465,8 +1465,8 @@ def test_update_android(self): def test_update_bad_ecosystem_new(self): """Test adding from an unsupported ecosystem.""" self.mock_repo.add_file( - 'BLAH-129.yaml', - self._load_test_data(os.path.join(TEST_DATA_DIR, 'BLAH-129.yaml')), + 'OSV-129.yaml', + self._load_test_data(os.path.join(TEST_DATA_DIR, 'OSV-129.yaml')), ) self.mock_repo.commit('User', 'user@email') @@ -1475,22 +1475,22 @@ def test_update_bad_ecosystem_new(self): message = mock.Mock() message.attributes = { 'source': 'source', - 'path': 'BLAH-129.yaml', - 'original_sha256': _sha256('BLAH-129.yaml'), + 'path': 'OSV-129.yaml', + 'original_sha256': _sha256('OSV-129.yaml'), 'deleted': 'false', } with self.assertLogs(level='WARNING'): task_runner._source_update(message) - bug = osv.Bug.get_by_id('BLAH-129') + bug = osv.Bug.get_by_id('OSV-129') self.assertEqual(osv.BugStatus.INVALID, bug.status) def test_update_partly_bad_ecosystem_new(self): """Test adding vuln with both supported and unsupported ecosystem.""" self.mock_repo.add_file( - 'BLAH-130.yaml', - self._load_test_data(os.path.join(TEST_DATA_DIR, 'BLAH-130.yaml')), + 'OSV-130.yaml', + self._load_test_data(os.path.join(TEST_DATA_DIR, 'OSV-130.yaml')), ) self.mock_repo.commit('User', 'user@email') @@ -1499,8 +1499,8 @@ def test_update_partly_bad_ecosystem_new(self): message = mock.Mock() message.attributes = { 'source': 'source', - 'path': 'BLAH-130.yaml', - 'original_sha256': _sha256('BLAH-130.yaml'), + 'path': 'OSV-130.yaml', + 'original_sha256': _sha256('OSV-130.yaml'), 'deleted': 'false', } @@ -1512,11 +1512,11 @@ def test_update_partly_bad_ecosystem_new(self): self.assertEqual('infra@osv.dev', commit.author.email) self.assertEqual('OSV', commit.author.name) - self.assertEqual('Update BLAH-130', commit.message) + self.assertEqual('Update OSV-130', commit.message) self.expect_dict_equal( 'update_partly_bad_ecosystem_new', - osv.Bug.get_by_id('BLAH-130')._to_dict(), + osv.Bug.get_by_id('OSV-130')._to_dict(), ) def test_update_partly_bad_ecosystem_delete(self): @@ -1528,15 +1528,15 @@ def test_update_partly_bad_ecosystem_delete(self): message = mock.Mock() message.attributes = { 'source': 'source', - 'path': 'BLAH-131.yaml', - 'original_sha256': _sha256('BLAH-131.yaml'), + 'path': 'OSV-131.yaml', + 'original_sha256': _sha256('OSV-131.yaml'), 'deleted': 'false', } with self.assertLogs(level='WARNING'): task_runner._source_update(message) - bug = osv.Bug.get_by_id('BLAH-131') + bug = osv.Bug.get_by_id('OSV-131') self.assertEqual(osv.BugStatus.INVALID, bug.status) def test_update_bucket_cve(self): @@ -1580,9 +1580,9 @@ def test_last_affected_git(self): self.source_repo.put() self.mock_repo.add_file( - 'TEST-last-affected-01.yaml', + 'OSV-TEST-last-affected-01.yaml', self._load_test_data( - os.path.join(TEST_DATA_DIR, 'TEST-last-affected-01.yaml')), + os.path.join(TEST_DATA_DIR, 'OSV-TEST-last-affected-01.yaml')), ) self.mock_repo.commit('User', 'user@email') task_runner = worker.TaskRunner(ndb_client, None, self.tmp_dir.name, None, @@ -1590,8 +1590,8 @@ def test_last_affected_git(self): message = mock.Mock() message.attributes = { 'source': 'source', - 'path': 'TEST-last-affected-01.yaml', - 'original_sha256': _sha256('TEST-last-affected-01.yaml'), + 'path': 'OSV-TEST-last-affected-01.yaml', + 'original_sha256': _sha256('OSV-TEST-last-affected-01.yaml'), 'deleted': 'false', } task_runner._source_update(message) @@ -1604,7 +1604,7 @@ def test_last_affected_git(self): self.expect_dict_equal( 'last_affected_git', - ndb.Key(osv.Bug, 'source:TEST-last-affected-01').get()._to_dict(), + ndb.Key(osv.Bug, 'source:OSV-TEST-last-affected-01').get()._to_dict(), ) affected_commits = list(osv.AffectedCommits.query()) diff --git a/gcp/api/integration_tests.py b/gcp/api/integration_tests.py index 92fa84a1e2d..a3f524a5efa 100644 --- a/gcp/api/integration_tests.py +++ b/gcp/api/integration_tests.py @@ -442,8 +442,8 @@ def test_query_semver_multiple_package(self): timeout=_TIMEOUT) response_json = response.json() - self.assertEqual(1, len(response_json['vulns'])) - self.assertCountEqual(['GHSA-6fc8-4gx4-v693'], + self.assertEqual(2, len(response_json['vulns'])) + self.assertCountEqual(['GHSA-6fc8-4gx4-v693', 'GHSA-3h5v-q93c-6h6q'], [vuln['id'] for vuln in response_json['vulns']]) def test_query_purl(self): diff --git a/gcp/api/osv_service_v1_pb2.py b/gcp/api/osv_service_v1_pb2.py index 378a78104fd..b8d6466bc11 100644 --- a/gcp/api/osv_service_v1_pb2.py +++ b/gcp/api/osv_service_v1_pb2.py @@ -1,11 +1,12 @@ # -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! # source: osv_service_v1.proto +# Protobuf Python Version: 5.26.1 """Generated protocol buffer code.""" -from google.protobuf.internal import builder as _builder from google.protobuf import descriptor as _descriptor from google.protobuf import descriptor_pool as _descriptor_pool from google.protobuf import symbol_database as _symbol_database +from google.protobuf.internal import builder as _builder # @@protoc_insertion_point(imports) _sym_db = _symbol_database.Default() @@ -17,49 +18,49 @@ DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x14osv_service_v1.proto\x12\x06osv.v1\x1a\x17osv/vulnerability.proto\x1a\x1cgoogle/api/annotations.proto\"O\n\x11VulnerabilityList\x12!\n\x05vulns\x18\x01 \x03(\x0b\x32\x12.osv.Vulnerability\x12\x17\n\x0fnext_page_token\x18\x02 \x01(\t\"D\n\x16\x42\x61tchVulnerabilityList\x12*\n\x07results\x18\x01 \x03(\x0b\x32\x19.osv.v1.VulnerabilityList\"h\n\x05Query\x12\x10\n\x06\x63ommit\x18\x01 \x01(\tH\x00\x12\x11\n\x07version\x18\x02 \x01(\tH\x00\x12\x1d\n\x07package\x18\x04 \x01(\x0b\x32\x0c.osv.Package\x12\x12\n\npage_token\x18\x05 \x01(\tB\x07\n\x05param\",\n\nBatchQuery\x12\x1e\n\x07queries\x18\x01 \x03(\x0b\x32\r.osv.v1.Query\"#\n\x15GetVulnByIdParameters\x12\n\n\x02id\x18\x01 \x01(\t\"7\n\x17QueryAffectedParameters\x12\x1c\n\x05query\x18\x01 \x01(\x0b\x32\r.osv.v1.Query\"A\n\x1cQueryAffectedBatchParameters\x12!\n\x05query\x18\x01 \x01(\x0b\x32\x12.osv.v1.BatchQuery\"A\n\x1a\x44\x65termineVersionParameters\x12#\n\x05query\x18\x01 \x01(\x0b\x32\x14.osv.v1.VersionQuery\"C\n\x0cVersionQuery\x12\x0c\n\x04name\x18\x01 \x01(\t\x12%\n\x0b\x66ile_hashes\x18\x02 \x03(\x0b\x32\x10.osv.v1.FileHash\"n\n\x08\x46ileHash\x12\x11\n\tfile_path\x18\x01 \x01(\t\x12,\n\thash_type\x18\x02 \x01(\x0e\x32\x19.osv.v1.FileHash.HashType\x12\x0c\n\x04hash\x18\x03 \x01(\x0c\"\x13\n\x08HashType\x12\x07\n\x03MD5\x10\x00\"9\n\x10VersionMatchList\x12%\n\x07matches\x18\x01 \x03(\x0b\x32\x14.osv.v1.VersionMatch\"\xc7\x01\n\x0cVersionMatch\x12\r\n\x05score\x18\x01 \x01(\x01\x12\x37\n\trepo_info\x18\x02 \x01(\x0b\x32$.osv.v1.VersionRepositoryInformation\x12$\n\x0eosv_identifier\x18\x03 \x01(\x0b\x32\x0c.osv.Package\x12\r\n\x05\x63pe23\x18\x05 \x01(\t\x12\x1c\n\x14minimum_file_matches\x18\x06 \x01(\x03\x12\x1c\n\x14\x65stimated_diff_files\x18\x07 \x01(\x03\"\xc0\x01\n\x1cVersionRepositoryInformation\x12;\n\x04type\x18\x01 \x01(\x0e\x32-.osv.v1.VersionRepositoryInformation.RepoType\x12\x0f\n\x07\x61\x64\x64ress\x18\x02 \x01(\t\x12\x0b\n\x03tag\x18\x04 \x01(\t\x12\x0f\n\x07version\x18\x05 \x01(\t\x12\x0e\n\x06\x63ommit\x18\x06 \x01(\t\"$\n\x08RepoType\x12\x0f\n\x0bUNSPECIFIED\x10\x00\x12\x07\n\x03GIT\x10\x01\x32\xc5\x03\n\x03OSV\x12X\n\x0bGetVulnById\x12\x1d.osv.v1.GetVulnByIdParameters\x1a\x12.osv.Vulnerability\"\x16\x82\xd3\xe4\x93\x02\x10\x12\x0e/v1/vulns/{id}\x12\x65\n\rQueryAffected\x12\x1f.osv.v1.QueryAffectedParameters\x1a\x19.osv.v1.VulnerabilityList\"\x18\x82\xd3\xe4\x93\x02\x12\"\t/v1/query:\x05query\x12y\n\x12QueryAffectedBatch\x12$.osv.v1.QueryAffectedBatchParameters\x1a\x1e.osv.v1.BatchVulnerabilityList\"\x1d\x82\xd3\xe4\x93\x02\x17\"\x0e/v1/querybatch:\x05query\x12\x81\x01\n\x10\x44\x65termineVersion\x12\".osv.v1.DetermineVersionParameters\x1a\x18.osv.v1.VersionMatchList\"/\x82\xd3\xe4\x93\x02)\" /v1experimental/determineversion:\x05queryb\x06proto3') -_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, globals()) -_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'osv_service_v1_pb2', globals()) -if _descriptor._USE_C_DESCRIPTORS == False: - - DESCRIPTOR._options = None - _OSV.methods_by_name['GetVulnById']._options = None - _OSV.methods_by_name['GetVulnById']._serialized_options = b'\202\323\344\223\002\020\022\016/v1/vulns/{id}' - _OSV.methods_by_name['QueryAffected']._options = None - _OSV.methods_by_name['QueryAffected']._serialized_options = b'\202\323\344\223\002\022\"\t/v1/query:\005query' - _OSV.methods_by_name['QueryAffectedBatch']._options = None - _OSV.methods_by_name['QueryAffectedBatch']._serialized_options = b'\202\323\344\223\002\027\"\016/v1/querybatch:\005query' - _OSV.methods_by_name['DetermineVersion']._options = None - _OSV.methods_by_name['DetermineVersion']._serialized_options = b'\202\323\344\223\002)\" /v1experimental/determineversion:\005query' - _VULNERABILITYLIST._serialized_start=87 - _VULNERABILITYLIST._serialized_end=166 - _BATCHVULNERABILITYLIST._serialized_start=168 - _BATCHVULNERABILITYLIST._serialized_end=236 - _QUERY._serialized_start=238 - _QUERY._serialized_end=342 - _BATCHQUERY._serialized_start=344 - _BATCHQUERY._serialized_end=388 - _GETVULNBYIDPARAMETERS._serialized_start=390 - _GETVULNBYIDPARAMETERS._serialized_end=425 - _QUERYAFFECTEDPARAMETERS._serialized_start=427 - _QUERYAFFECTEDPARAMETERS._serialized_end=482 - _QUERYAFFECTEDBATCHPARAMETERS._serialized_start=484 - _QUERYAFFECTEDBATCHPARAMETERS._serialized_end=549 - _DETERMINEVERSIONPARAMETERS._serialized_start=551 - _DETERMINEVERSIONPARAMETERS._serialized_end=616 - _VERSIONQUERY._serialized_start=618 - _VERSIONQUERY._serialized_end=685 - _FILEHASH._serialized_start=687 - _FILEHASH._serialized_end=797 - _FILEHASH_HASHTYPE._serialized_start=778 - _FILEHASH_HASHTYPE._serialized_end=797 - _VERSIONMATCHLIST._serialized_start=799 - _VERSIONMATCHLIST._serialized_end=856 - _VERSIONMATCH._serialized_start=859 - _VERSIONMATCH._serialized_end=1058 - _VERSIONREPOSITORYINFORMATION._serialized_start=1061 - _VERSIONREPOSITORYINFORMATION._serialized_end=1253 - _VERSIONREPOSITORYINFORMATION_REPOTYPE._serialized_start=1217 - _VERSIONREPOSITORYINFORMATION_REPOTYPE._serialized_end=1253 - _OSV._serialized_start=1256 - _OSV._serialized_end=1709 +_globals = globals() +_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals) +_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'osv_service_v1_pb2', _globals) +if not _descriptor._USE_C_DESCRIPTORS: + DESCRIPTOR._loaded_options = None + _globals['_OSV'].methods_by_name['GetVulnById']._loaded_options = None + _globals['_OSV'].methods_by_name['GetVulnById']._serialized_options = b'\202\323\344\223\002\020\022\016/v1/vulns/{id}' + _globals['_OSV'].methods_by_name['QueryAffected']._loaded_options = None + _globals['_OSV'].methods_by_name['QueryAffected']._serialized_options = b'\202\323\344\223\002\022\"\t/v1/query:\005query' + _globals['_OSV'].methods_by_name['QueryAffectedBatch']._loaded_options = None + _globals['_OSV'].methods_by_name['QueryAffectedBatch']._serialized_options = b'\202\323\344\223\002\027\"\016/v1/querybatch:\005query' + _globals['_OSV'].methods_by_name['DetermineVersion']._loaded_options = None + _globals['_OSV'].methods_by_name['DetermineVersion']._serialized_options = b'\202\323\344\223\002)\" /v1experimental/determineversion:\005query' + _globals['_VULNERABILITYLIST']._serialized_start=87 + _globals['_VULNERABILITYLIST']._serialized_end=166 + _globals['_BATCHVULNERABILITYLIST']._serialized_start=168 + _globals['_BATCHVULNERABILITYLIST']._serialized_end=236 + _globals['_QUERY']._serialized_start=238 + _globals['_QUERY']._serialized_end=342 + _globals['_BATCHQUERY']._serialized_start=344 + _globals['_BATCHQUERY']._serialized_end=388 + _globals['_GETVULNBYIDPARAMETERS']._serialized_start=390 + _globals['_GETVULNBYIDPARAMETERS']._serialized_end=425 + _globals['_QUERYAFFECTEDPARAMETERS']._serialized_start=427 + _globals['_QUERYAFFECTEDPARAMETERS']._serialized_end=482 + _globals['_QUERYAFFECTEDBATCHPARAMETERS']._serialized_start=484 + _globals['_QUERYAFFECTEDBATCHPARAMETERS']._serialized_end=549 + _globals['_DETERMINEVERSIONPARAMETERS']._serialized_start=551 + _globals['_DETERMINEVERSIONPARAMETERS']._serialized_end=616 + _globals['_VERSIONQUERY']._serialized_start=618 + _globals['_VERSIONQUERY']._serialized_end=685 + _globals['_FILEHASH']._serialized_start=687 + _globals['_FILEHASH']._serialized_end=797 + _globals['_FILEHASH_HASHTYPE']._serialized_start=778 + _globals['_FILEHASH_HASHTYPE']._serialized_end=797 + _globals['_VERSIONMATCHLIST']._serialized_start=799 + _globals['_VERSIONMATCHLIST']._serialized_end=856 + _globals['_VERSIONMATCH']._serialized_start=859 + _globals['_VERSIONMATCH']._serialized_end=1058 + _globals['_VERSIONREPOSITORYINFORMATION']._serialized_start=1061 + _globals['_VERSIONREPOSITORYINFORMATION']._serialized_end=1253 + _globals['_VERSIONREPOSITORYINFORMATION_REPOTYPE']._serialized_start=1217 + _globals['_VERSIONREPOSITORYINFORMATION_REPOTYPE']._serialized_end=1253 + _globals['_OSV']._serialized_start=1256 + _globals['_OSV']._serialized_end=1709 # @@protoc_insertion_point(module_scope) diff --git a/gcp/api/osv_service_v1_pb2_grpc.py b/gcp/api/osv_service_v1_pb2_grpc.py index d2d89a68ab3..6df3c17b669 100644 --- a/gcp/api/osv_service_v1_pb2_grpc.py +++ b/gcp/api/osv_service_v1_pb2_grpc.py @@ -1,10 +1,35 @@ # Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! """Client and server classes corresponding to protobuf-defined services.""" import grpc +import warnings from osv import vulnerability_pb2 as osv_dot_vulnerability__pb2 import osv_service_v1_pb2 as osv__service__v1__pb2 +GRPC_GENERATED_VERSION = '1.64.1' +GRPC_VERSION = grpc.__version__ +EXPECTED_ERROR_RELEASE = '1.65.0' +SCHEDULED_RELEASE_DATE = 'June 25, 2024' +_version_not_supported = False + +try: + from grpc._utilities import first_version_is_lower + _version_not_supported = first_version_is_lower(GRPC_VERSION, GRPC_GENERATED_VERSION) +except ImportError: + _version_not_supported = True + +if _version_not_supported: + warnings.warn( + f'The grpc package installed is at version {GRPC_VERSION},' + + f' but the generated code in osv_service_v1_pb2_grpc.py depends on' + + f' grpcio>={GRPC_GENERATED_VERSION}.' + + f' Please upgrade your grpc module to grpcio>={GRPC_GENERATED_VERSION}' + + f' or downgrade your generated code using grpcio-tools<={GRPC_VERSION}.' + + f' This warning will become an error in {EXPECTED_ERROR_RELEASE},' + + f' scheduled for release on {SCHEDULED_RELEASE_DATE}.', + RuntimeWarning + ) + class OSVStub(object): """Open source vulnerability database. @@ -20,22 +45,22 @@ def __init__(self, channel): '/osv.v1.OSV/GetVulnById', request_serializer=osv__service__v1__pb2.GetVulnByIdParameters.SerializeToString, response_deserializer=osv_dot_vulnerability__pb2.Vulnerability.FromString, - ) + _registered_method=True) self.QueryAffected = channel.unary_unary( '/osv.v1.OSV/QueryAffected', request_serializer=osv__service__v1__pb2.QueryAffectedParameters.SerializeToString, response_deserializer=osv__service__v1__pb2.VulnerabilityList.FromString, - ) + _registered_method=True) self.QueryAffectedBatch = channel.unary_unary( '/osv.v1.OSV/QueryAffectedBatch', request_serializer=osv__service__v1__pb2.QueryAffectedBatchParameters.SerializeToString, response_deserializer=osv__service__v1__pb2.BatchVulnerabilityList.FromString, - ) + _registered_method=True) self.DetermineVersion = channel.unary_unary( '/osv.v1.OSV/DetermineVersion', request_serializer=osv__service__v1__pb2.DetermineVersionParameters.SerializeToString, response_deserializer=osv__service__v1__pb2.VersionMatchList.FromString, - ) + _registered_method=True) class OSVServicer(object): @@ -100,6 +125,7 @@ def add_OSVServicer_to_server(servicer, server): generic_handler = grpc.method_handlers_generic_handler( 'osv.v1.OSV', rpc_method_handlers) server.add_generic_rpc_handlers((generic_handler,)) + server.add_registered_method_handlers('osv.v1.OSV', rpc_method_handlers) # This class is part of an EXPERIMENTAL API. @@ -118,11 +144,21 @@ def GetVulnById(request, wait_for_ready=None, timeout=None, metadata=None): - return grpc.experimental.unary_unary(request, target, '/osv.v1.OSV/GetVulnById', + return grpc.experimental.unary_unary( + request, + target, + '/osv.v1.OSV/GetVulnById', osv__service__v1__pb2.GetVulnByIdParameters.SerializeToString, osv_dot_vulnerability__pb2.Vulnerability.FromString, - options, channel_credentials, - insecure, call_credentials, compression, wait_for_ready, timeout, metadata) + options, + channel_credentials, + insecure, + call_credentials, + compression, + wait_for_ready, + timeout, + metadata, + _registered_method=True) @staticmethod def QueryAffected(request, @@ -135,11 +171,21 @@ def QueryAffected(request, wait_for_ready=None, timeout=None, metadata=None): - return grpc.experimental.unary_unary(request, target, '/osv.v1.OSV/QueryAffected', + return grpc.experimental.unary_unary( + request, + target, + '/osv.v1.OSV/QueryAffected', osv__service__v1__pb2.QueryAffectedParameters.SerializeToString, osv__service__v1__pb2.VulnerabilityList.FromString, - options, channel_credentials, - insecure, call_credentials, compression, wait_for_ready, timeout, metadata) + options, + channel_credentials, + insecure, + call_credentials, + compression, + wait_for_ready, + timeout, + metadata, + _registered_method=True) @staticmethod def QueryAffectedBatch(request, @@ -152,11 +198,21 @@ def QueryAffectedBatch(request, wait_for_ready=None, timeout=None, metadata=None): - return grpc.experimental.unary_unary(request, target, '/osv.v1.OSV/QueryAffectedBatch', + return grpc.experimental.unary_unary( + request, + target, + '/osv.v1.OSV/QueryAffectedBatch', osv__service__v1__pb2.QueryAffectedBatchParameters.SerializeToString, osv__service__v1__pb2.BatchVulnerabilityList.FromString, - options, channel_credentials, - insecure, call_credentials, compression, wait_for_ready, timeout, metadata) + options, + channel_credentials, + insecure, + call_credentials, + compression, + wait_for_ready, + timeout, + metadata, + _registered_method=True) @staticmethod def DetermineVersion(request, @@ -169,8 +225,18 @@ def DetermineVersion(request, wait_for_ready=None, timeout=None, metadata=None): - return grpc.experimental.unary_unary(request, target, '/osv.v1.OSV/DetermineVersion', + return grpc.experimental.unary_unary( + request, + target, + '/osv.v1.OSV/DetermineVersion', osv__service__v1__pb2.DetermineVersionParameters.SerializeToString, osv__service__v1__pb2.VersionMatchList.FromString, - options, channel_credentials, - insecure, call_credentials, compression, wait_for_ready, timeout, metadata) + options, + channel_credentials, + insecure, + call_credentials, + compression, + wait_for_ready, + timeout, + metadata, + _registered_method=True) diff --git a/gcp/api/test_server.py b/gcp/api/test_server.py index 68f0ca20e9c..5e0583452cb 100644 --- a/gcp/api/test_server.py +++ b/gcp/api/test_server.py @@ -143,7 +143,12 @@ def start_esp(port, backend_port, credential_path, log_path): ] # Stop existing osv-esp processes that weren't killed properly. - subprocess.run(['docker', 'stop', 'osv-esp'], check=False) + result = subprocess.run(['docker', 'stop', 'osv-esp'], check=False) + if result.returncode == 0: + print("Killed process, waiting 5 seconds before starting again") + # If the subprocess actually stopped an instance, wait a bit + # before trying to run the command + time.sleep(5) esp_proc = subprocess.Popen( docker_cmd, stdout=log_handle, stderr=subprocess.STDOUT) return esp_proc diff --git a/gcp/api/v1/api_descriptor.pb b/gcp/api/v1/api_descriptor.pb index 7974a5ad8ae..8a0c1e373a8 100644 Binary files a/gcp/api/v1/api_descriptor.pb and b/gcp/api/v1/api_descriptor.pb differ diff --git a/gcp/appengine/frontend_handlers_test.py b/gcp/appengine/frontend_handlers_test.py index d25da325a3b..f47efdbdd0f 100644 --- a/gcp/appengine/frontend_handlers_test.py +++ b/gcp/appengine/frontend_handlers_test.py @@ -39,8 +39,8 @@ def tearDown(self): def test_ecosystem_counts(self): """Test ecosystem counts aggregates correctly updates.""" models.Bug( - id='BLAH-0', - db_id='BLAH-0', + id='OSV-0', + db_id='OSV-0', status=1, public=True, source='test', @@ -52,8 +52,8 @@ def test_ecosystem_counts(self): }]).put() models.Bug( - id='BLAH-1', - db_id='BLAH-1', + id='OSV-1', + db_id='OSV-1', status=1, public=True, source='test', @@ -70,8 +70,8 @@ def test_ecosystem_counts(self): }]).put() models.Bug( - id='BLAH-2', - db_id='BLAH-2', + id='OSV-2', + db_id='OSV-2', status=1, public=True, source='test', @@ -84,8 +84,8 @@ def test_ecosystem_counts(self): # Invalid entries. models.Bug( - id='BLAH-3', - db_id='BLAH-3', + id='OSV-3', + db_id='OSV-3', status=2, public=True, source='test', @@ -97,8 +97,8 @@ def test_ecosystem_counts(self): }]).put() models.Bug( - id='BLAH-4', - db_id='BLAH-4', + id='OSV-4', + db_id='OSV-4', status=1, public=False, source='test', diff --git a/osv/osv-schema b/osv/osv-schema index 21c7653f2e9..6a95f103a61 160000 --- a/osv/osv-schema +++ b/osv/osv-schema @@ -1 +1 @@ -Subproject commit 21c7653f2e948af769618c3b91b94a54d2935ac1 +Subproject commit 6a95f103a61ad43a0a460cf119ff89144e1b2d7f