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(action): share Ubuntu sandbox setup across verification jobs (#1926)

Michael D'Angeloc6760698c68e
diff --git a/.github/actions/check-action-candidate/action.yml b/.github/actions/check-action-candidate/action.yml
index 95b59bda3..30057dc5e 100644
--- a/.github/actions/check-action-candidate/action.yml
+++ b/.github/actions/check-action-candidate/action.yml
@@ -10,10 +10,7 @@ runs:
package-manager-cache: false
- name: Set up the Ubuntu sandbox
shell: bash
- 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: bash github-action/scripts/setup-ubuntu-sandbox.sh
- name: Test Action compatibility with the packed CLI
shell: bash
run: |
diff --git a/.github/workflows/action-ci.yml b/.github/workflows/action-ci.yml
index 29f0baf6b..cec854c24 100644
--- a/.github/workflows/action-ci.yml
+++ b/.github/workflows/action-ci.yml
@@ -61,13 +61,7 @@ jobs:
package-manager-cache: false
- &set-up-the-ubuntu-sandbox
name: Set up the Ubuntu sandbox
- run: |
- # The hosted image's unrelated PHP service times out during needrestart.
- printf '%s\n' '$nrconf{override_rc}{qr(^php8\.3-fpm\.service$)} = 0;' \
- | sudo tee /etc/needrestart/conf.d/action-ci.conf > /dev/null
- 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: bash scripts/setup-ubuntu-sandbox.sh
- run: npm ci --ignore-scripts --no-audit --no-fund
- run: npm run validate
- name: Set up Bun for Action release contracts
@@ -108,10 +102,16 @@ jobs:
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
- ref: ${{ github.event.pull_request.head.sha || github.sha }}
+ # Run setup from the merge commit, then test the Action at its PR head.
+ fetch-depth: 2
persist-credentials: false
- *actions-setup-node
- *set-up-the-ubuntu-sandbox
+ - name: Check out the PR head for the Action smoke tests
+ if: github.event_name == 'pull_request'
+ env:
+ PR_HEAD_SHA: ${{ github.event.pull_request.head.sha }}
+ run: git switch --detach "$PR_HEAD_SHA"
- name: Validate the default OpenAI configuration without model calls
id: openai
uses: ./
diff --git a/.github/workflows/node-github-release.yml b/.github/workflows/node-github-release.yml
index 156d3a59f..4a0e66eb7 100644
--- a/.github/workflows/node-github-release.yml
+++ b/.github/workflows/node-github-release.yml
@@ -532,10 +532,7 @@ jobs:
firewall-version: "1.15.0"
- 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: bash automation/github-action/scripts/setup-ubuntu-sandbox.sh
- &action-reuse-distribution
name: Reuse an existing immutable Action distribution
diff --git a/.github/workflows/workflow-quality.yml b/.github/workflows/workflow-quality.yml
index fc8985cf8..624e37b7f 100644
--- a/.github/workflows/workflow-quality.yml
+++ b/.github/workflows/workflow-quality.yml
@@ -38,7 +38,7 @@ jobs:
SHELLCHECK_OPTS: --severity=warning
run: |
actionlint -color
- shellcheck docker/verify-container-compose.sh
+ shellcheck docker/verify-container-compose.sh github-action/scripts/setup-ubuntu-sandbox.sh
- name: Test release progress reporting
run: node --test .github/scripts/test_release_progress.mjs
- name: Check workflow security
diff --git a/github-action/scripts/setup-ubuntu-sandbox.sh b/github-action/scripts/setup-ubuntu-sandbox.sh
new file mode 100644
index 000000000..17db9d0ce
--- /dev/null
+++ b/github-action/scripts/setup-ubuntu-sandbox.sh
@@ -0,0 +1,10 @@
+#!/usr/bin/env bash
+set -euo pipefail
+
+# The hosted image's unrelated PHP service times out during needrestart.
+sudo tee /etc/needrestart/conf.d/action-ci.conf > /dev/null <<'EOF'
+$nrconf{override_rc}{qr(^php8\.3-fpm\.service$)} = 0;
+EOF
+sudo apt-get update
+sudo apt-get install --yes bubblewrap apparmor-profiles
+sudo apparmor_parser -r /usr/share/apparmor/extra-profiles/bwrap-userns-restrict