openai / openai/codex-security

Bundled workbench resolves Git from inherited PATH instead of the trusted executable boundary

Open
#129 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

area:python area:sandbox bug priority:p1
Dominant language
TypeScript
Stars
10.8k
Forks
801
Avg merge
1d 8h
Merged PRs (30d)
257

Description

Summary

The TypeScript target and bulk-scan paths deliberately resolve Git through resolveTrustedExecutable, but bundled Python workbench helpers invoke git by name from their inherited PATH.

Relevant code:

resolvePluginPython safely resolves the Python interpreter, but returns only the executable path. The sanitized environment produced while resolving it is not retained. Workbench execution later receives the normal scan environment, and Python calls commands beginning with "git".

Why this matters

If the effective PATH contains a repository-controlled directory, such as a checkout-local node_modules/.bin, workbench registration, target inspection, snapshot calculation, or ranking preparation can execute a repository-provided Git shim with the scanning user's permissions.

This bypasses the same trust boundary already enforced and regression-tested in targets.ts and multiscan.ts. A shim can also return fabricated repository metadata, affecting target identity and integrity calculations.

Expected behavior

Every host-side Git invocation should use one trusted, absolute executable selected outside the protected repository root, together with the sanitized environment associated with that selection.

Actual behavior

The workbench and ranking helpers search inherited PATH independently.

Suggested direction

Resolve Git once with resolveTrustedExecutable, pass the absolute path and sanitized Git environment into workbench commands, and make Python helpers require that path. Add regression coverage using a repository-local Git shim and assert it is never executed.

Found by static audit of upstream main at 9c7634b.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with resolveTrustedExecutable usage in targets.ts and multiscan.ts, then inspect workbench_target.py, generate_rank_input.py, and the workbench environment construction in sdk/typescript/src/api.ts. Trace how Git paths and environments reach the Python helpers. Done means host-side workbench Git calls use the trusted selection and regression coverage shows a repository-local Git shim is never executed.

Written by the indexing model from the issue text.

Assessment

Tech stack
git, python, typescript
Domain
cli, security
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.