Skip to content

Commit 28e7218

Browse files
authored
feat: linux codesign with sigstore (#7674)
### Summary Linux codesigning with sigstore and test run output at https://github.com/openai/codex/actions/runs/19994328162?pr=7662. Sigstore is one of the few ways for codesigning for linux platform. Linux is open sourced and therefore binary/dist validation comes with the build itself instead of a central authority like Windows or Mac. Alternative here is to use GPG which again a public key included with the bundle for validation. Advantage with Sigstore is that we do not have to create a private key for signing but rather with[ keyless signing](https://docs.sigstore.dev/cosign/signing/overview/). This should be sufficient for us at this point and if we want to we can support GPG in the future.
1 parent 585f75b commit 28e7218

File tree

2 files changed

+64
-0
lines changed

2 files changed

+64
-0
lines changed
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: linux-code-sign
2+
description: Sign Linux artifacts with cosign.
3+
inputs:
4+
target:
5+
description: Target triple for the artifacts to sign.
6+
required: true
7+
artifacts-dir:
8+
description: Absolute path to the directory containing built binaries to sign.
9+
required: true
10+
11+
runs:
12+
using: composite
13+
steps:
14+
- name: Install cosign
15+
uses: sigstore/cosign-installer@v3.7.0
16+
17+
- name: Cosign Linux artifacts
18+
shell: bash
19+
env:
20+
COSIGN_EXPERIMENTAL: "1"
21+
COSIGN_YES: "true"
22+
COSIGN_OIDC_CLIENT_ID: "sigstore"
23+
COSIGN_OIDC_ISSUER: "https://oauth2.sigstore.dev/auth"
24+
run: |
25+
set -euo pipefail
26+
27+
dest="${{ inputs.artifacts-dir }}"
28+
if [[ ! -d "$dest" ]]; then
29+
echo "Destination $dest does not exist"
30+
exit 1
31+
fi
32+
33+
for binary in codex codex-responses-api-proxy; do
34+
artifact="${dest}/${binary}"
35+
if [[ ! -f "$artifact" ]]; then
36+
echo "Binary $artifact not found"
37+
exit 1
38+
fi
39+
40+
cosign sign-blob \
41+
--yes \
42+
--bundle "${artifact}.sigstore" \
43+
"$artifact"
44+
done

.github/workflows/rust-release.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,9 @@ jobs:
5050
name: Build - ${{ matrix.runner }} - ${{ matrix.target }}
5151
runs-on: ${{ matrix.runner }}
5252
timeout-minutes: 30
53+
permissions:
54+
contents: read
55+
id-token: write
5356
defaults:
5457
run:
5558
working-directory: codex-rs
@@ -100,6 +103,13 @@ jobs:
100103
- name: Cargo build
101104
run: cargo build --target ${{ matrix.target }} --release --bin codex --bin codex-responses-api-proxy
102105

106+
- if: ${{ contains(matrix.target, 'linux') }}
107+
name: Cosign Linux artifacts
108+
uses: ./.github/actions/linux-code-sign
109+
with:
110+
target: ${{ matrix.target }}
111+
artifacts-dir: ${{ github.workspace }}/codex-rs/target/${{ matrix.target }}/release
112+
103113
- if: ${{ matrix.runner == 'macos-15-xlarge' }}
104114
name: Configure Apple code signing
105115
shell: bash
@@ -283,6 +293,11 @@ jobs:
283293
cp target/${{ matrix.target }}/release/codex-responses-api-proxy "$dest/codex-responses-api-proxy-${{ matrix.target }}"
284294
fi
285295
296+
if [[ "${{ matrix.target }}" == *linux* ]]; then
297+
cp target/${{ matrix.target }}/release/codex.sigstore "$dest/codex-${{ matrix.target }}.sigstore"
298+
cp target/${{ matrix.target }}/release/codex-responses-api-proxy.sigstore "$dest/codex-responses-api-proxy-${{ matrix.target }}.sigstore"
299+
fi
300+
286301
- if: ${{ matrix.runner == 'windows-11-arm' }}
287302
name: Install zstd
288303
shell: powershell
@@ -321,6 +336,11 @@ jobs:
321336
continue
322337
fi
323338
339+
# Don't try to compress signature bundles.
340+
if [[ "$base" == *.sigstore ]]; then
341+
continue
342+
fi
343+
324344
# Create per-binary tar.gz
325345
tar -C "$dest" -czf "$dest/${base}.tar.gz" "$base"
326346

0 commit comments

Comments
 (0)