Skip to content

security: resolve ps and lsof only from fixed system paths #61

Closed

Description

@abruption

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-unlock 0.4.0 at 6227e6c
  • macOS 27.0 arm64, Linux

Source evidence

Acceptance criteria

  • ps is resolved only from /bin/ps or /usr/bin/ps; otherwise evidence is unknown.
  • The lsof PATH fallback is removed or reported explicitly in diagnostics.
  • A test with a shadowing ps/lsof on PATH confirms that the system binaries are used.

Scope and limitations

  • Defense-in-depth hardening. Anyone who controls the user's PATH can already run code as that user, so this is not a privilege boundary.

Checked

Activity

  1. added
    enhancement
    on Sep 28, 2026
  2. added this to the v0.4.1 milestone on Sep 28, 2026
  3. added a commit that references this issue on Sep 29, 2026
    8b878bc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions