fix(security): fix file_ops.py validate_sandbox_path startswith bypass #7478 #11236

Merged
HAL9000 merged 2 commits from fix/7478-file-ops-security-fix into master 2026-05-28 14:39:42 +00:00

2 Commits

Author SHA1 Message Date
controller-ci-rerun 04a252e1f9 chore: re-trigger CI [controller]
CI / build (pull_request) Successful in 32s
CI / lint (pull_request) Successful in 46s
CI / quality (pull_request) Successful in 54s
CI / typecheck (pull_request) Successful in 57s
CI / push-validation (pull_request) Successful in 24s
CI / helm (pull_request) Successful in 26s
CI / security (pull_request) Successful in 1m6s
CI / integration_tests (pull_request) Successful in 2m54s
CI / unit_tests (pull_request) Successful in 4m22s
CI / docker (pull_request) Successful in 1m53s
CI / coverage (pull_request) Successful in 11m29s
CI / status-check (pull_request) Successful in 3s
CI / benchmark-regression (push) Failing after 27s
CI / lint (push) Successful in 1m4s
CI / quality (push) Successful in 49s
CI / typecheck (push) Successful in 1m11s
CI / security (push) Successful in 1m21s
CI / push-validation (push) Successful in 35s
CI / helm (push) Successful in 37s
CI / build (push) Successful in 43s
CI / e2e_tests (push) Successful in 1m5s
CI / integration_tests (push) Successful in 4m38s
CI / unit_tests (push) Successful in 6m37s
CI / docker (push) Successful in 1m26s
CI / coverage (push) Successful in 11m7s
CI / status-check (push) Successful in 3s
CI / benchmark-publish (push) Failing after 1h22m20s
2026-05-28 10:23:32 -04:00
HAL9000 19c96d148c fix(security): fix file_ops.py validate_sandbox_path startswith bypass #7478
Replace string-based startswith() path traversal check in validate_sandbox_path
with robust Path.is_relative_to(). The old check using str(target).startswith(str(root))
could be evaded by paths like /workdir/sandboxed/secret when root is /workdir/sandbox,
because the malicious path happens to start with the root string.

Path.is_relative_to() uses semantic path containment comparison and correctly
rejects /workdir/sandboxed/secret as escaping the sandbox at /workdir/sandbox.

Also added a docstring explaining the vulnerability pattern.

ISSUES CLOSED: #7478
2026-05-28 10:23:32 -04:00