|
31 | 31 | class IstioImporter(Importer): |
32 | 32 | spdx_license_expression = "Apache-2.0" |
33 | 33 | license_url = "https://github.com/istio/istio.io/blob/master/LICENSE" |
| 34 | + repo_url = "git+https://github.com/istio/istio.io/" |
34 | 35 |
|
35 | 36 | def advisory_data(self) -> Set[AdvisoryData]: |
36 | | - self.clone(repo_url="git+https://github.com/istio/istio.io/") |
| 37 | + self.clone(self.repo_url) |
37 | 38 | path = Path(self.vcs_response.dest_dir) |
38 | 39 | vuln = path / "content/en/news/security/" |
39 | | - for f in vuln.glob("**/*.md"): |
| 40 | + for file in vuln.glob("**/*.md"): |
40 | 41 | # Istio website has files with name starting with underscore, these contain metadata |
41 | 42 | # required for rendering the website. We're not interested in these. |
42 | 43 | # See also https://github.com/nexB/vulnerablecode/issues/563 |
43 | | - f = str(f) |
44 | | - if f.endswith("_index.md"): |
| 44 | + file = str(file) |
| 45 | + if file.endswith("_index.md"): |
45 | 46 | continue |
46 | | - yield from self.process_file(f) |
| 47 | + yield from self.process_file(file) |
47 | 48 |
|
48 | 49 | def process_file(self, path): |
49 | 50 |
|
50 | 51 | data = self.get_data_from_md(path) |
51 | | - release_date = parser.parse(data["publishdate"]).replace(tzinfo=pytz.UTC) |
| 52 | + published_date = data.get("publishdate") |
| 53 | + release_date = None |
| 54 | + if published_date: |
| 55 | + release_date = parser.parse(published_date).replace(tzinfo=pytz.UTC) |
52 | 56 |
|
53 | 57 | constraints = [] |
54 | 58 |
|
@@ -87,10 +91,7 @@ def process_file(self, path): |
87 | 91 | for cve_id in data.get("cves") or []: |
88 | 92 |
|
89 | 93 | if not cve_id.startswith("CVE"): |
90 | | - cve_id = "" |
91 | | - |
92 | | - if not data.get("release_ranges"): |
93 | | - data["release_ranges"] = [] |
| 94 | + continue |
94 | 95 |
|
95 | 96 | affected_packages = [] |
96 | 97 |
|
|
0 commit comments