Skip to content

Commit d90ab42

Browse files
committed
Remove added_advisories method and
assign cve to empty string if its N/A Signed-off-by: Tushar912 <tushar.912u@gmail.com>
1 parent b13c3c0 commit d90ab42

4 files changed

Lines changed: 79 additions & 41 deletions

File tree

vulnerabilities/importer_yielder.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -249,17 +249,15 @@
249249
},
250250
},
251251
{
252-
'name': 'apache_tomcat',
252+
'name': 'apache_kafka',
253253
'license': '',
254254
'last_run': None,
255-
'data_source': 'ApacheTomcatDataSource',
256-
'data_source_cfg': {
257-
"etags": {}
258-
},
255+
'data_source': 'ApacheKafkaDataSource',
256+
'data_source_cfg': {},
259257
},
260258
{
261259
'name': 'istio',
262-
'license': '',
260+
'license': 'apache-2.0',
263261
'last_run': None,
264262
'data_source': 'IstioDataSource',
265263
'data_source_cfg': {

vulnerabilities/importers/istio.py

Lines changed: 28 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -56,26 +56,16 @@ def updated_advisories(self) -> Set[Advisory]:
5656
advisories.extend(processed_data)
5757
return self.batch_advisories(advisories)
5858

59-
def added_advisories(self) -> Set[Advisory]:
60-
files = self._added_files
61-
advisories = []
62-
for f in files:
63-
processed_data = self.process_file(f)
64-
if processed_data:
65-
advisories.extend(processed_data)
66-
return self.batch_advisories(advisories)
67-
68-
def get_versions_for_pkg_from_range_list(self, version_range_list):
59+
def get_pkg_versions_from_ranges(self, version_range_list):
6960
"""Takes a list of version ranges(affected) of a package
7061
as parameter and returns a tuple of safe package versions and
7162
vulnerable package versions"""
72-
63+
all_version = self.version_api.get("istio/istio")
64+
# if not version_range_list:
65+
# return all_version, []
7366
safe_pkg_versions = []
7467
vuln_pkg_versions = []
75-
all_version = self.version_api.get("istio/istio")
76-
if not version_range_list:
77-
return all_version, []
78-
version_ranges = {RangeSpecifier(r) for r in version_range_list}
68+
version_ranges = [RangeSpecifier(r) for r in version_range_list]
7969
for version in all_version:
8070
if any([version in v for v in version_ranges]):
8171
vuln_pkg_versions.append(version)
@@ -113,9 +103,9 @@ def get_yaml_lines(self, lines):
113103
,'cves: [CVE-2019-12243]']
114104
"""
115105

116-
for line in lines:
106+
for index, line in enumerate(lines):
117107
line = line.strip()
118-
if line.startswith("---"):
108+
if line.startswith("---") and index == 0:
119109
continue
120110
elif line.endswith("---"):
121111
break
@@ -131,36 +121,40 @@ def process_file(self, path):
131121
releases = []
132122
if data.get("releases"):
133123
for release in data["releases"]:
134-
release = release.strip()
135-
release = release.split(" ")
136-
if len(release) > 2:
124+
# If it is of form "All versions prior to x"
125+
if "All releases" in release:
126+
release = release.strip()
127+
release = release.split(" ")
128+
releases.append("<" + release[4])
129+
# If it is of form "a to b"
130+
elif "to" in release:
131+
release = release.strip()
132+
release = release.split(" ")
137133
lbound = ">=" + release[0]
138134
ubound = "<=" + release[2]
139135
releases.append(lbound + "," + ubound)
136+
# If it is a single release
137+
elif isinstance(release, int):
138+
releases.append(release)
140139

141-
data["releases"] = releases
140+
data["release_ranges"] = releases
142141

143142
if not data.get("cves"):
144143
data["cves"] = [""]
145144

146145
for cve_id in data["cves"]:
147146

148147
if not cve_id.startswith("CVE"):
149-
continue
148+
cve_id = ""
150149

151150
safe_pkg_versions = []
152151
vuln_pkg_versions = []
153152

154-
if not data.get("releases"):
155-
data["releases"] = []
156-
157-
safe_pkg_versions, vuln_pkg_versions = self.get_versions_for_pkg_from_range_list(
158-
data["releases"])
159-
160-
safe_purls = []
161-
vuln_purls = []
153+
if not data.get("release_ranges"):
154+
data["release_ranges"] = []
162155

163-
cve_id = cve_id
156+
safe_pkg_versions, vuln_pkg_versions = self.get_pkg_versions_from_ranges(
157+
data["release_ranges"])
164158

165159
safe_purls_golang = {
166160
PackageURL(type="golang", name="istio", version=version)
@@ -171,7 +165,7 @@ def process_file(self, path):
171165
PackageURL(type="github", name="istio", version=version)
172166
for version in safe_pkg_versions
173167
}
174-
safe_purls = safe_purls_github | safe_purls_golang
168+
safe_purls = safe_purls_github.union(safe_purls_golang)
175169

176170
vuln_purls_golang = {
177171
PackageURL(type="golang", name="istio", version=version)
@@ -182,14 +176,14 @@ def process_file(self, path):
182176
PackageURL(type="github", name="istio", version=version)
183177
for version in vuln_pkg_versions
184178
}
185-
vuln_purls = vuln_purls_github | vuln_purls_golang
179+
vuln_purls = vuln_purls_github.union(vuln_purls_golang)
186180

187181
advisories.append(
188182
Advisory(
189183
summary=data["description"],
190184
impacted_package_urls=vuln_purls,
191185
resolved_package_urls=safe_purls,
192-
cve_id=cve_id,
186+
vulnerability_id=cve_id,
193187
)
194188
)
195189

vulnerabilities/tests/test_data/istio/test_file.md

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,50 @@ cvss: "8.9"
77
vector: "CVSS:3.0/AV:A/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:N/E:H/RL:O/RC:C"
88
releases: ["1.1 to 1.1.15", "1.2 to 1.2.6", "1.3 to 1.3.1"]
99
publishdate: 2019-05-28
10+
1011
---
12+
13+
{{< security_bulletin >}}
14+
15+
During review of the [Istio 1.1.7](/news/releases/1.1.x/announcing-1.1.7) release notes, we realized that [issue 13868](https://github.com/istio/istio/issues/13868),
16+
which is fixed in the release, actually represents a security vulnerability.
17+
18+
Initially we thought the bug was impacting the [TCP Authorization](/about/feature-stages/#security-and-policy-enforcement) feature advertised
19+
as alpha stability, which would not have required invoking this security advisory process, but we later realized that the
20+
[Deny Checker](https://istio.io/v1.6/docs/reference/config/policy-and-telemetry/adapters/denier/) and
21+
[List Checker](https://istio.io/v1.6/docs/reference/config/policy-and-telemetry/adapters/list/) feature were affected and those are considered stable features.
22+
We are revisiting our processes to flag vulnerabilities that are initially reported as bugs instead of through the
23+
[private disclosure process](/about/security-vulnerabilities/).
24+
25+
We tracked the bug to a code change introduced in Istio 1.1 and affecting all releases up to 1.1.6.
26+
27+
## Impact and detection
28+
29+
Since Istio 1.1, In the default Istio installation profile, policy enforcement is disabled by default.
30+
31+
You can check the status of policy enforcement for your mesh with the following command:
32+
33+
{{< text bash >}}
34+
$ kubectl -n istio-system get cm istio -o jsonpath="{@.data.mesh}" | grep disablePolicyChecks
35+
disablePolicyChecks: true
36+
{{< /text >}}
37+
38+
You are not impacted by this vulnerability if `disablePolicyChecks` is set to true.
39+
40+
You are impacted by the vulnerability issue if the following conditions are all true:
41+
42+
* You are running one of the affected Istio releases.
43+
* `disablePolicyChecks` is set to false (follow the steps mentioned above to check)
44+
* Your workload is NOT using HTTP, HTTP/2, or gRPC protocols
45+
* A mixer adapter (e.g., Deny Checker, List Checker) is used to provide authorization for your backend TCP service.
46+
47+
## Mitigation
48+
49+
* Users of Istio 1.0.x are not affected.
50+
* For Istio 1.1.x deployments: update to [Istio 1.1.7](/news/releases/1.1.x/announcing-1.1.7) or later.
51+
52+
## Credit
53+
54+
The Istio team would like to thank `Haim Helman` for the original bug report.
55+
56+
{{< boilerplate "security-vulnerability" >}}

vulnerabilities/tests/test_istio.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ def test_process_file(self):
173173
version="1.1.0-rc.6",
174174
),
175175
},
176-
cve_id="CVE-2019-12243",
176+
vulnerability_id="CVE-2019-12243",
177177
)
178178
]
179179

0 commit comments

Comments
 (0)