Skip to content

armgit / strix

Public Imported from GitHub
0

Open-source AI penetration testing tool to find and fix your app’s vulnerabilities.

fix(runtime): bound nano_cpus to docker's int64 NanoCPUs range

Ahmed Allam16982646dfdc
diff --git a/strix/runtime/docker_client.py b/strix/runtime/docker_client.py
index b393e6d2..4dfacf6d 100644
--- a/strix/runtime/docker_client.py
+++ b/strix/runtime/docker_client.py
@@ -80,7 +80,7 @@ def _apply_resource_limits(create_kwargs: dict[str, Any]) -> None:
if cpus:
with contextlib.suppress(ValueError, OverflowError):
nano_cpus = int(float(cpus) * 1_000_000_000)
- if nano_cpus > 0:
+ if 0 < nano_cpus <= 2**63 - 1:
create_kwargs["nano_cpus"] = nano_cpus
pids_limit = os.environ.get("STRIX_SANDBOX_PIDS_LIMIT", "").strip()