core-agent-ide/codex-rs/utils
Tiffany Citra 8179312ff5
fix: Fix tilde expansion to avoid absolute-path escape (#9621)
### Motivation
- Prevent inputs like `~//` or `~///etc` from expanding to arbitrary
absolute paths (e.g. `/`) because `Path::join` discards the left side
when the right side is absolute, which could allow config values to
escape `HOME` and broaden writable roots.

### Description
- In `codex-rs/utils/absolute-path/src/lib.rs` update
`maybe_expand_home_directory` to trim leading separators from the suffix
and return `home` when the remainder is empty so tilde expansion stays
rooted under `HOME`.
- Add a non-Windows unit test
`home_directory_double_slash_on_non_windows_is_expanded_in_deserialization`
that validates `"~//code"` expands to `home.join("code")`.

### Testing
- Ran `just fmt` successfully.
- Ran `just fix -p codex-utils-absolute-path` (Clippy autofix)
successfully.
- Ran `cargo test -p codex-utils-absolute-path` and all tests passed.

------
[Codex
Task](https://chatgpt.com/codex/tasks/task_i_697007481cac832dbeb1ee144d1e4cbe)
2026-01-21 10:43:10 -08:00
..
absolute-path fix: Fix tilde expansion to avoid absolute-path escape (#9621) 2026-01-21 10:43:10 -08:00
cache feat: add support for building with Bazel (#8875) 2026-01-09 11:09:43 -08:00
cargo-bin feat: add support for building with Bazel (#8875) 2026-01-09 11:09:43 -08:00
git feat: add support for building with Bazel (#8875) 2026-01-09 11:09:43 -08:00
image feat: add support for building with Bazel (#8875) 2026-01-09 11:09:43 -08:00
json-to-toml feat: add support for building with Bazel (#8875) 2026-01-09 11:09:43 -08:00
pty feat: detach non-tty childs (#9477) 2026-01-19 11:35:34 +00:00
readiness feat: add support for building with Bazel (#8875) 2026-01-09 11:09:43 -08:00
string feat: add support for building with Bazel (#8875) 2026-01-09 11:09:43 -08:00