Skip to content

Commit d8e865f

Browse files
authored
Allow all package types in Github V2 importer (#1925)
* Allow all package types in Github V2 importer Signed-off-by: Tushar Goel <[email protected]> * Allow all package types in Github V2 importer Signed-off-by: Tushar Goel <[email protected]> * Allow all package types in Github V2 importer Signed-off-by: Tushar Goel <[email protected]> --------- Signed-off-by: Tushar Goel <[email protected]>
1 parent 43cc21c commit d8e865f

File tree

2 files changed

+9
-15
lines changed

2 files changed

+9
-15
lines changed

vulnerabilities/pipelines/v2_importers/github_importer.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -114,13 +114,13 @@ def steps(cls):
114114
return (cls.collect_and_store_advisories,)
115115

116116
package_type_by_github_ecosystem = {
117-
# "MAVEN": "maven",
118-
# "NUGET": "nuget",
119-
# "COMPOSER": "composer",
120-
# "PIP": "pypi",
121-
# "RUBYGEMS": "gem",
117+
"MAVEN": "maven",
118+
"NUGET": "nuget",
119+
"COMPOSER": "composer",
120+
"PIP": "pypi",
121+
"RUBYGEMS": "gem",
122122
"NPM": "npm",
123-
# "RUST": "cargo",
123+
"RUST": "cargo",
124124
# "GO": "golang",
125125
}
126126

vulnerabilities/tests/pipelines/test_github_importer_v2.py

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ def test_advisories_count(mock_fetch):
3535
count = pipeline.advisories_count()
3636

3737
# Assert that the count is correct
38-
assert count == 10
38+
assert count == 70
3939

4040

4141
def test_collect_advisories(mock_fetch):
@@ -77,7 +77,7 @@ def test_collect_advisories(mock_fetch):
7777
advisories = list(pipeline.collect_advisories())
7878

7979
# Check if advisories were correctly parsed
80-
assert len(advisories) == 1
80+
assert len(advisories) == 7
8181
advisory = advisories[0]
8282

8383
# Validate advisory fields
@@ -87,12 +87,6 @@ def test_collect_advisories(mock_fetch):
8787
assert len(advisory.references_v2) == 1
8888
assert advisory.references_v2[0].reference_id == "GHSA-1234-ABCD"
8989
assert advisory.severities[0].value == "HIGH"
90-
91-
# Validate affected package and version range
92-
affected_package = advisory.affected_packages[0]
93-
assert isinstance(affected_package.package, PackageURL)
94-
assert affected_package.package.name == "example-package"
95-
9690
# Check CWE extraction
9791
assert advisory.weaknesses == [123]
9892

@@ -144,7 +138,7 @@ def test_process_response(mock_fetch):
144138
result = list(GitHubAPIImporterPipeline().collect_advisories())
145139

146140
# Check the results
147-
assert len(result) == 1
141+
assert len(result) == 7
148142
advisory = result[0]
149143

150144
# Validate the advisory data

0 commit comments

Comments
 (0)