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

ci: require workflow checks and production dependency audits (#1128)

mldangelo-oai42dedbb794c2
diff --git a/.github/actionlint.yaml b/.github/actionlint.yaml
new file mode 100644
index 000000000..87bd73c14
--- /dev/null
+++ b/.github/actionlint.yaml
@@ -0,0 +1,6 @@
+paths:
+ .github/workflows/{node-github-release,node-release-cut,node-release}.yml:
+ ignore:
+ # actionlint 1.7.12 predates GitHub's queue: max support. Keep release queuing.
+ # https://docs.github.com/en/actions/how-tos/write-workflows/choose-when-workflows-run/control-workflow-concurrency
+ - '^unexpected key "queue" for "concurrency" section\.'
diff --git a/.github/workflows/container-release.yml b/.github/workflows/container-release.yml
index 943c718b0..d5b144935 100644
--- a/.github/workflows/container-release.yml
+++ b/.github/workflows/container-release.yml
@@ -202,6 +202,7 @@ jobs:
uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2
with:
bun-version: "1.3.14"
+ no-cache: true
- name: Verify findings API and persistent storage through consumer Compose
env:
diff --git a/.github/workflows/native-unix.yml b/.github/workflows/native-unix.yml
index 9f5522703..6ea5ebe70 100644
--- a/.github/workflows/native-unix.yml
+++ b/.github/workflows/native-unix.yml
@@ -107,7 +107,7 @@ jobs:
node build.mjs
node check.mjs
native_node="$(command -v node)"
- PATH= "$native_node" proof.mjs
+ PATH='' "$native_node" proof.mjs
- name: Set up Node.js 20
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
@@ -127,7 +127,7 @@ jobs:
run: |
node check.mjs
native_node="$(command -v node)"
- PATH= "$native_node" proof.mjs
+ PATH='' "$native_node" proof.mjs
- name: Upload verified native artifact
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
diff --git a/.github/workflows/node-ci.yml b/.github/workflows/node-ci.yml
index 6058d93e6..4120d73ce 100644
--- a/.github/workflows/node-ci.yml
+++ b/.github/workflows/node-ci.yml
@@ -22,6 +22,7 @@ jobs:
ci-mode: ${{ steps.scope.outputs.ci-mode }}
container-validate: ${{ steps.scope.outputs.container-validate }}
test-quality: ${{ steps.scope.outputs.test-quality }}
+ workflow-quality: ${{ steps.scope.outputs.workflow-quality }}
steps:
- name: Checkout pull request for change classification
@@ -46,6 +47,10 @@ jobs:
container_validate=true
fi
test_quality=false
+ workflow_quality=false
+ if [[ "$EVENT_NAME" == "push" || "$BASE_CHANGED" == "true" ]]; then
+ workflow_quality=true
+ fi
if [[ "$EVENT_NAME" == "pull_request" && "$BASE_CHANGED" == "true" ]]; then
container_validate=true
test_quality=true
@@ -68,6 +73,11 @@ jobs:
"$path" == sdk/typescript/_bundled_plugin/* ]]; then
plugin_changed=true
fi
+ case "$path" in
+ .github/workflows/* | .github/actions/* | .github/actionlint.yaml | .github/zizmor.yml)
+ workflow_quality=true
+ ;;
+ esac
case "$path" in
.dockerignore | .github/workflows/native-*.yml | \
.github/actions/download-native/* | Dockerfile | \
@@ -100,6 +110,7 @@ jobs:
printf 'check-markdown=%s\n' "$check_markdown" >> "$GITHUB_OUTPUT"
printf 'container-validate=%s\n' "$container_validate" >> "$GITHUB_OUTPUT"
printf 'test-quality=%s\n' "$test_quality" >> "$GITHUB_OUTPUT"
+ printf 'workflow-quality=%s\n' "$workflow_quality" >> "$GITHUB_OUTPUT"
- name: Require a Conventional Commit pull request title
if: github.event_name == 'pull_request'
@@ -157,6 +168,11 @@ jobs:
pnpm --dir sdk/typescript exec prettier --check "${files[@]}"
fi
+ workflow-quality:
+ needs: validate-title
+ if: needs.validate-title.outputs.workflow-quality == 'true'
+ uses: ./.github/workflows/workflow-quality.yml
+
static-checks:
name: typecheck and formatting
needs: validate-title
@@ -241,7 +257,6 @@ jobs:
pnpm --dir sdk/typescript install --frozen-lockfile
pnpm --dir plugins/codex-security/mcp-app install --frozen-lockfile
- name: Audit production dependencies
- continue-on-error: true
run: pnpm --dir sdk/typescript run audit:prod
- name: Pack
working-directory: sdk/typescript
@@ -508,6 +523,7 @@ jobs:
needs:
[
validate-title,
+ workflow-quality,
static-checks,
package,
test,
@@ -524,6 +540,9 @@ jobs:
matrix:
os: [ubuntu-latest, macos-latest]
steps:
+ - name: Require selected workflow checks
+ if: needs.validate-title.outputs.workflow-quality == 'true' && needs.workflow-quality.result != 'success'
+ run: exit 1
- name: Require every Unix coverage job
if: needs.validate-title.result != 'success' || (needs.validate-title.outputs.ci-mode == 'full' && (needs.static-checks.result != 'success' || needs.package.result != 'success' || needs.test.result != 'success' || needs.compatibility.result != 'success' || needs.mcp.result != 'success' || needs.plugin-host.result != 'success' || needs.plugin-source.result != 'success')) || (needs.validate-title.outputs.ci-mode != 'full' && needs.validate-title.outputs.ci-mode != 'markdown')
run: exit 1
diff --git a/.github/workflows/node-release.yml b/.github/workflows/node-release.yml
index 6ec0e69ac..0005d9440 100644
--- a/.github/workflows/node-release.yml
+++ b/.github/workflows/node-release.yml
@@ -153,7 +153,6 @@ jobs:
sudo apt-get install --yes ripgrep
- name: Audit production dependencies
- continue-on-error: true
run: sfw pnpm --dir sdk/typescript run audit:prod
- name: Verify
diff --git a/.github/workflows/workflow-quality.yml b/.github/workflows/workflow-quality.yml
new file mode 100644
index 000000000..06929c94e
--- /dev/null
+++ b/.github/workflows/workflow-quality.yml
@@ -0,0 +1,41 @@
+name: workflow-quality
+
+on:
+ workflow_call:
+ workflow_dispatch:
+
+permissions:
+ contents: read
+
+jobs:
+ lint:
+ name: GitHub Actions checks
+ runs-on: ubuntu-latest
+ timeout-minutes: 10
+ steps:
+ - name: Checkout repository
+ uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
+ with:
+ persist-credentials: false
+ - name: Install ShellCheck and zizmor
+ uses: taiki-e/install-action@83ac0ad63c0167e6f06796fab0fce28db1bf3db0 # v2.87.22
+ with:
+ - name: Install actionlint
+ shell: bash
+ run: |
+ archive="$RUNNER_TEMP/actionlint.tar.gz"
+ curl --fail --silent --show-error --location \
+ https://github.com/rhysd/actionlint/releases/download/v1.7.12/actionlint_1.7.12_linux_amd64.tar.gz \
+ --output "$archive"
+ printf '%s %s\n' 8aca8db96f1b94770f1b0d72b6dddcb1ebb8123cb3712530b08cc387b349a3d8 "$archive" | sha256sum --check
+ mkdir -p "$RUNNER_TEMP/actionlint"
+ tar -xzf "$archive" -C "$RUNNER_TEMP/actionlint" actionlint
+ printf '%s\n' "$RUNNER_TEMP/actionlint" >> "$GITHUB_PATH"
+ - name: Check workflow syntax and shell scripts
+ env:
+ # Enforce correctness diagnostics without changing existing shell style.
+ SHELLCHECK_OPTS: --severity=warning
+ run: actionlint -color
+ - name: Check workflow security
+ run: zizmor --offline --strict-collection --min-severity medium --format github --config .github/zizmor.yml .github
diff --git a/.github/zizmor.yml b/.github/zizmor.yml
new file mode 100644
index 000000000..2787b577c
--- /dev/null
+++ b/.github/zizmor.yml
@@ -0,0 +1,7 @@
+rules:
+ dangerous-triggers:
+ ignore:
+ # Labels only: no checkout or execution of pull request code.
+ - node-release-labels.yml:3
+ # Requires successful push CI on main and verifies commit ancestry before tagging.
+ - node-release-cut.yml:3
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 34c6cbbe6..92b6b92f0 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -59,6 +59,28 @@ affected source. The public release workflow installs those locked graphs,
tests the package, and publishes a verified artifact with npm provenance.
GitHub Actions dependencies are maintained separately in this repository.
+Workflow and composite-action changes run `workflow-quality` through the existing
+required Unix CI checks. actionlint validates workflow syntax, and ShellCheck
+checks shell scripts in workflow `run` steps for warnings and errors. zizmor's
+offline checks at medium severity and above cover workflows and composite
+actions. The pinned tool versions are in `.github/workflows/workflow-quality.yml`;
+run these checks locally with:
+
+```bash
+SHELLCHECK_OPTS=--severity=warning actionlint
+zizmor --offline --strict-collection --min-severity medium --config .github/zizmor.yml .github
+```
+
+The actionlint configuration preserves GitHub's supported release queue syntax
+until the linter supports it. The zizmor configuration records the two existing
+privileged triggers and why they do not execute pull request code. Review these
+exceptions when changing the affected workflows.
+
+CI package builds and npm release validation require the production dependency
+audit to pass. Run it locally with `pnpm --dir sdk/typescript run audit:prod`.
+The existing policy checks production dependencies at the high-severity threshold.
+Resolve high or critical advisories, or audit service failures, before retrying.
+
[GitHub Releases](https://github.com/openai/codex-security/releases) is the
canonical changelog. Maintainers should follow [RELEASING.md](RELEASING.md) to
prepare, publish, verify, or repair a release.
diff --git a/RELEASING.md b/RELEASING.md
index b52513ea9..f860d8cde 100644
--- a/RELEASING.md
+++ b/RELEASING.md
@@ -62,6 +62,13 @@ dependencies, including transitive packages, with `openai` and `@openai/*` exemp
Committed lockfiles remain installable. The existing Socket release checks remain
in place.
+The production dependency audit is a blocking step in CI package builds and npm
+release validation. `pnpm --dir sdk/typescript run audit:prod` checks the locked
+production graph at the existing high-severity threshold. High or critical
+advisories and audit service failures stop publication. Resolve dependency
+advisories with dependency and lockfile updates; retry service failures once
+the audit service is available.
+
## Version policy before 1.0
While the package is on `0.x`, ordinary changes, including features, use a
diff --git a/sdk/typescript/tests-ts/release-automation.test.ts b/sdk/typescript/tests-ts/release-automation.test.ts
index 90927bf05..e60282180 100644
--- a/sdk/typescript/tests-ts/release-automation.test.ts
+++ b/sdk/typescript/tests-ts/release-automation.test.ts
@@ -4041,6 +4041,12 @@ describe("GitHub release workflow safeguards", () => {
const requiredJobCondition = "always()";
expect(workflow.jobs["required-test"]?.if).toBe(requiredJobCondition);
expect(workflow.jobs["windows"]?.if).toBe(requiredJobCondition);
+ const coverageGate = (job: string) =>
+ workflow.jobs[job]?.steps.find(
+ ({ name }) =>
+ name ===
+ `Require every ${job === "windows" ? "Windows" : "Unix"} coverage job`,
+ );
for (const [ciMode, validation, upstream, gateFailure] of [
["full", "success", "success", false],
["full", "success", "skipped", true],
@@ -4064,10 +4070,7 @@ describe("GitHub release workflow safeguards", () => {
};
for (const job of ["required-test", "windows"]) {
expect(
- evaluateWorkflowCondition(
- workflow.jobs[job]?.steps[0]?.if ?? "",
- values,
- ),
+ evaluateWorkflowCondition(coverageGate(job)?.if ?? "", values),
`${job}: ${ciMode}/${validation}/${upstream}`,
).toBe(gateFailure);
}
@@ -4093,7 +4096,7 @@ describe("GitHub release workflow safeguards", () => {
for (const dependency of dependencies) {
for (const result of ["failure", "cancelled", "skipped"]) {
expect(
- evaluateWorkflowCondition(workflow.jobs[gate]?.steps[0]?.if ?? "", {
+ evaluateWorkflowCondition(coverageGate(gate)?.if ?? "", {
"needs.validate-title.result": "success",
"needs.validate-title.outputs.ci-mode": "full",
...Object.fromEntries(
@@ -4107,7 +4110,7 @@ describe("GitHub release workflow safeguards", () => {
).toBe(true);
}
}
- expect(workflow.jobs[gate]?.steps[0]?.run).toBe("exit 1");
+ expect(coverageGate(gate)?.run).toBe("exit 1");
}
const renderName = (template: string, values: Record<string, string>) => {
diff --git a/sdk/typescript/tests-ts/skeleton.test.ts b/sdk/typescript/tests-ts/skeleton.test.ts
index aa514d74e..2c8a7e634 100644
--- a/sdk/typescript/tests-ts/skeleton.test.ts
+++ b/sdk/typescript/tests-ts/skeleton.test.ts
@@ -191,6 +191,7 @@ describe("TypeScript package skeleton", () => {
expect(jobs["required-test"]?.name).toBe("${{ matrix.os }} / node-22");
expect(jobs["required-test"]?.needs).toEqual([
"validate-title",
+ "workflow-quality",
"static-checks",
"package",
"test",
@@ -467,7 +468,7 @@ describe("TypeScript package skeleton", () => {
);
});
- test("keeps production dependency audits non-blocking in CI and releases", async () => {
+ test("blocks CI and releases when the production dependency audit fails", async () => {
for (const workflowName of ["node-ci.yml", "node-release.yml"]) {
const { jobs } = await workflow(workflowName);
const audits = Object.values(jobs)
@@ -475,7 +476,7 @@ describe("TypeScript package skeleton", () => {
.filter((step) => step.name === "Audit production dependencies");
expect(audits.length).toBeGreaterThan(0);
for (const audit of audits) {
- expect(audit["continue-on-error"]).toBe(true);
+ expect(audit).not.toHaveProperty("continue-on-error");
expect(audit.run).toMatch(
/^(?:sfw )?pnpm --dir sdk\/typescript run audit:prod$/u,
);
diff --git a/sdk/typescript/tests-ts/workflow-quality.test.ts b/sdk/typescript/tests-ts/workflow-quality.test.ts
new file mode 100644
index 000000000..74ca68e09
--- /dev/null
+++ b/sdk/typescript/tests-ts/workflow-quality.test.ts
@@ -0,0 +1,116 @@
+import { spawnSync } from "node:child_process";
+import { mkdtemp, readFile, rm } from "node:fs/promises";
+import { tmpdir } from "node:os";
+import { join } from "node:path";
+import { expect, test } from "bun:test";
+
+const ci = Bun.YAML.parse(
+ await readFile(
+ new URL("../../../.github/workflows/node-ci.yml", import.meta.url),
+ "utf8",
+ ),
+) as {
+ jobs: Record<
+ string,
+ {
+ if?: string;
+ steps: { name: string; if?: string; run: string }[];
+ }
+ >;
+};
+
+// These scripts run in Ubuntu Bash in CI, independent of the CLI platform.
+const bashTest = test.skipIf(process.platform === "win32");
+
+bashTest(
+ "selects workflow checks for workflow changes and main pushes",
+ async () => {
+ const scope = ci.jobs["validate-title"]!.steps.find(
+ (step) => step.name === "Decide CI mode",
+ )!;
+ const directory = await mkdtemp(join(tmpdir(), "workflow-quality-"));
+ try {
+ for (const [event, baseChanged, paths, expected] of [
+ ["push", false, [], "true"],
+ ["pull_request", true, [], "true"],
+ ["pull_request", false, [".github/workflows/node-release.yml"], "true"],
+ [
+ "pull_request",
+ false,
+ [".github/actions/download-native/action.yml"],
+ "true",
+ ],
+ ["pull_request", false, [".github/actionlint.yaml"], "true"],
+ ["pull_request", false, [".github/zizmor.yml"], "true"],
+ ["pull_request", false, ["sdk/typescript/src/index.ts"], "false"],
+ ["pull_request", false, ["README.md"], "false"],
+ ] as const) {
+ const output = join(directory, "output");
+ await rm(output, { force: true });
+ const result = spawnSync(
+ "bash",
+ [
+ "-c",
+ 'changed_paths=("$@"); git() { if ((${#changed_paths[@]})); then printf "%s\\0" "${changed_paths[@]}"; fi; }\n' +
+ scope.run,
+ "scope",
+ ...paths,
+ ],
+ {
+ encoding: "utf8",
+ env: {
+ ...process.env,
+ EVENT_NAME: event,
+ BASE_CHANGED: String(baseChanged),
+ GITHUB_OUTPUT: output,
+ },
+ },
+ );
+ expect(result.status, result.stderr).toBe(0);
+ const outputs = Object.fromEntries(
+ (await readFile(output, "utf8"))
+ .trim()
+ .split("\n")
+ .map((line) => line.split("=")),
+ );
+ expect(outputs["workflow-quality"], paths.join(",")).toBe(expected);
+ }
+ } finally {
+ await rm(directory, { recursive: true, force: true });
+ }
+ },
+);
+
+bashTest(
+ "required Unix checks fail when selected workflow checks do not pass",
+ () => {
+ const aggregate = ci.jobs["required-test"]!;
+ expect(aggregate.if).toBe("always()");
+ const gate = aggregate.steps.find(
+ (step) => step.name === "Require selected workflow checks",
+ )!;
+ const condition = gate
+ .if!.replaceAll(
+ "needs.validate-title.outputs.workflow-quality",
+ '"$SELECTED"',
+ )
+ .replaceAll("needs.workflow-quality.result", '"$RESULT"');
+ for (const [selected, result, expected] of [
+ ["true", "success", 0],
+ ["true", "failure", 1],
+ ["true", "cancelled", 1],
+ ["true", "skipped", 1],
+ ["false", "skipped", 0],
+ ] as const) {
+ const execution = spawnSync(
+ "bash",
+ ["-c", `if [[ ${condition} ]]; then\n${gate.run}\nfi`],
+ {
+ encoding: "utf8",
+ env: { ...process.env, SELECTED: selected, RESULT: result },
+ },
+ );
+ expect(execution.status, execution.stderr).toBe(expected);
+ }
+ },
+);