Skip to content

fix(sandbox-lint): normalise every trailing slash, not just one - #1149

Open
AmirF194 wants to merge 1 commit into
apache:mainfrom
AmirF194:fix/sandboxlint-normalise-idempotent
Open

fix(sandbox-lint): normalise every trailing slash, not just one#1149
AmirF194 wants to merge 1 commit into
apache:mainfrom
AmirF194:fix/sandboxlint-normalise-idempotent

Conversation

@AmirF194

@AmirF194 AmirF194 commented Sep 5, 2026

Copy link
Copy Markdown
Contributor

Summary

Type of change

  • Python package (tools/*/ with pyproject.toml)

Test plan

  • Added a double-trailing-slash case to the existing allowRead/allowWrite parametrized tests; both are red on main, green on this branch.
  • ruff check, ruff format --check and mypy on tools/sandbox-lint are clean (mypy needs pytest installed to resolve the test-file imports; not a change this PR introduces).
  • Full tools/sandbox-lint suite: 55 passed, in a clean python:3.11-slim container. Did not run prek itself (not available in this sandbox), ran the underlying ruff/mypy/pytest commands by hand instead.

RFC-AI-0004 compliance

  • Sandbox: no new host access, this only makes the existing credential-path check stricter.

Linked issues

Fixes #1148.

_normalise() stripped a single trailing slash so a config path and its
slash variant compare equal against FORBIDDEN_ALLOW_READ /
FORBIDDEN_ALLOW_WRITE. A path with two or more trailing slashes (e.g.
"~/.ssh//") only lost one, so it never matched the forbidden entry and
check_invariants() reported no violation for a config that grants read
or write access into a credential directory.

Strip all trailing slashes instead, keeping the bare-root case ("/")
intact. Added a double-slash case to the existing parametrized
allowRead/allowWrite tests; both fail on main and pass with this
change.

Generated-by: Claude Code (Sonnet 5)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

sandbox-lint's path normaliser strips only one trailing slash, so a double-slash credential path bypasses the M.29 check

1 participant