OpenAI's Codex Security CLI and TypeScript SDK for finding, validating, and fixing security vulnerabilities. npm: https://www.npmjs.com/package/@openai/codex-security
TypeScript ai-securityapplication-securityclicode-scanningcodexcodex-securitycybersecuritydevsecopsnodejsnpmopenaisdksecuritytypescriptvulnerability-scanning
ci: skip the native bundle runner on verified cache hits (#2042)
Michael D'Angelodab067b6ac48
diff --git a/.github/workflows/native-artifacts.yml b/.github/workflows/native-artifacts.ymlindex e7b64fa93..2f2b61202 100644--- a/.github/workflows/native-artifacts.yml+++ b/.github/workflows/native-artifacts.yml@@ -75,32 +75,26 @@ jobs:ref: ${{ inputs.ref || github.sha }}bundle:needs: [prepare, unix, windows, musl]- if: ${{ !cancelled() }}+ if: ${{ !cancelled() && (needs.prepare.result != 'success' || needs.prepare.outputs.cache-hit != 'true') }}runs-on: ubuntu-24.04steps:- - name: Require a verified native payload+ - name: Require every native build to passshell: bashenv:PREPARE_RESULT: ${{ needs.prepare.result }}- CACHE_HIT: ${{ needs.prepare.outputs.cache-hit }}UNIX_RESULT: ${{ needs.unix.result }}WINDOWS_RESULT: ${{ needs.windows.result }}MUSL_RESULT: ${{ needs.musl.result }}run: |- set -euo pipefail- [[ "$PREPARE_RESULT" == success ]] || exit 1- if [[ "$CACHE_HIT" != true ]]; then- [[ "$UNIX_RESULT" == success && "$WINDOWS_RESULT" == success && "$MUSL_RESULT" == success ]] || exit 1- fi+ [[ "$PREPARE_RESULT" == success && "$UNIX_RESULT" == success &&+ "$WINDOWS_RESULT" == success && "$MUSL_RESULT" == success ]]- name: Download verified platform payloads- if: needs.prepare.outputs.cache-hit != 'true'uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2with:pattern: native-platform-*-${{ inputs.ref || github.sha }}merge-multiple: truepath: native- name: Upload universal native payload- if: needs.prepare.outputs.cache-hit != 'true'uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2with:name: native-universal-${{ inputs.ref || github.sha }}@@ -110,7 +104,6 @@ jobs:retention-days: 7- name: Save verified native payload from mainif: >-- needs.prepare.outputs.cache-hit != 'true' &&github.ref == 'refs/heads/main' &&(github.event_name == 'push' || github.event_name == 'schedule') &&(inputs.ref == '' || inputs.ref == github.sha)diff --git a/sdk/typescript/tests-ts/native-artifact-cache.test.ts b/sdk/typescript/tests-ts/native-artifact-cache.test.tsindex 6ec501193..4ab269896 100644--- a/sdk/typescript/tests-ts/native-artifact-cache.test.ts+++ b/sdk/typescript/tests-ts/native-artifact-cache.test.ts@@ -179,72 +179,40 @@ test("only exact hits replace fresh native builds and cache failures fall back ttest("only a successful fresh matrix can save a main-branch cache", () => {const bundle = native.jobs["bundle"]!;expect(bundle.needs).toEqual(["prepare", "unix", "windows", "musl"]);- expect(bundle.if).toBe("${{ !cancelled() }}");+ expect(bundle.if).toBe(+ "${{ !cancelled() && (needs.prepare.result != 'success' || needs.prepare.outputs.cache-hit != 'true') }}",+ );const save = bundle.steps!.find((step) =>step.uses?.startsWith("actions/cache/save@"),)!;expect(save.if).toBe(- "needs.prepare.outputs.cache-hit != 'true' && github.ref == 'refs/heads/main' && (github.event_name == 'push' || github.event_name == 'schedule') && (inputs.ref == '' || inputs.ref == github.sha)",+ "github.ref == 'refs/heads/main' && (github.event_name == 'push' || github.event_name == 'schedule') && (inputs.ref == '' || inputs.ref == github.sha)",);expect(save["continue-on-error"]).toBe(true);});test.each([- {- cache: "true",- prepare: "success",- unix: "skipped",- windows: "skipped",- musl: "skipped",- passes: true,- },- {- cache: "false",- prepare: "success",- unix: "success",- windows: "success",- musl: "success",- passes: true,- },- {- cache: "true",- prepare: "failure",- unix: "skipped",- windows: "skipped",- musl: "skipped",- passes: false,- },- {- cache: "false",- prepare: "success",- unix: "success",- windows: "failure",- musl: "success",- passes: false,- },- {- cache: "",- prepare: "success",- unix: "success",- windows: "success",- musl: "skipped",- passes: false,+ ["success", "success", "success", "success", true],+ ["failure", "skipped", "skipped", "skipped", false],+ ["success", "success", "failure", "success", false],+ ["success", "success", "success", "skipped", false],+] as const)(+ "fresh native payload requires successful preparation and proofs (%s, %s, %s, %s)",+ (prepare, unix, windows, musl, passes) => {+ const guard = native.jobs["bundle"]!.steps![0]!.run!;+ const checked = spawnSync(bashCommand(), ["-c", guard], {+ encoding: "utf8",+ env: {+ ...process.env,+ PREPARE_RESULT: prepare,+ UNIX_RESULT: unix,+ WINDOWS_RESULT: windows,+ MUSL_RESULT: musl,+ },+ });+ expect(checked.status === 0, checked.stderr).toBe(passes);},-])("native completion checks the cache or every fresh proof: %j", (result) => {- const guard = native.jobs["bundle"]!.steps![0]!.run!;- const checked = spawnSync(bashCommand(), ["-c", guard], {- encoding: "utf8",- env: {- ...process.env,- CACHE_HIT: result.cache,- PREPARE_RESULT: result.prepare,- UNIX_RESULT: result.unix,- WINDOWS_RESULT: result.windows,- MUSL_RESULT: result.musl,- },- });- expect(checked.status === 0, checked.stderr).toBe(result.passes);-});+);test("source CI opts in to native artifact reuse", () => {expect(native.on.workflow_call?.inputs["reuse-verified"]?.default).toBe(