Remove all # noqa: ANN205 suppressions from container_tool_exec_steps.py
that were applied to already-annotated (-> None) functions, which caused
RUF100 (Unused noqa directive) lint failures. Add the missing Behave step
definitions required by path_containment_security.feature:
- Given a temporary sandbox directory "{path}"
- When I map the host path "{path}" to container
- Then the mapped path should be "{expected}"
Also rename ambiguous "the result should be true/false" steps to
"the host containment result should be true/false" to avoid AmbiguousStep
conflicts with the parametrized step in cli_steps.py.
ISSUES CLOSED: #7478
Replaced insecure str.startswith(root + "/") path containment checks in
tool/path_mapper.py (_is_under) and application/services/llm_actors.py
(_write_to_sandbox) with semantic os.path.relpath comparisons to prevent
sibling-directory prefix-collision path traversal attacks.
The string-prefix approach was vulnerable: a sandbox root of /tmp/sandbox
would incorrectly allow access to /tmp/sandboxmalicious/file.txt because
"/tmp/sandboxmalicious/file" starts with "/tmp/sandbox".
Security specification mandates all path containment checks use
Path.is_relative_to() or equivalent semantic comparison.
Added BDD test coverage in features/path_containment_security.feature
with @tdd_issue_7478 tags for the prefix-collision attack scenarios.
ISSUES CLOSED: #7478