fix(terminal): tolerate malformed lifecycle script paths - #78430
fix(terminal): tolerate malformed lifecycle script paths#78430randomsnowflake wants to merge 1 commit into
Conversation
|
Closing as superseded by #80258, which fixes this whole bug class architecturally rather than per-callsite: path candidates are sanitized once at the ingestion boundary (NUL/empty/unexpandable tokens rejected before any OS call), text from any Your report and fix targeted a real member of this class — thank you. The per-callsite patches kept leaving sibling frames exposed (#76762 → #77703 → #77780 → #78256 each crashed one frame away from the previous fix), which is why we went with the boundary fix instead of merging the fragments individually. #80258 carries regression tests for the NUL-path, binary-callback, oversized-read, unset-HOME, and walk-crash cases plus an adversarial never-raises sweep. |
Summary
terminalbefore command executionReproduction
A referenced path containing an embedded NUL reaches
_read_referenced_script().Path.resolve()already handlesValueError, but the subsequentos.open()did not, so terminal calls failed with:Verification
uv run pytest -q tests/hermes_cli/test_gateway_restart_loop.py— 83 passeduv run ruff check cron/lifecycle_guard.py tests/hermes_cli/test_gateway_restart_loop.py— passed