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

refactor(ci): share container Compose smoke checks (#1231)

mldangelo-oaia41402bbde6b
diff --git a/.github/workflows/container-release.yml b/.github/workflows/container-release.yml
index d5b144935..1df101256 100644
--- a/.github/workflows/container-release.yml
+++ b/.github/workflows/container-release.yml
@@ -344,25 +344,7 @@ jobs:
env:
CODEX_SECURITY_IMAGE: ${{ steps.manifest.outputs.candidate }}
shell: bash
- run: |
- set -euo pipefail
- mkdir -p results state
- chmod 700 results state
- printf 'id,repository,revision\n' > repositories.csv
- CODEX_SECURITY_USER="$(id -u):$(id -g)"
- export CODEX_SECURITY_USER
- docker compose config --quiet
- docker compose run --rm codex-security --version
- if output="$(docker compose run --rm codex-security 2>&1)"; then
- echo 'An empty repository CSV must not start a security scan.' >&2
- exit 1
- else
- status=$?
- fi
- if [[ "$status" -ne 2 ]] || ! grep -Fq 'Multiscan CSV must contain at least one repository.' <<< "$output"; then
- printf 'Unexpected empty-repository scan behavior:\n%s\n' "$output" >&2
- exit 1
- fi
+ run: source docker/verify-container-compose.sh
attest:
name: attest-verified-multiarchitecture-candidate
diff --git a/.github/workflows/container-validate.yml b/.github/workflows/container-validate.yml
index f2a040fba..58af833cb 100644
--- a/.github/workflows/container-validate.yml
+++ b/.github/workflows/container-validate.yml
@@ -150,25 +150,7 @@ jobs:
env:
CODEX_SECURITY_IMAGE: codex-security:release-candidate
shell: bash
- run: |
- set -euo pipefail
- mkdir -p results state
- chmod 700 results state
- printf 'id,repository,revision\n' > repositories.csv
- CODEX_SECURITY_USER="$(id -u):$(id -g)"
- export CODEX_SECURITY_USER
- docker compose config --quiet
- docker compose run --rm codex-security --version
- if output="$(docker compose run --rm codex-security 2>&1)"; then
- echo 'An empty repository CSV must not start a security scan.' >&2
- exit 1
- else
- status=$?
- fi
- if [[ "$status" -ne 2 ]] || ! grep -Fq 'Multiscan CSV must contain at least one repository.' <<< "$output"; then
- printf 'Unexpected empty-repository scan behavior:\n%s\n' "$output" >&2
- exit 1
- fi
+ run: source docker/verify-container-compose.sh
- name: Verify hardened AppArmor Compose override
env:
diff --git a/.github/workflows/node-ci.yml b/.github/workflows/node-ci.yml
index 144ff389f..3ffe73f16 100644
--- a/.github/workflows/node-ci.yml
+++ b/.github/workflows/node-ci.yml
@@ -74,7 +74,8 @@ jobs:
plugin_changed=true
fi
case "$path" in
- .github/workflows/* | .github/actions/* | .github/actionlint.yaml | .github/zizmor.yml)
+ .github/workflows/* | .github/actions/* | .github/actionlint.yaml | .github/zizmor.yml | \
+ docker/verify-container-compose.sh)
workflow_quality=true
;;
esac
@@ -83,10 +84,8 @@ jobs:
.github/actions/download-native/* | Dockerfile | \
Dockerfile.dockerignore | compose.yaml | compose.apparmor.yaml | \
compose.findings.yaml | compose.runner.yaml | docker/* | \
- plugins/codex-security/* | sdk/typescript/*)
- container_validate=true
- ;;
- .github/workflows/container-ci.yml | .github/workflows/container-release.yml | \
+ plugins/codex-security/* | sdk/typescript/* | \
+ .github/workflows/container-ci.yml | .github/workflows/container-release.yml | \
.github/workflows/container-validate.yml)
container_validate=true
;;
diff --git a/.github/workflows/workflow-quality.yml b/.github/workflows/workflow-quality.yml
index 06929c94e..e909c301c 100644
--- a/.github/workflows/workflow-quality.yml
+++ b/.github/workflows/workflow-quality.yml
@@ -36,6 +36,8 @@ jobs:
env:
# Enforce correctness diagnostics without changing existing shell style.
SHELLCHECK_OPTS: --severity=warning
- run: actionlint -color
+ run: |
+ actionlint -color
+ shellcheck docker/verify-container-compose.sh
- name: Check workflow security
run: zizmor --offline --strict-collection --min-severity medium --format github --config .github/zizmor.yml .github
diff --git a/docker/verify-container-compose.sh b/docker/verify-container-compose.sh
new file mode 100644
index 000000000..b5abf5892
--- /dev/null
+++ b/docker/verify-container-compose.sh
@@ -0,0 +1,20 @@
+#!/usr/bin/env bash
+
+set -euo pipefail
+mkdir -p results state
+chmod 700 results state
+printf 'id,repository,revision\n' > repositories.csv
+CODEX_SECURITY_USER="$(id -u):$(id -g)"
+export CODEX_SECURITY_USER
+docker compose config --quiet
+docker compose run --rm codex-security --version
+if output="$(docker compose run --rm codex-security 2>&1)"; then
+ echo 'An empty repository CSV must not start a security scan.' >&2
+ exit 1
+else
+ status=$?
+fi
+if [[ "$status" -ne 2 ]] || ! grep -Fq 'Multiscan CSV must contain at least one repository.' <<< "$output"; then
+ printf 'Unexpected empty-repository scan behavior:\n%s\n' "$output" >&2
+ exit 1
+fi
diff --git a/sdk/typescript/tests-ts/workflow-quality.test.ts b/sdk/typescript/tests-ts/workflow-quality.test.ts
index 74ca68e09..92a0407ed 100644
--- a/sdk/typescript/tests-ts/workflow-quality.test.ts
+++ b/sdk/typescript/tests-ts/workflow-quality.test.ts
@@ -42,6 +42,7 @@ bashTest(
],
["pull_request", false, [".github/actionlint.yaml"], "true"],
["pull_request", false, [".github/zizmor.yml"], "true"],
+ ["pull_request", false, ["docker/verify-container-compose.sh"], "true"],
["pull_request", false, ["sdk/typescript/src/index.ts"], "false"],
["pull_request", false, ["README.md"], "false"],
] as const) {