Skip to content

Commit

Permalink
🐛 fix trivyoperator tags
Browse files Browse the repository at this point in the history
  • Loading branch information
manuel-sommer committed Nov 17, 2024
1 parent 5168154 commit 6786679
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 4 deletions.
3 changes: 2 additions & 1 deletion dojo/tools/trivy_operator/checks_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,9 @@ def handle_checks(self, labels, checks, test):
static_finding=True,
dynamic_finding=False,
service=service,
tags=[resource_namespace],
)
if resource_namespace != "":
finding.tags=resource_namespace,

Check failure on line 50 in dojo/tools/trivy_operator/checks_handler.py

View workflow job for this annotation

GitHub Actions / ruff-linting

Ruff (E225)

dojo/tools/trivy_operator/checks_handler.py:50:29: E225 Missing whitespace around operator

Check failure on line 50 in dojo/tools/trivy_operator/checks_handler.py

View workflow job for this annotation

GitHub Actions / ruff-linting

Ruff (COM818)

dojo/tools/trivy_operator/checks_handler.py:50:48: COM818 Trailing comma on bare tuple prohibited
if check_id:
finding.unsaved_vulnerability_ids = [UniformTrivyVulnID().return_uniformed_vulnid(check_id)]
findings.append(finding)
Expand Down
3 changes: 2 additions & 1 deletion dojo/tools/trivy_operator/secrets_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ def handle_secrets(self, labels, secrets, test):
static_finding=True,
dynamic_finding=False,
service=service,
tags=[resource_namespace],
)
if resource_namespace != "":
finding.tags=resource_namespace,

Check failure on line 58 in dojo/tools/trivy_operator/secrets_handler.py

View workflow job for this annotation

GitHub Actions / ruff-linting

Ruff (E225)

dojo/tools/trivy_operator/secrets_handler.py:58:29: E225 Missing whitespace around operator

Check failure on line 58 in dojo/tools/trivy_operator/secrets_handler.py

View workflow job for this annotation

GitHub Actions / ruff-linting

Ruff (COM818)

dojo/tools/trivy_operator/secrets_handler.py:58:48: COM818 Trailing comma on bare tuple prohibited
findings.append(finding)
return findings
3 changes: 2 additions & 1 deletion dojo/tools/trivy_operator/vulnerability_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,9 @@ def handle_vulns(self, labels, vulnerabilities, test):
dynamic_finding=False,
service=service,
file_path=file_path,
tags=finding_tags,
)
if finding_tags != "":
finding.tags=finding_tags,

Check failure on line 88 in dojo/tools/trivy_operator/vulnerability_handler.py

View workflow job for this annotation

GitHub Actions / ruff-linting

Ruff (E225)

dojo/tools/trivy_operator/vulnerability_handler.py:88:29: E225 Missing whitespace around operator

Check failure on line 88 in dojo/tools/trivy_operator/vulnerability_handler.py

View workflow job for this annotation

GitHub Actions / ruff-linting

Ruff (COM818)

dojo/tools/trivy_operator/vulnerability_handler.py:88:42: COM818 Trailing comma on bare tuple prohibited
if vuln_id:
finding.unsaved_vulnerability_ids = [UniformTrivyVulnID().return_uniformed_vulnid(vuln_id)]
findings.append(finding)
Expand Down
2 changes: 1 addition & 1 deletion unittests/tools/test_trivy_operator_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ def test_vulnerabilityreport_extended(self):
self.assertEqual("3.6.13-2ubuntu1.10", finding.mitigation)
self.assertEqual(5.9, finding.cvssv3_score)
self.assertEqual("ubuntu:20.04 (ubuntu 20.04)", finding.file_path)
self.assertEqual("lbc, os-pkgs, ubuntu", str(finding.tags))
self.assertEqual('"[\'lbc\', \'ubuntu\', \'os-pkgs\']"', str(finding.tags))

def test_cis_benchmark(self):
with open(sample_path("cis_benchmark.json"), encoding="utf-8") as test_file:
Expand Down

0 comments on commit 6786679

Please sign in to comment.