Files
codex/codex-rs/core/src
T
Curtis 'Fjord' Hawthorne cc248e4681 js_repl: canonicalize paths for node_modules boundary checks (#12177)
## Summary

Fix `js_repl` package-resolution boundary checks for macOS temp
directory path aliasing (`/var` vs `/private/var`).

## Problem

`js_repl` verifies that resolved bare-package imports stay inside a
configured `node_modules` root.
On macOS, temp directories are commonly exposed as `/var/...` but
canonicalize to `/private/var/...`.
Because the boundary check compared raw paths with `path.relative(...)`,
valid resolutions under temp dirs could be misclassified as escaping the
allowed base, causing false `Module not found` errors.

## Changes

- Add `fs` import in the JS kernel.
- Add `canonicalizePath()` using `fs.realpathSync.native(...)` (with
safe fallback).
- Canonicalize both `base` and `resolvedPath` before running the
`node_modules` containment check.

## Impact

- Fixes false-negative boundary checks for valid package resolutions in
macOS temp-dir scenarios.
- Keeps the existing security boundary behavior intact.
- Scope is limited to `js_repl` kernel module path validation logic.



#### [git stack](https://github.com/magus/git-stack-cli)
- 👉 `1` https://github.com/openai/codex/pull/12177
-  `2` https://github.com/openai/codex/pull/10673
cc248e4681 · 2026-02-18 11:56:45 -08:00
History
..
2026-02-18 11:33:55 +00:00
2026-01-27 11:04:23 -08:00
2026-02-10 16:12:31 +00:00
2026-02-18 18:28:34 +00:00
2026-02-17 20:19:53 -08:00
2026-02-18 18:28:34 +00:00
2026-02-17 20:19:53 -08:00
2026-02-10 11:45:23 -08:00
2025-11-28 11:34:57 +00:00
2026-02-18 18:28:34 +00:00