fix(security): use relpath containment instead of startswith to prevent prefix-collision bypass
CI / helm (pull_request) Successful in 57s
CI / lint (pull_request) Successful in 1m22s
CI / build (pull_request) Successful in 1m19s
CI / quality (pull_request) Successful in 1m41s
CI / push-validation (pull_request) Successful in 1m12s
CI / typecheck (pull_request) Successful in 1m50s
CI / security (pull_request) Successful in 2m57s
CI / integration_tests (pull_request) Successful in 4m45s
CI / unit_tests (pull_request) Successful in 7m3s
CI / docker (pull_request) Successful in 2m8s
CI / coverage (pull_request) Successful in 15m10s
CI / status-check (pull_request) Successful in 3s

This commit is contained in:
CleverAgents Bot
2026-05-16 04:23:04 +00:00
parent b0b28623a1
commit 1901eb6196
+2 -1
View File
@@ -263,7 +263,8 @@ class InlineToolExecutor:
try:
resolved = Path(value).resolve()
sandbox_resolved = sandbox_path.resolve()
if not str(resolved).startswith(str(sandbox_resolved)):
rel = os.path.relpath(str(resolved), str(sandbox_resolved))
if rel.startswith(".."):
return (
f"Path '{value}' for key '{key}' escapes sandbox "
f"root '{sandbox_path}'"