Files
codex/codex-rs/protocol/src
Dmitriy Kovalenko 18e2471c33 Reduce repeated work in filesystem sandbox path checks (#65069)
## Why

Checking multiple paths against the same sandbox policy repeats root
resolution and protected metadata path construction. URI containment
checks also allocate segment lists and check for escaped separators
even when paths contain no escapes.

## What changed

- Lazily cache resolved policy roots, lexical depths, protected metadata
  paths, and the full-disk write decision in the path matcher. Reuse the
  matcher across checks against the same prepared local policy.
- Compare URI path segments directly from iterators and skip decoding
  for plain POSIX segment comparisons. Keep checking the full path for
  encoded separators, including the suffix beyond a matched prefix.

## Testing

Exercise one prepared matcher against protected metadata and an ordinary
writable file. Extend URI prefix tests to cover a candidate shorter than
its base and paths with repeated or trailing separators.

GitOrigin-RevId: 34425d018516e24c36e1c87ea51bfbd344137cd8
2026-12-01 19:57:25 +00:00
..