Open-source AI penetration testing tool to find and fix your app’s vulnerabilities.
Python agentsai-hackingai-penetration-testingai-pentestingai-securityartificial-intelligencebug-bountycode-qualityctf-toolscybersecuritycybersecurity-toolsethical-hackinghackingllm-securityoffensive-securitypenetration-testingpentesting-toolsred-teamingsecuritysecurity-automation
fix(runtime): correct DOCKER_HOST parsing for sandbox URL
Ahmed Allamdab69af033cd
diff --git a/strix/runtime/docker_runtime.py b/strix/runtime/docker_runtime.pyindex 32cc6252..63cb7a03 100644--- a/strix/runtime/docker_runtime.py+++ b/strix/runtime/docker_runtime.py@@ -358,11 +358,7 @@ class DockerRuntime(AbstractRuntime):container = self.client.containers.get(container_id)container.reload()- host = "127.0.0.1"- if "DOCKER_HOST" in os.environ:- docker_host = os.environ["DOCKER_HOST"]- if "://" in docker_host:- host = docker_host.split("://")[1].split(":")[0]+ host = self._resolve_docker_host()except NotFound:raise ValueError(f"Container {container_id} not found.") from None@@ -371,6 +367,20 @@ class DockerRuntime(AbstractRuntime):else:return f"http://{host}:{port}"+ def _resolve_docker_host(self) -> str:+ docker_host = os.getenv("DOCKER_HOST", "")+ if not docker_host:+ return "127.0.0.1"++ from urllib.parse import urlparse++ parsed = urlparse(docker_host)++ if parsed.scheme in ("tcp", "http", "https") and parsed.hostname:+ return parsed.hostname++ return "127.0.0.1"+async def destroy_sandbox(self, container_id: str) -> None:logger.info("Destroying scan container %s", container_id)try: