Skip to content

OpenAI's Codex Security CLI and TypeScript SDK for finding, validating, and fixing security vulnerabilities. npm: https://www.npmjs.com/package/@openai/codex-security

fix(action): validate generated files before rebuilding them (#1934)

Michael D'Angelo1b3eab1a0b15
diff --git a/github-action/README.md b/github-action/README.md
index 7ab23d00e..c7e4e0f4c 100644
--- a/github-action/README.md
+++ b/github-action/README.md
@@ -467,27 +467,35 @@ elapsed-time messages only.
## Development
-From the repository root:
+From the repository root, use Node.js 24 to check the committed files and audit
+both dependency locks.
```bash
npm --prefix github-action ci --ignore-scripts --no-audit --no-fund
-npm --prefix github-action run docs
-npm --prefix github-action run build
npm --prefix github-action run validate
-# Test the published CLI with synthetic scans and a local request fixture:
+npm --prefix github-action audit --audit-level=high
+npm --prefix github-action/runtime audit --omit=dev --audit-level=high
+```
+
+After changing Action inputs or outputs, run `npm --prefix github-action run docs`
+to regenerate the README reference. After changing bundled source or the runtime
+lock, run `npm --prefix github-action run build`. Review the generated README and
+`dist/*.cjs` changes, rerun validation, and commit them with their source changes.
+
+On Linux x64 with a working sandbox, run the published CLI integration and
+packaged smoke tests.
+
+```bash
npm --prefix github-action/runtime ci --ignore-scripts --no-audit --no-fund
npm --prefix github-action run test:cli
-# Linux x64 with Node 24; no model calls:
node github-action/scripts/linux-smoke.mjs
```
-Commit source changes and the generated `dist/*.cjs` bundles together.
Validation checks types, tests, Action metadata, documentation, and bundle
reproducibility. CI also tests the result adapter against the pinned CLI and its
SARIF exporter using synthetic scans. A local inference fixture checks request
-attribution and the analytics opt-out with synthetic credentials; it makes no
-external model calls. CI also runs the packaged Linux smoke test and audits the
-Action and CLI dependency locks. The `@openai/codex-security` dependency in
+attribution and the analytics opt-out with synthetic credentials. These tests run
+without external model calls. The `@openai/codex-security` dependency in
`runtime/package.json` is the installed CLI version source. Main keeps an already
published CLI baseline so its checks remain runnable while a release PR prepares
the next product version. This development pin does not necessarily track the
diff --git a/github-action/scripts/generate-input-docs.mjs b/github-action/scripts/generate-input-docs.mjs
index 581b74aa6..7d6c94b7f 100644
--- a/github-action/scripts/generate-input-docs.mjs
+++ b/github-action/scripts/generate-input-docs.mjs
@@ -24,8 +24,10 @@ const path = new URL('../README.md', import.meta.url);
const current = await readFile(path, 'utf8');
const start = '<!-- action-reference:start -->';
const end = '<!-- action-reference:end -->';
-assert.ok(current.includes(start) && current.includes(end), 'README must contain action reference markers');
-const updated = current.slice(0, current.indexOf(start)) + start + '\n\n' + reference + '\n' + current.slice(current.indexOf(end));
+const startIndex = current.indexOf(start);
+const endIndex = current.indexOf(end);
+assert.ok(startIndex >= 0 && startIndex < endIndex, 'README must contain action reference markers in order');
+const updated = current.slice(0, startIndex) + start + '\n\n' + reference + '\n' + current.slice(endIndex);
if (process.argv.includes('--check')) {
assert.equal(current, updated, 'Action reference differs from action.yml. Run npm run docs.');
} else {
diff --git a/github-action/tests/input-docs.test.ts b/github-action/tests/input-docs.test.ts
index 11c84ec02..48281e2f1 100644
--- a/github-action/tests/input-docs.test.ts
+++ b/github-action/tests/input-docs.test.ts
@@ -6,7 +6,7 @@ import { join } from 'node:path';
import { fileURLToPath } from 'node:url';
import { test } from 'node:test';
-test('input docs preserve backslashes and escape adjacent table delimiters', async (t) => {
+test('input docs preserve escaped table values and reject reversed reference markers', async (t) => {
const root = await mkdtemp(join(tmpdir(), 'action-input-docs-'));
t.after(() => rm(root, { recursive: true, force: true }));
const action = join(root, 'github-action');
@@ -36,4 +36,9 @@ test('input docs preserve backslashes and escape adjacent table delimiters', asy
assert.ok(generated.includes('`C:\\temp`'), generated);
assert.ok(generated.includes('`one\\|two`'), generated);
execFileSync(process.execPath, [script, '--check']);
+
+ const reversed = '<!-- action-reference:end -->\nContributor notes\n<!-- action-reference:start -->\n';
+ await writeFile(readme, reversed);
+ assert.throws(() => execFileSync(process.execPath, [script], { stdio: 'pipe' }), /README must contain action reference markers in order/);
+ assert.equal(await readFile(readme, 'utf8'), reversed);
});