Skip to content

Conversation

@jif-oai
Copy link
Collaborator

@jif-oai jif-oai commented Dec 4, 2025

Change: Seatbelt now allows file-ioctl on /dev/ttys[0-9]+ even without the sandbox extension so pre-created PTYs remain interactive (Python REPL, shells).

Risk: A seatbelted process that already holds a PTY fd (including one it shouldn’t) could issue tty ioctls like TIOCSTI or termios changes on that fd. This doesn’t allow opening new PTYs or reading/writing them; it only broadens ioctl capability on existing fds.

Why acceptable: We already hand the child its PTY for interactive use; restoring ioctls is required for isatty() and prompts to work. The attack requires being given or inheriting a sensitive PTY fd; by design we don’t hand untrusted processes other users’ PTYs (we don't hand them any PTYs actually), so the practical exposure is limited to the PTY intentionally allocated for the session.

Validation:
Running

start a python interpreter and keep it running

Followed by:

  • calculate 1+1 using it -> works as expected
  • Use this Python session to run the command just fix in /Users/jif/code/codex/codex-rs -> does not work as expected

@jif-oai
Copy link
Collaborator Author

jif-oai commented Dec 4, 2025

@codex Can you add an integration test for MacOS? Just try to open a Python REPL and make sure we have >>>

@chatgpt-codex-connector
Copy link
Contributor

Summary

  • Added a macOS seatbelt integration test that launches a Python REPL through a pseudo-terminal, waits for the >>> prompt, and exits cleanly to confirm interactive PTY support under the sandbox. codex-rs/core/tests/suite/seatbelt.rsL205-L317

Testing

View task →

Copy link
Collaborator

@nornagon-openai nornagon-openai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ioctl on non-sandbox ptys seems ok.

@jif-oai jif-oai merged commit 2b5d0b2 into main Dec 4, 2025
26 checks passed
@jif-oai jif-oai deleted the jif/update-seatbelt branch December 4, 2025 17:59
@github-actions github-actions bot locked and limited conversation to collaborators Dec 4, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants