Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Baseline repo with ruff format #220

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[tool.ruff]
line-length = 120
7 changes: 6 additions & 1 deletion scanners/generic/tools/oobtkube.py
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,12 @@ def check_can_create(obj_data: dict) -> bool:
"""Check if possible to create target resources. Verifies connection, sufficient permissions etc"""
resource = obj_data["kind"] # kind must always be present in resource file
try:
subprocess.run(["kubectl", "auth", "can-i", "create", resource], check=True, capture_output=True, timeout=30)
subprocess.run(
["kubectl", "auth", "can-i", "create", resource],
check=True,
capture_output=True,
timeout=30,
)
except subprocess.TimeoutExpired as e:
logging.error(e)
return False
Expand Down
5 changes: 4 additions & 1 deletion scanners/zap/zap.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,10 @@ def _get_standard_options(self):
standard = []

# Proxy workaround (because it currently can't be configured from Automation Framework)
p_host, p_port = self.my_conf("proxy.proxyHost"), self.my_conf("proxy.proxyPort")
p_host, p_port = (
self.my_conf("proxy.proxyHost"),
self.my_conf("proxy.proxyPort"),
)
if p_host and p_port:
standard.extend(["-config", f"network.connection.httpProxy.host={p_host}"])
standard.extend(["-config", f"network.connection.httpProxy.port={p_port}"])
Expand Down
6 changes: 5 additions & 1 deletion tests/scanners/generic/tools/test_convert_trivy_k8s.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,11 @@ def test_convert_json_to_sarif_no_duplicate_rules_with_same_id():
json_data = json.load(open(json_file, encoding="utf-8"))

expected_rules = [
{"id": "RULE001", "name": "First Rule Title", "shortDescription": {"text": "First rule description"}}
{
"id": "RULE001",
"name": "First Rule Title",
"shortDescription": {"text": "First rule description"},
}
]

sarif_result = convert_json_to_sarif(json_data)
Expand Down
Loading