mirror of
https://github.com/openai/codex.git
synced 2026-12-02 00:31:03 +00:00
## 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