Repository navigation
Description
What happened
ps is always executed by bare name and resolved through PATH. lsof is resolved from /usr/sbin/lsof or /usr/bin/lsof but falls back to PATH if neither exists.
A PATH entry that shadows ps (for example a project's node_modules/.bin when invoked via npx or an npm script) can report arbitrary UID, arguments, start time, or PPID. The safety policy relies on these values for the same-user, non-shared, and stable-identity decisions.
What you expected
Process-evidence tools are resolved from fixed system locations, consistent with the existing absolute-path handling for lsof. If they are not found there, the result is unknown.
Environment
codex-unlock0.4.0 at6227e6c- macOS 27.0 arm64, Linux
Source evidence
lsofPATH fallback:Lines 28 to 35 in 6227e6c
} catch { // Continue to PATH lookup. } } const result = await runCommand("lsof", ["-v"]); return result.failure?.kind === "spawn_error" && result.error?.code === "ENOENT" ? null : "lsof"; psby bare name:,Line 103 in 6227e6c
const result = await runCommand("ps", ["-p", String(pid), "-o", `${field}=`]); ,Line 146 in 6227e6c
const result = await runCommand("ps", ["-p", String(pid), "-o", "lstart="]); Line 330 in 6227e6c
const result = await runCommand("ps", ["-axo", "pid=,ppid="]);
Acceptance criteria
psis resolved only from/bin/psor/usr/bin/ps; otherwise evidence isunknown.- The
lsofPATH fallback is removed or reported explicitly in diagnostics. - A test with a shadowing
ps/lsofonPATHconfirms that the system binaries are used.
Scope and limitations
- Defense-in-depth hardening. Anyone who controls the user's
PATHcan already run code as that user, so this is not a privilege boundary.
Checked
- security: bound external command execution time and output #13 bounded command time and output but did not address binary resolution.
Activity
fix: harden diagnostic command execution