Skip to content

Commit

Permalink
[container analysis] effective severity [(#3478)](GoogleCloudPlatform…
Browse files Browse the repository at this point in the history
…/python-docs-samples#3478)

Use new effective_severity field

fixes b/142836422
  • Loading branch information
daniel-sanche authored Apr 23, 2020
1 parent b8599b7 commit 7dc18ea
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion samples/snippets/samples.py
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ def find_high_severity_vulnerabilities_for_image(resource_url, project_id):
vulnerabilities = grafeas_client.list_occurrences(project_name, filter_str)
filtered_list = []
for v in vulnerabilities:
if v.severity == Severity.HIGH or v.severity == Severity.CRITICAL:
if v.effective_severity == Severity.HIGH or v.effective_severity == Severity.CRITICAL:
filtered_list.append(v)
return filtered_list
# [END containeranalysis_filter_vulnerability_occurrences]
1 change: 1 addition & 0 deletions samples/snippets/samples_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,7 @@ def test_find_high_severity_vulnerabilities(self):
'note_name': client.note_path(PROJECT_ID, note_id),
'resource_uri': self.image_url,
'vulnerability': {
'effective_severity': Severity.CRITICAL,
'package_issue': [
{
'affected_cpe_uri': 'your-uri-here',
Expand Down

0 comments on commit 7dc18ea

Please sign in to comment.