Skip to content

Commit 9f32757

Browse files
authored
Apply suggestions from code review
1 parent 9b36971 commit 9f32757

2 files changed

Lines changed: 7 additions & 7 deletions

File tree

vulnerabilities/importers/istio.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,9 @@ def process_file(self, path):
5959
for release in data.get("releases") or []:
6060
# If it is of form "All releases prior to x"
6161
if "All releases prior" in release:
62-
release = release.strip()
63-
release = release.split(" ")
62+
_ ,_, release = release.strip().rpartition(" ")
6463
constraints.append(
65-
VersionConstraint(version=SemverVersion(release[4]), comparator="<")
64+
VersionConstraint(version=SemverVersion(release), comparator="<")
6665
)
6766

6867
# Eg. 'All releases 1.5 and later'
@@ -97,14 +96,15 @@ def process_file(self, path):
9796

9897
affected_packages.append(
9998
AffectedPackage(
100-
package=PackageURL(type="golang", name="istio"),
99+
package=PackageURL(type="golang", namespace="istio.io",
100+
name="istio"),
101101
affected_version_range=GolangVersionRange(constraints=constraints),
102102
)
103103
)
104104

105105
affected_packages.append(
106106
AffectedPackage(
107-
package=PackageURL(type="github", name="istio"),
107+
package=PackageURL(type="github", namespace="istio", name="istio"),
108108
affected_version_range=GitHubVersionRange(constraints=constraints),
109109
)
110110
)

vulnerabilities/tests/test_data/istio/istio-expected.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
{
99
"package": {
1010
"type": "golang",
11-
"namespace": null,
11+
"namespace": "istio.io",
1212
"name": "istio",
1313
"version": null,
1414
"qualifiers": null,
@@ -20,7 +20,7 @@
2020
{
2121
"package": {
2222
"type": "github",
23-
"namespace": null,
23+
"namespace": "istio",
2424
"name": "istio",
2525
"version": null,
2626
"qualifiers": null,

0 commit comments

Comments
 (0)