Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions cron/lifecycle_guard.py
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,15 @@ def _contains_unsafe_gateway_action(
if script_text is None and read_remote_script is not None:
# Local path missing; try the remote backend if one is available.
script_text = read_remote_script(str(script_path))
if script_text and "\x00" in script_text:
# Any read_remote_script callback (terminal_tool's env-based
# fallback, SSH/Modal/Daytona backends) may return binary
# content. A NUL byte in the text marks machine code, not a
# shell script: feeding it to the recursion re-tokenizes it
# into NUL-bearing paths that crash os.open with
# `ValueError: embedded null byte` (#77703, #77780). Treat it
# as "nothing to scan", mirroring _read_referenced_script.
continue
if not script_text:
continue
# Relative references inside a script resolve against that script's
Expand Down
5 changes: 5 additions & 0 deletions tools/terminal_tool.py
Original file line number Diff line number Diff line change
Expand Up @@ -2565,6 +2565,11 @@ def _read_script_in_env(script_path: str) -> Optional[str]:
# Binary content from a remote `cat`: skip for the
# same reason as the local branch above (#77703).
return None
if len(output) > 1024 * 1024:
# Same size bound as the local branch: never feed
# oversized content (e.g. a large remote binary)
# into the scanner recursion (#77780).
return None
return output
except Exception:
pass
Expand Down