OpenAI's Codex Security CLI and TypeScript SDK for finding, validating, and fixing security vulnerabilities. npm: https://www.npmjs.com/package/@openai/codex-security
TypeScript ai-securityapplication-securityclicode-scanningcodexcodex-securitycybersecuritydevsecopsnodejsnpmopenaisdksecuritytypescriptvulnerability-scanning
chore(deps): update Action CLI runtime (#1325)
dependabot[bot]fd84fa408d1e
diff --git a/.github/workflows/action-ci.yml b/.github/workflows/action-ci.ymlindex 25a051adb..30e8e5eec 100644--- a/.github/workflows/action-ci.yml+++ b/.github/workflows/action-ci.yml@@ -34,7 +34,12 @@ jobs:persist-credentials: false- uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0with:- node-version: '24'+ node-version: "24"+ - name: Set up the Ubuntu sandbox+ run: |+ sudo apt-get update+ sudo apt-get install --yes bubblewrap apparmor-profiles+ sudo apparmor_parser -r /usr/share/apparmor/extra-profiles/bwrap-userns-restrict- run: npm ci --ignore-scripts --no-audit --no-fund- run: npm run validate- name: Install the pinned CLI for integration tests@@ -64,12 +69,17 @@ jobs:persist-credentials: false- uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0with:- node-version: '24'+ node-version: "24"+ - name: Set up the Ubuntu sandbox+ run: |+ sudo apt-get update+ sudo apt-get install --yes bubblewrap apparmor-profiles+ sudo apparmor_parser -r /usr/share/apparmor/extra-profiles/bwrap-userns-restrict- name: Run the packaged Action without credentials or model callsid: smokeuses: ./with:- dry-run: 'true'+ dry-run: "true"- name: Verify dry-run outputsenv:SCAN_STATUS: ${{ steps.smoke.outputs.scan-status }}@@ -94,7 +104,7 @@ jobs:persist-credentials: false- uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0with:- node-version: '24'+ node-version: "24"- name: Check action dependenciesrun: npm audit --audit-level=high- name: Check locked CLI dependenciesdiff --git a/README.md b/README.mdindex be83c4a87..1a1ea882f 100644--- a/README.md+++ b/README.md@@ -118,6 +118,11 @@ jobs:security:runs-on: ubuntu-24.04steps:+ - name: Set up the Ubuntu sandbox+ run: |+ sudo apt-get update+ sudo apt-get install --yes bubblewrap apparmor-profiles+ sudo apparmor_parser -r /usr/share/apparmor/extra-profiles/bwrap-userns-restrict- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1with:persist-credentials: falsediff --git a/github-action/README.md b/github-action/README.mdindex 31ce6832e..0099f2886 100644--- a/github-action/README.md+++ b/github-action/README.md@@ -29,6 +29,11 @@ jobs:security:runs-on: ubuntu-24.04steps:+ - name: Set up the Ubuntu sandbox+ run: |+ sudo apt-get update+ sudo apt-get install --yes bubblewrap apparmor-profiles+ sudo apparmor_parser -r /usr/share/apparmor/extra-profiles/bwrap-userns-restrict- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1with:persist-credentials: false@@ -71,6 +76,11 @@ jobs:runs-on: ubuntu-24.04timeout-minutes: 60steps:+ - name: Set up the Ubuntu sandbox+ run: |+ sudo apt-get update+ sudo apt-get install --yes bubblewrap apparmor-profiles+ sudo apparmor_parser -r /usr/share/apparmor/extra-profiles/bwrap-userns-restrict- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1with:ref: ${{ github.event.pull_request.head.sha }}@@ -198,8 +208,13 @@ for code scanning availability and permissions.The Action installs a pinned CLI release from npm using a committed dependencylock. It runs on Linux x64 with Node 24 and Python 3.11 or later; the Ubuntu 24.04-runner supplies these prerequisites. npm and Python are found on the runner's-`PATH`; `actions/setup-node` and `actions/setup-python` can select installations.+runner supplies Node and Python. The setup step above installs Bubblewrap and+loads Ubuntu's `bwrap-userns-restrict` AppArmor profile. This profile lets+Bubblewrap create the sandbox's user namespace and denies capabilities to its+child processes. It is loaded into the running kernel for the job's runner.+Codex uses the system Bubblewrap from `PATH`.++npm and Python are found on the runner's `PATH`; `actions/setup-node` and `actions/setup-python` can select installations.Python helpers preserve the selected virtual environment and library settings.The runner's process tracking marker is retained by the scan coordinator and Deep Scan workers.Authentication uses `OPENAI_API_KEY`.@@ -215,6 +230,11 @@ report paths empty; it does not recover unvalidated partial files from disk.- **Checkout or history errors:** use the triggering revision, `fetch-depth: 0`for PRs, and `persist-credentials: false`.- **Authentication errors:** check the repository secret and model access.+- **Sandbox startup errors:** on Ubuntu 24.04, include the sandbox setup step+ shown above. Installing Bubblewrap alone does not load the AppArmor profile.+ A `bwrap: loopback: Failed RTM_NEWADDR: Operation not permitted` error means+ the sandbox could not configure its network namespace. Check that the profile+ loaded successfully before running the Action.- **Missing SARIF uploads:** inspect `scan-status`, `report-status`, and`sarif-upload-ready`.- **Incomplete scans:** inspect the warning and coverage report before adjustingdiff --git a/github-action/dist/index.cjs b/github-action/dist/index.cjsindex 30d7aa776..1ce6e464a 100644--- a/github-action/dist/index.cjs+++ b/github-action/dist/index.cjs@@ -55858,7 +55858,7 @@ var package_default = {name: "codex-security-action-runtime",private: true,dependencies: {- "@openai/codex-security": "0.1.31"+ "@openai/codex-security": "0.2.0"}};diff --git a/github-action/dist/post.cjs b/github-action/dist/post.cjsindex d65588139..7b5d41db7 100644--- a/github-action/dist/post.cjs+++ b/github-action/dist/post.cjs@@ -19412,7 +19412,7 @@ var package_default = {name: "codex-security-action-runtime",private: true,dependencies: {- "@openai/codex-security": "0.1.31"+ "@openai/codex-security": "0.2.0"}};diff --git a/github-action/runtime/package-lock.json b/github-action/runtime/package-lock.jsonindex b727504a0..d1d9f182b 100644--- a/github-action/runtime/package-lock.json+++ b/github-action/runtime/package-lock.json@@ -6,7 +6,7 @@"": {"name": "codex-security-action-runtime","dependencies": {- "@openai/codex-security": "0.1.31"+ "@openai/codex-security": "0.2.0"}},"node_modules/@alcalzone/ansi-tokenize": {@@ -366,15 +366,15 @@}},"node_modules/@linear/sdk": {- "version": "95.0.0",- "resolved": "https://registry.npmjs.org/@linear/sdk/-/sdk-95.0.0.tgz",- "integrity": "sha512-lZsAJeqWdrWna3/qiv3Xc3pdNyB0TcwHraqEX8oudlUPQqcdnccWm+xCPK4RUB5G8XVGcsrV67VFIVmyiFymGw==",+ "version": "97.0.0",+ "resolved": "https://registry.npmjs.org/@linear/sdk/-/sdk-97.0.0.tgz",+ "integrity": "sha512-ntgZI06I37DTp/XULYTPbOg1t7vJRo72JRSkMjdgG+GbUEHdSkYsUjN0dR42go/2LvLRKWJD3jVehm0wE5haEg==","license": "MIT","dependencies": {"@graphql-typed-document-node/core": "^3.2.0"},"engines": {- "node": ">=18.x"+ "node": "^20.19.0 || >=22.12.0"}},"node_modules/@modelcontextprotocol/server": {@@ -753,9 +753,9 @@}},"node_modules/@openai/codex": {- "version": "0.156.1",- "resolved": "https://registry.npmjs.org/@openai/codex/-/codex-0.156.1.tgz",- "integrity": "sha512-nI1iVl/n2SO2lSvlwEsJx63zdSI4C4Me2gR7AG0OWMJiGSakz2tY2hx43E39Zq5aEoeB5bZjJXzp5Sqhog6vyA==",+ "version": "0.162.0-alpha.15",+ "resolved": "https://registry.npmjs.org/@openai/codex/-/codex-0.162.0-alpha.15.tgz",+ "integrity": "sha512-TPOZK+HRsmGDJhV0Saz1Rdad+533JPoQGo2S3qvyfa3N5NPIgWR4OLqzooFF86piGpAV7z3TSK+FitnB/tS/VQ==","license": "Apache-2.0","bin": {"codex": "bin/codex.js"@@ -764,19 +764,19 @@"node": ">=16"},"optionalDependencies": {- "@openai/codex-darwin-arm64": "npm:@openai/[email protected]",- "@openai/codex-darwin-x64": "npm:@openai/[email protected]",- "@openai/codex-linux-arm64": "npm:@openai/[email protected]",- "@openai/codex-linux-x64": "npm:@openai/[email protected]",- "@openai/codex-win32-arm64": "npm:@openai/[email protected]",- "@openai/codex-win32-x64": "npm:@openai/[email protected]"+ "@openai/codex-darwin-arm64": "npm:@openai/[email protected]",+ "@openai/codex-darwin-x64": "npm:@openai/[email protected]",+ "@openai/codex-linux-arm64": "npm:@openai/[email protected]",+ "@openai/codex-linux-x64": "npm:@openai/[email protected]",+ "@openai/codex-win32-arm64": "npm:@openai/[email protected]",+ "@openai/codex-win32-x64": "npm:@openai/[email protected]"}},"node_modules/@openai/codex-darwin-arm64": {"name": "@openai/codex",- "version": "0.156.1-darwin-arm64",- "resolved": "https://registry.npmjs.org/@openai/codex/-/codex-0.156.1-darwin-arm64.tgz",- "integrity": "sha512-Jg6wbdV+wmMZczhwE74GSxOYEZlViKXn6KyCw/yfrz3PAKFD14xljuPopmdhWC1+8IKU2WdN5fdmXNPt2q4HPA==",+ "version": "0.162.0-alpha.15-darwin-arm64",+ "resolved": "https://registry.npmjs.org/@openai/codex/-/codex-0.162.0-alpha.15-darwin-arm64.tgz",+ "integrity": "sha512-7STJOGzNs/hc5C5BxtDUr3CWiAU799ayqk7p1mBY78CaE4MAbTkv93dA9whzj6FXG/XepX/h1TY1kqqgkW9JEA==","cpu": ["arm64"],@@ -791,9 +791,9 @@},"node_modules/@openai/codex-darwin-x64": {"name": "@openai/codex",- "version": "0.156.1-darwin-x64",- "resolved": "https://registry.npmjs.org/@openai/codex/-/codex-0.156.1-darwin-x64.tgz",- "integrity": "sha512-BVjqNOoltWrnNUrgMRepvDIIBmd4XY+ikAE4pYVHlrwiizNlEWQuCQOTrFMJKp54LFRG8jDTjLZyYQ1QrliuOg==",+ "version": "0.162.0-alpha.15-darwin-x64",+ "resolved": "https://registry.npmjs.org/@openai/codex/-/codex-0.162.0-alpha.15-darwin-x64.tgz",+ "integrity": "sha512-a2q/FwBsHaHOPpbys356DXk2bXpTmA0/SELLjp5nbycSm6N1QKeurS0M57n1s+Hl+7Y+NIqeb/iC1N6mslSOWg==","cpu": ["x64"],@@ -808,9 +808,9 @@},"node_modules/@openai/codex-linux-arm64": {"name": "@openai/codex",- "version": "0.156.1-linux-arm64",- "resolved": "https://registry.npmjs.org/@openai/codex/-/codex-0.156.1-linux-arm64.tgz",- "integrity": "sha512-sTEHk31C12dqzJdjZ2u9KLFCXKL04KyCM+QheSjdQI8uzmVJS7aEF2/qAqFxXwk/jwMzC9u7IihfoIlAGR6YsA==",+ "version": "0.162.0-alpha.15-linux-arm64",+ "resolved": "https://registry.npmjs.org/@openai/codex/-/codex-0.162.0-alpha.15-linux-arm64.tgz",+ "integrity": "sha512-gccb7wQxihB0tDy1aeur7Z+/TCxmlPl1riqFU5Q2zesKa43/ITctbE0tQ+MJCOQ/lthgWZLuIe3IMJVgANpoNg==","cpu": ["arm64"],@@ -825,9 +825,9 @@},"node_modules/@openai/codex-linux-x64": {"name": "@openai/codex",- "version": "0.156.1-linux-x64",- "resolved": "https://registry.npmjs.org/@openai/codex/-/codex-0.156.1-linux-x64.tgz",- "integrity": "sha512-2ePo0wgOcnONKsuzp8vBjOmNY+IdsKaouaDDIdiKq9HOWNuV/GI22OeXft2A/1GaoL71ictO0/pLAsCEnQ6wew==",+ "version": "0.162.0-alpha.15-linux-x64",+ "resolved": "https://registry.npmjs.org/@openai/codex/-/codex-0.162.0-alpha.15-linux-x64.tgz",+ "integrity": "sha512-Z08kGxB8+zF27sIfqfFPcNi547u/us350FLa7P2q4eur6IqnGKA6+pd1TsKDX+OrH6L+MHosEtV23TzoHcgxLg==","cpu": ["x64"],@@ -841,28 +841,28 @@}},"node_modules/@openai/codex-sdk": {- "version": "0.156.1",- "resolved": "https://registry.npmjs.org/@openai/codex-sdk/-/codex-sdk-0.156.1.tgz",- "integrity": "sha512-t1GNPYrSIjHGfBKZ+9pbjOS/by0tMwVe+27fHsMO3RHl9QLIc7dB8XYR954iZ6HpF4EAjZs0melT0mPXF03jVg==",+ "version": "0.162.0-alpha.15",+ "resolved": "https://registry.npmjs.org/@openai/codex-sdk/-/codex-sdk-0.162.0-alpha.15.tgz",+ "integrity": "sha512-8K5c4Ly8FTGyC+dkvGDTvgv9o2CDFgoY6v7XrSK/HgkXLasPEj94w1EG+aGk0x1PSU0feMYYMHqPZm3PoqZNlQ==","license": "Apache-2.0","dependencies": {- "@openai/codex": "0.156.1"+ "@openai/codex": "0.162.0-alpha.15"},"engines": {"node": ">=18"}},"node_modules/@openai/codex-security": {- "version": "0.1.31",- "resolved": "https://registry.npmjs.org/@openai/codex-security/-/codex-security-0.1.31.tgz",- "integrity": "sha512-XdxIQ+JQH3iysFPW2VdFcKAJJo+M+G4hR9x/KlVimMcbmocDVtQT+trjjfNPqZUdb2ZHrW7HHGepeRhMbMvCHQ==",+ "version": "0.2.0",+ "resolved": "https://registry.npmjs.org/@openai/codex-security/-/codex-security-0.2.0.tgz",+ "integrity": "sha512-4lFU15Gf6Oy/nlwAA9vZmUWFR3nQbq0usw1JGsjGvdDilfyqRjRLx73d2UZx4YYkymyhCO8zkuxs3HSffAmU+w==","license": "Apache-2.0","dependencies": {"@inquirer/prompts": "8.7.2",- "@linear/sdk": "95.0.0",+ "@linear/sdk": "97.0.0","@octokit/core": "7.0.8",- "@openai/codex": "0.156.1",- "@openai/codex-sdk": "0.156.1",+ "@openai/codex": "0.162.0-alpha.15",+ "@openai/codex-sdk": "0.162.0-alpha.15","ajv": "8.20.0","fflate": "0.8.3","incur": "0.5.1",@@ -872,7 +872,7 @@"pdfjs-dist": "6.3.289","react": "19.3.0","semver": "7.8.5",- "smol-toml": "1.8.0",+ "smol-toml": "1.9.0","yaml": "2.9.1","yauzl": "3.4.0","zod": "4.6.5"@@ -886,9 +886,9 @@},"node_modules/@openai/codex-win32-arm64": {"name": "@openai/codex",- "version": "0.156.1-win32-arm64",- "resolved": "https://registry.npmjs.org/@openai/codex/-/codex-0.156.1-win32-arm64.tgz",- "integrity": "sha512-e5DsyOHlKWulTBz/neIczpcYLQDqtaLtBj2lgncOgeQw5mlAQVZHlGvKsoKVcEPUKLb8opIMJBxXi6cz3JJ4hg==",+ "version": "0.162.0-alpha.15-win32-arm64",+ "resolved": "https://registry.npmjs.org/@openai/codex/-/codex-0.162.0-alpha.15-win32-arm64.tgz",+ "integrity": "sha512-i5U+xC46zqQ3a3W+ccSZWIEY9ddabSF9QewdBBbUySHkmP7+nVQUw4lrcpUpck+rL36jwtF42vSSAHP+yqFCYQ==","cpu": ["arm64"],@@ -903,9 +903,9 @@},"node_modules/@openai/codex-win32-x64": {"name": "@openai/codex",- "version": "0.156.1-win32-x64",- "resolved": "https://registry.npmjs.org/@openai/codex/-/codex-0.156.1-win32-x64.tgz",- "integrity": "sha512-MJyLxbBs2zzp5kbaR/99Zwe7SmbrwUkveTcT+ayYlO48V0nYh0eU+h2lalBwvC7VJ/ya/bXnUtISJfJKhGCD/g==",+ "version": "0.162.0-alpha.15-win32-x64",+ "resolved": "https://registry.npmjs.org/@openai/codex/-/codex-0.162.0-alpha.15-win32-x64.tgz",+ "integrity": "sha512-o3HSlkrGzzSNsb/M6ayBFV+JdtQHN6BJ6pVGPizAYwdgAmBMyOhv/ayB7czN+pBK3c4/smRs/RRTUOD6yPMKdA==","cpu": ["x64"],@@ -1567,9 +1567,9 @@}},"node_modules/smol-toml": {- "version": "1.8.0",- "resolved": "https://registry.npmjs.org/smol-toml/-/smol-toml-1.8.0.tgz",- "integrity": "sha512-kCZr2V3ch9i00x8zXRhjUNVcjG9ijES5dDudkXvUVCT5QlJNQWElSJdZqyPemffHoLNUYwOcou0Fy+ojN0uHSQ==",+ "version": "1.9.0",+ "resolved": "https://registry.npmjs.org/smol-toml/-/smol-toml-1.9.0.tgz",+ "integrity": "sha512-hpd+HLON7HdZXqYchMM/+LaTTbdK0AU3NngIJ4KVyWbY9bfQqdL9cD+4yf6dUoU2Ap4VsU0JkQi6FxAI1B2mXQ==","license": "BSD-3-Clause","engines": {"node": ">= 18"diff --git a/github-action/runtime/package.json b/github-action/runtime/package.jsonindex 1039c819e..f33af86e9 100644--- a/github-action/runtime/package.json+++ b/github-action/runtime/package.json@@ -2,6 +2,6 @@"name": "codex-security-action-runtime","private": true,"dependencies": {- "@openai/codex-security": "0.1.31"+ "@openai/codex-security": "0.2.0"}}diff --git a/github-action/scripts/cli-integration.ts b/github-action/scripts/cli-integration.tsindex 2bd68b7d1..869760284 100644--- a/github-action/scripts/cli-integration.ts+++ b/github-action/scripts/cli-integration.ts@@ -19,6 +19,7 @@ try {const home = join(root, 'home');await mkdir(repository);await mkdir(home);+ await mkdir(join(home, '.codex'), {mode:0o700});// Pass runner tool lookup/loader settings and isolated homes, without credentials or user configuration.const env = { PATH: process.env.PATH, LD_LIBRARY_PATH:process.env.LD_LIBRARY_PATH, HOME: home, CI: 'true', NO_COLOR: '1',CODEX_HOME: join(home, '.codex'), CODEX_SECURITY_STATE_DIR: join(root, 'state'),@@ -155,9 +156,11 @@ try {await checkPython(venvPython, root, venvEnv);const selected = JSON.parse(execFileSync(process.execPath, ['--input-type=module', '-e', `import { execFileSync } from 'node:child_process';- const { resolvePluginPython } = await import(process.argv[1]);+ const { resolvePluginPython, resolveCodexCommand, probeCodexSandbox } = await import(process.argv[1]);+ const codex = resolveCodexCommand(process.env);+ await probeCodexSandbox(codex, process.env);const python = await resolvePluginPython({environment:process.env, protectedRoot:process.cwd()});- console.log(JSON.stringify({python,+ console.log(JSON.stringify({python, codex:codex.command,...JSON.parse(execFileSync(python, ['-I', '-c', 'import json,os,sys; print(json.dumps(dict(prefix=sys.prefix,loader=os.environ.get("LD_LIBRARY_PATH"))))'],{encoding:'utf8', env:{...process.env, LD_LIBRARY_PATH:undefined}})),tracking:process.env.RUNNER_TRACKING_ID}));@@ -166,6 +169,36 @@ try {assert.equal(selected.prefix, venv);assert.equal(selected.loader, libraryPath);assert.equal(selected.tracking, 'synthetic-cli-job');++ // Exercise filesystem enforcement with the scan and network-disabled Deep+ // worker profiles, using the same pinned Codex and child PATH as the Action.+ const sandboxWorkspace = join(root, 'sandbox-workspace');+ const outsideFile = join(root, 'outside-sandbox-workspace.txt');+ const workspaceFile = join(sandboxWorkspace, 'result.txt');+ await mkdir(sandboxWorkspace);+ await writeFile(outsideFile, 'unchanged');+ for (const [mode, profile] of [+ ['scan', '{filesystem={":root"="read",":workspace_roots"="write"}}'],+ ['worker', '{extends=":read-only",filesystem={":root"="read"},network={enabled=false}}'],+ ] as const) {+ const proof = JSON.parse(execFileSync(selected.codex, [+ 'sandbox', '-c', `permissions.integration=${profile}`, '-P', 'integration', '-C', sandboxWorkspace,+ '--', 'node', '--input-type=module', '-e', `+ import assert from 'node:assert/strict';+ import { readFileSync, writeFileSync } from 'node:fs';+ const [source, outside, workspace, mode] = process.argv.slice(1);+ assert.equal(readFileSync(source, 'utf8'), 'export const example = 1;\\n');+ const denied = error => ['EACCES', 'EPERM', 'EROFS'].includes(error.code);+ assert.throws(() => writeFileSync(outside, 'changed'), denied);+ if (mode === 'scan') writeFileSync(workspace, 'scan output');+ else assert.throws(() => writeFileSync(workspace, 'worker output'), denied);+ writeFileSync(1, JSON.stringify({mode, tracking:process.env.RUNNER_TRACKING_ID}));+ `, join(repository, 'example.ts'), outsideFile, workspaceFile, mode,+ ], {cwd:sandboxWorkspace, env:venvEnv, encoding:'utf8', timeout:30_000}));+ assert.deepEqual(proof, {mode, tracking:'synthetic-cli-job'});+ assert.equal(await readFile(outsideFile, 'utf8'), 'unchanged');+ assert.equal(await readFile(workspaceFile, 'utf8'), 'scan output');+ }// The actual pinned helper must still work when an MCP-style child drops the loader variable.const strippedEnv = {...venvEnv, LD_LIBRARY_PATH:undefined};const loaderSourceInput = join(root, 'loader-source.jsonl');@@ -187,7 +220,7 @@ try {assert.equal(result.policyStatus, 'not-evaluated');assert.equal(result.sarifUploadReady, false);assert.ok(result.errors.some(error => error.includes(cliError.message)));- console.log(`Pinned CLI ${installed.version}: real JSON results, severity exits, SARIF export, Deep Scan, literal-path and virtualenv preflights, MCP runner tracking, and failures passed without model calls.`);+ console.log(`Pinned CLI ${installed.version}: real JSON results, severity exits, SARIF export, Deep Scan, literal-path and virtualenv preflights, sandbox readiness and filesystem enforcement, MCP runner tracking, and failures passed without model calls.`);} finally {await rm(root, { recursive: true, force: true });}