|
| 1 | +name: native-stdout-diagnostic |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [mdangelo/codex/native-stdout-probe-20261023] |
| 6 | + |
| 7 | +permissions: |
| 8 | + contents: read |
| 9 | + actions: read |
| 10 | + |
| 11 | +env: |
| 12 | + CODEX_SECURITY_INTEGRATION: "0" |
| 13 | + CODEX_SECURITY_ALLOW_MACHINE_POLICY_TEST: "false" |
| 14 | + |
| 15 | +jobs: |
| 16 | + observe: |
| 17 | + runs-on: ubuntu-24.04 |
| 18 | + timeout-minutes: 20 |
| 19 | + steps: |
| 20 | + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 |
| 21 | + with: |
| 22 | + ref: 873c7199b9d20d7d32466fde52f2c2b5899ea96e |
| 23 | + persist-credentials: false |
| 24 | + - uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0 |
| 25 | + with: |
| 26 | + node-version: "22.13.0" |
| 27 | + - uses: ./.github/actions/setup-tools |
| 28 | + with: |
| 29 | + setup-node: false |
| 30 | + cache-dependency-path: | |
| 31 | + sdk/typescript/pnpm-lock.yaml |
| 32 | + plugins/codex-security/mcp-app/pnpm-lock.yaml |
| 33 | + - name: Restore the immutable native payload |
| 34 | + env: |
| 35 | + GH_TOKEN: ${{ github.token }} |
| 36 | + shell: bash |
| 37 | + run: | |
| 38 | + set -euo pipefail |
| 39 | + gh api repos/openai/codex-security/actions/artifacts/12469347486/zip > "$RUNNER_TEMP/native.zip" |
| 40 | + printf '%s %s\n' 81845d5129e1397cf600722b08e4f9ded46064ce27de2d07643123619ba40a0c "$RUNNER_TEMP/native.zip" | sha256sum --check |
| 41 | + mkdir -p plugins/codex-security/native/prebuilt |
| 42 | + unzip -qo "$RUNNER_TEMP/native.zip" -d plugins/codex-security/native/prebuilt |
| 43 | + - name: Set up the pinned Bun runtime |
| 44 | + shell: bash |
| 45 | + run: | |
| 46 | + npm install --prefix "$RUNNER_TEMP/bun" --ignore-scripts --no-audit --no-fund @oven/bun-linux-x64@1.4.2-canary.20261008.1 |
| 47 | + echo "$RUNNER_TEMP/bun/node_modules/@oven/bun-linux-x64/bin" >> "$GITHUB_PATH" |
| 48 | + - name: Install dependencies |
| 49 | + run: | |
| 50 | + pnpm --dir sdk/typescript install --frozen-lockfile |
| 51 | + pnpm --dir plugins/codex-security/mcp-app install --frozen-lockfile |
| 52 | + - name: Set up the Ubuntu sandbox and trace tool |
| 53 | + run: | |
| 54 | + sudo apt-get update |
| 55 | + sudo apt-get install --yes bubblewrap apparmor-profiles strace |
| 56 | + sudo apparmor_parser -r /usr/share/apparmor/extra-profiles/bwrap-userns-restrict |
| 57 | + - name: Build the plugin |
| 58 | + run: pnpm --dir sdk/typescript run build:plugin |
| 59 | + - name: Compare ordinary and observed execution |
| 60 | + working-directory: sdk/typescript |
| 61 | + env: |
| 62 | + CODEX_SECURITY_TEST_TIMEOUT_MS: "30000" |
| 63 | + TEMP: ${{ runner.temp }} |
| 64 | + TMP: ${{ runner.temp }} |
| 65 | + TMPDIR: ${{ runner.temp }} |
| 66 | + shell: bash |
| 67 | + run: | |
| 68 | + set -euo pipefail |
| 69 | + umask 022 |
| 70 | + mkdir -p reports/native-stdout |
| 71 | + test "$(git rev-parse HEAD)" = 873c7199b9d20d7d32466fde52f2c2b5899ea96e |
| 72 | + test "$(node --version)" = v22.13.0 |
| 73 | + test "$(bun --revision)" = 1.4.3-canary.1+620b50f6a |
| 74 | + { |
| 75 | + git rev-parse HEAD |
| 76 | + node --version |
| 77 | + bun --revision |
| 78 | + git --version |
| 79 | + strace --version |
| 80 | + uname -srmo |
| 81 | + bun -e 'import { resolveCodexCommand } from "./src/runtime.ts"; import { readFileSync, realpathSync } from "node:fs"; import { createHash } from "node:crypto"; import { execFileSync } from "node:child_process"; const path = realpathSync(resolveCodexCommand().command); console.log(JSON.stringify({ codexExecutable: path, sha256: createHash("sha256").update(readFileSync(path)).digest("hex"), version: execFileSync(path, ["--version"], { encoding: "utf8" }).trim() }));' |
| 82 | + sha256sum tests-ts/cli-patch-inactive-hook-references.test.ts tests-ts/multiscan.test.ts src/cli.ts |
| 83 | + } > reports/native-stdout/provenance.txt |
| 84 | + ordinary_status=0 |
| 85 | + bun test --timeout 30000 --parallel=2 --seed=1 tests-ts/cli-patch-inactive-hook-references.test.ts tests-ts/multiscan.test.ts > reports/native-stdout/ordinary.log 2>&1 || ordinary_status=$? |
| 86 | + observed_status=0 |
| 87 | + strace -f -qq -yy -s 0 -e trace=read,readv,write,writev,recvfrom,recvmsg,sendto,sendmsg,close,dup,dup2,dup3 -o reports/native-stdout/syscalls.log bun test --timeout 30000 --parallel=2 --seed=1 tests-ts/cli-patch-inactive-hook-references.test.ts tests-ts/multiscan.test.ts > reports/native-stdout/observed.log 2>&1 || observed_status=$? |
| 88 | + printf 'ordinary=%s\nobserved=%s\n' "$ordinary_status" "$observed_status" > reports/native-stdout/status.txt |
| 89 | + cat reports/native-stdout/status.txt |
| 90 | + test "$ordinary_status" -eq 0 && test "$observed_status" -eq 0 |
| 91 | + - name: Preserve diagnostic evidence |
| 92 | + if: always() |
| 93 | + uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 |
| 94 | + with: |
| 95 | + name: native-stdout-observation |
| 96 | + path: sdk/typescript/reports/native-stdout/ |
| 97 | + if-no-files-found: error |
| 98 | + retention-days: 7 |
0 commit comments