codex-security icon indicating copy to clipboard operation
codex-security copied to clipboard

npm package ships bundled MCP launcher as 0644, causing permission denied on POSIX

Open mdeem-humain opened this issue 3 months ago • 2 comments

Summary

The published @openai/codex-security npm package ships the bundled POSIX MCP launcher without an executable bit. The plugin's .mcp.json executes that file directly, so plugin startup fails with Permission denied / exit status 126 until the user manually runs chmod.

This is reproducible with the current npm release, @openai/[email protected] (bundled plugin 0.1.37).

Reproduction

On Linux or macOS:

npm pack @openai/[email protected]
tar -tvzf openai-codex-security-0.1.20.tgz \
  package/_bundled_plugin/scripts/launch_codex_security_mcp \
  package/bin/codex-security.mjs

The archive contains:

-rw-r--r-- package/_bundled_plugin/scripts/launch_codex_security_mcp
-rwxr-xr-x package/bin/codex-security.mjs

After extracting the package:

package/_bundled_plugin/scripts/launch_codex_security_mcp --stdio

fails with:

Permission denied

and exit status 126.

Why this breaks normal CLI scans

sdk/typescript/_bundled_plugin/.mcp.json configures the server as:

{
  "command": "./scripts/launch_codex_security_mcp",
  "args": ["--stdio"],
  "cwd": "."
}

The SDK stages the bundled plugin tree and Codex installs it from the local marketplace, but neither step restores the launcher's executable bit. Consequently, the non-executable mode is propagated to the staged and installed plugin copies.

The file is tracked as executable (100755) in the Git repository, so the mode is being lost in the published npm artifact. The npm CLI entry point is correctly emitted as executable because it is declared in package.json#bin; the bundled launcher is not.

Expected behavior

The documented npx @openai/codex-security scan ... flow should start the bundled MCP server on supported POSIX systems without requiring an undocumented manual permission change.

Workaround

Before running a scan:

chmod u+x /path/to/@openai/codex-security/_bundled_plugin/scripts/launch_codex_security_mcp

If the plugin has already been staged or installed, its staged/cache copies may also need the executable bit restored.

Possible fixes

  • Ensure the published archive preserves or restores executable mode for the bundled launcher.
  • Invoke the POSIX launcher explicitly through /bin/sh instead of executing it directly.
  • Add a package smoke test asserting that the published bundled MCP launcher is executable, in addition to the existing CLI-bin check.

Environment where reproduced: Linux arm64, Node.js 24.16.0.

mdeem-humain avatar Aug 26 '26 05:08 mdeem-humain

Same problem on macOS, CLI 0.1.20, bundled plugin 0.1.37, Codex 0.148.0-alpha.8.

One note: the error message does not mention permissions. My --mode deep scans failed after ~3 minutes with:

Could not save the Codex Security scan: Deep Scan discovery orchestration must finish and persist its manifest before the parent scan can be completed.

The reason is the 0644 launcher. The MCP server does not start, so the scan thread gets no mcp__codex_security__* tools, the deep scan never begins, and the final error is about the manifest instead. That was hard to find.

chmod +x on the npm copy fixed it. I also deleted the old sdk-marketplace and plugins/cache copies, because they keep the old mode.

bepsvpt avatar Aug 26 '26 07:08 bepsvpt

I've noticed this issue and found it block all the scan operations. will investigate and fix soon.

soyeon-oai avatar Aug 27 '26 02:08 soyeon-oai