Skip to content

Commit 18b9b02

Browse files
authored
security: harden release workflows against secret leakage (anomalyco#1480)
* security: harden release workflows against secret leakage Verify trusted refs before secret-bearing jobs, narrow secret scope, pin key actions, and remove the opencode agents workflow to reduce workflow attack surface. * security: drop third-party action pinning Keep the trusted ref gates and narrower secret exposure, but revert external GitHub Actions back to their tagged versions to avoid broad supply-chain hardening changes in this PR. * security: scope trusted release refs to dev Update the workflow trust gates to validate tags and manual refs only against origin/dev, matching this repository's actual protected branch layout. --------- Co-authored-by: src-opn <[email protected]>
1 parent 591dd2f commit 18b9b02

7 files changed

Lines changed: 174 additions & 107 deletions

File tree

‎.github/workflows/aur-validate.yml‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -414,6 +414,13 @@ jobs:
414414
run: |
415415
set -euo pipefail
416416
417+
git fetch origin dev --no-tags
418+
publish_sha="$(git rev-parse HEAD)"
419+
if ! git merge-base --is-ancestor "$publish_sha" origin/dev; then
420+
echo "Ref ${publish_sha} is not reachable from origin/dev; refusing AUR publish." >&2
421+
exit 1
422+
fi
423+
417424
if [ -z "${AUR_SSH_PRIVATE_KEY:-}" ]; then
418425
echo "AUR_SSH_PRIVATE_KEY not set; cannot push to AUR." >&2
419426
exit 1

‎.github/workflows/deploy-den.yml‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@ on:
77
description: "Daytona snapshot name to promote into Render"
88
required: true
99
type: string
10+
secrets:
11+
RENDER_API_KEY:
12+
required: true
13+
RENDER_DEN_CONTROL_PLANE_SERVICE_ID:
14+
required: true
1015
workflow_dispatch:
1116
inputs:
1217
daytona_snapshot:

‎.github/workflows/opencode-agents.yml‎

Lines changed: 0 additions & 96 deletions
This file was deleted.

‎.github/workflows/prerelease.yml‎

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ on:
44
push:
55
branches:
66
- dev
7-
- feat/windows-sidecar
87

98
permissions:
109
contents: write
@@ -300,8 +299,8 @@ jobs:
300299
args: ${{ matrix.args }}
301300
retryAttempts: 3
302301

303-
- name: Build + upload
304-
if: matrix.os_type != 'macos' || env.MACOS_NOTARIZE != 'true'
302+
- name: Build + upload (macOS signed, no notarization)
303+
if: matrix.os_type == 'macos' && env.MACOS_NOTARIZE != 'true'
305304
uses: tauri-apps/[email protected]
306305
env:
307306
CI: true
@@ -325,3 +324,24 @@ jobs:
325324
tauriScript: pnpm exec tauri -vvv
326325
args: ${{ matrix.args }}
327326
retryAttempts: 3
327+
328+
- name: Build + upload (non-macOS)
329+
if: matrix.os_type != 'macos'
330+
uses: tauri-apps/[email protected]
331+
env:
332+
CI: true
333+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
334+
335+
# Tauri updater signing
336+
TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }}
337+
TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY_PASSWORD }}
338+
with:
339+
tagName: ${{ env.RELEASE_TAG }}
340+
releaseName: ${{ env.RELEASE_NAME }}
341+
releaseBody: ${{ env.RELEASE_BODY }}
342+
prerelease: true
343+
releaseDraft: false
344+
projectPath: apps/desktop
345+
tauriScript: pnpm exec tauri -vvv
346+
args: ${{ matrix.args }}
347+
retryAttempts: 3

‎.github/workflows/release-daytona-snapshot.yml‎

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,13 @@ on:
2020
description: "Optional Daytona region override for snapshot push"
2121
required: false
2222
type: string
23+
secrets:
24+
DAYTONA_API_KEY:
25+
required: true
26+
RENDER_API_KEY:
27+
required: false
28+
RENDER_DEN_CONTROL_PLANE_SERVICE_ID:
29+
required: false
2330
workflow_dispatch:
2431
inputs:
2532
tag:
@@ -98,6 +105,22 @@ jobs:
98105
fetch-depth: 0
99106
ref: ${{ steps.resolve.outputs.release_tag }}
100107

108+
- name: Ensure tag commit is on a trusted branch
109+
shell: bash
110+
run: |
111+
set -euo pipefail
112+
113+
tag_commit="$(git rev-parse HEAD)"
114+
git fetch origin dev --no-tags
115+
116+
if git merge-base --is-ancestor "$tag_commit" origin/dev; then
117+
echo "Trusted release tag commit verified: $tag_commit"
118+
exit 0
119+
fi
120+
121+
echo "Release tag ${{ steps.resolve.outputs.release_tag }} points to commit $tag_commit, which is not reachable from origin/dev." >&2
122+
exit 1
123+
101124
- name: Set up Docker Buildx
102125
uses: docker/setup-buildx-action@v3
103126

@@ -169,4 +192,6 @@ jobs:
169192
uses: ./.github/workflows/deploy-den.yml
170193
with:
171194
daytona_snapshot: ${{ needs.publish-daytona-snapshot.outputs.snapshot_name }}
172-
secrets: inherit
195+
secrets:
196+
RENDER_API_KEY: ${{ secrets.RENDER_API_KEY }}
197+
RENDER_DEN_CONTROL_PLANE_SERVICE_ID: ${{ secrets.RENDER_DEN_CONTROL_PLANE_SERVICE_ID }}

‎.github/workflows/release-macos-aarch64.yml‎

Lines changed: 60 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -214,9 +214,38 @@ jobs:
214214
--notes-file "$BODY_FILE" \
215215
$DRAFT_FLAG $PRERELEASE_FLAG
216216
217+
verify-trusted-release-tag:
218+
name: Verify Trusted Release Tag
219+
needs: resolve-release
220+
runs-on: blacksmith-4vcpu-ubuntu-2404
221+
env:
222+
RELEASE_TAG: ${{ needs.resolve-release.outputs.release_tag }}
223+
steps:
224+
- name: Checkout tagged release source
225+
uses: actions/checkout@v6
226+
with:
227+
ref: ${{ env.RELEASE_TAG }}
228+
fetch-depth: 0
229+
230+
- name: Ensure tag commit is on a trusted branch
231+
shell: bash
232+
run: |
233+
set -euo pipefail
234+
235+
tag_commit="$(git rev-list -n 1 "$RELEASE_TAG")"
236+
git fetch origin dev --no-tags
237+
238+
if git merge-base --is-ancestor "$tag_commit" origin/dev; then
239+
echo "Trusted release tag commit verified: $tag_commit"
240+
exit 0
241+
fi
242+
243+
echo "Release tag $RELEASE_TAG points to commit $tag_commit, which is not reachable from origin/dev." >&2
244+
exit 1
245+
217246
verify-release:
218247
name: Verify Release Versions
219-
needs: resolve-release
248+
needs: [resolve-release, verify-trusted-release-tag]
220249
runs-on: blacksmith-4vcpu-ubuntu-2404
221250
env:
222251
RELEASE_TAG: ${{ needs.resolve-release.outputs.release_tag }}
@@ -500,8 +529,8 @@ jobs:
500529
updaterJsonPreferNsis: true
501530
releaseAssetNamePattern: openwork-desktop-[platform]-[arch][ext]
502531

503-
- name: Build + upload
504-
if: matrix.os_type != 'macos' || env.MACOS_NOTARIZE != 'true'
532+
- name: Build + upload (macOS signed, no notarization)
533+
if: matrix.os_type == 'macos' && env.MACOS_NOTARIZE != 'true'
505534
uses: tauri-apps/tauri-action@390cbe447412ced1303d35abe75287949e43437a
506535
env:
507536
CI: true
@@ -529,6 +558,30 @@ jobs:
529558
updaterJsonPreferNsis: true
530559
releaseAssetNamePattern: openwork-desktop-[platform]-[arch][ext]
531560

561+
- name: Build + upload (non-macOS)
562+
if: matrix.os_type != 'macos'
563+
uses: tauri-apps/tauri-action@390cbe447412ced1303d35abe75287949e43437a
564+
env:
565+
CI: true
566+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
567+
568+
# Tauri updater signing
569+
TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }}
570+
TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY_PASSWORD }}
571+
with:
572+
tagName: ${{ env.RELEASE_TAG }}
573+
releaseName: ${{ env.RELEASE_NAME }}
574+
releaseBody: ${{ env.RELEASE_BODY }}
575+
releaseDraft: ${{ env.RELEASE_DRAFT == 'true' }}
576+
prerelease: ${{ env.RELEASE_PRERELEASE == 'true' }}
577+
projectPath: apps/desktop
578+
tauriScript: pnpm exec tauri -vvv
579+
args: ${{ matrix.args }}
580+
retryAttempts: 3
581+
uploadUpdaterJson: false
582+
updaterJsonPreferNsis: true
583+
releaseAssetNamePattern: openwork-desktop-[platform]-[arch][ext]
584+
532585
- name: Verify versions.json bundled (macOS)
533586
if: success() && matrix.os_type == 'macos'
534587
shell: bash
@@ -865,7 +918,10 @@ jobs:
865918
uses: ./.github/workflows/release-daytona-snapshot.yml
866919
with:
867920
tag: ${{ needs.resolve-release.outputs.release_tag }}
868-
secrets: inherit
921+
secrets:
922+
DAYTONA_API_KEY: ${{ secrets.DAYTONA_API_KEY }}
923+
RENDER_API_KEY: ${{ secrets.RENDER_API_KEY }}
924+
RENDER_DEN_CONTROL_PLANE_SERVICE_ID: ${{ secrets.RENDER_DEN_CONTROL_PLANE_SERVICE_ID }}
869925

870926
aur-publish:
871927
name: Publish AUR

0 commit comments

Comments
 (0)