Commit 984e15a
committed
rollout: chmod session JSONL files to 0o600
`open_log_file` previously created session rollout files via
`OpenOptions::new().append(true).create(true).open(path)` and parent
directories via `fs::create_dir_all`, neither of which set a Unix mode.
With the standard macOS / Linux default umask of 022, this yielded files
at 0o644 (world-readable) and directories at 0o755 (world-traversable).
Rollout JSONL holds the full conversation transcript: user prompts,
model responses, and every tool I/O — file contents read by the agent,
command stdout/stderr, and reasoning traces. On any host with more than
one local UID (shared dev boxes, CI runners, JupyterHub nodes,
multi-user macOS, build farms), other unprivileged users could `cat`
the victim's complete Codex history without privilege escalation.
The sibling `codex-rs/message-history` crate already implements the
correct pattern for `~/.codex/history.jsonl`: `OpenOptions::mode(0o600)`
plus an `ensure_owner_only_permissions` post-hoc chmod. This change
mirrors that pattern in the rollout recorder:
* `DirBuilder::mode(0o700)` so newly-created session directories are
owner-only.
* `OpenOptions::mode(0o600)` so newly-created rollout files are
owner-only.
* A post-open `set_permissions` belt-and-suspenders so files created
by older Codex versions at 0o644 get tightened on next reopen.
Existing parent directories are left alone (`DirBuilder::mode` only
applies on creation); operators on shared hosts may want to
`chmod 0700 ~/.codex` once after upgrade. Future work could extend the
post-hoc tightening to directory metadata as well.1 parent 163eac9 commit 984e15a
1 file changed
Lines changed: 38 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
7 | 13 | | |
8 | 14 | | |
9 | 15 | | |
| |||
1410 | 1416 | | |
1411 | 1417 | | |
1412 | 1418 | | |
| 1419 | + | |
| 1420 | + | |
| 1421 | + | |
| 1422 | + | |
| 1423 | + | |
| 1424 | + | |
| 1425 | + | |
| 1426 | + | |
| 1427 | + | |
| 1428 | + | |
1413 | 1429 | | |
1414 | | - | |
1415 | | - | |
1416 | | - | |
1417 | | - | |
| 1430 | + | |
| 1431 | + | |
| 1432 | + | |
| 1433 | + | |
| 1434 | + | |
| 1435 | + | |
| 1436 | + | |
| 1437 | + | |
| 1438 | + | |
| 1439 | + | |
| 1440 | + | |
| 1441 | + | |
| 1442 | + | |
| 1443 | + | |
| 1444 | + | |
| 1445 | + | |
| 1446 | + | |
| 1447 | + | |
| 1448 | + | |
| 1449 | + | |
| 1450 | + | |
| 1451 | + | |
1418 | 1452 | | |
1419 | 1453 | | |
1420 | 1454 | | |
| |||
0 commit comments