openai / openai/codex

RegExp.prototype.exec() incorrectly detected as shell execution

Open
#40,408 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Rust
Stars
125k
Forks
19.4k
PR merge metrics
PR metrics pending

Description

What issue are you seeing?

While testing the OpenAI Codex repository with Rune, Rune reported two
dangerous_shell_exec findings that are actually JavaScript
RegExp.prototype.exec() calls.

The affected file is:

codex-rs/skills/src/assets/samples/openai-docs/scripts/fetch-codex-manual.mjs

The two lines are:

const statusMatch = /^HTTP\/\S+\s+(\d{3})/.exec(statusLine);
and:
const match = /^(#{1,6})\s+(.+?)\s*$/.exec(line);
These calls perform regular-expression matching and do not execute a shell command or spawn a process.
Reproductionj 

### What steps can reproduce the bug?

I ran Rune against a clean checkout of Codex.
Results:
709 files scanned
953 facts
341 derived conclusions
5 security findings
1.85 seconds scan time
Two of the five findings were the RegExp.prototype.exec() calls above.
Rune reported them as:
dangerous_shell_exec Dynamic command passed to exec() severity: high



### What is the expected behavior?

A static security detector should distinguish:
/regex/.exec(value)
from actual process execution such as:
child_process.exec(command)
The regex calls should not be reported as shell execution.

### Additional information

This is not being reported as a security vulnerability in Codex.
The issue was discovered while testing an external security scanner (Rune) against the repository. The other three findings from the scan were spawn() calls and have not been classified as vulnerabilities.
The purpose of this report is specifically to document the false-positive behavior described above.

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 by running Rune against a clean Codex checkout and inspect its findings for codex-rs/skills/src/assets/samples/openai-docs/scripts/fetch-codex-manual.mjs. Confirm that the two RegExp.prototype.exec() calls are reported as dangerous_shell_exec, while child_process.exec(command) remains distinguishable; done means the regex calls no longer produce shell-execution findings.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
security
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.