Commit Graph

3 Commits

Author SHA1 Message Date
HAL9000 90083e3ae5 chore(path-security): fix changelog accuracy, remove dead background step, add trailing newline
- CHANGELOG: remove inaccurate Path.is_relative_to() mention not used in code
- Feature file: remove unused Background step referencing non-matching BDD step
- CONTRIBUTORS.md: add missing trailing newline
2026-06-14 09:49:42 -04:00
HAL9000 ccb796165f fix(ci): remove spurious noqa directives and add missing Behave step definitions
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
2026-06-14 09:49:42 -04:00
HAL9000 7a52a5e87b fix(security): fix file_tools.py validate_path startswith bypass #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
2026-06-14 09:49:42 -04:00