Skip to content

Commit 52e30c6

Browse files
ci(e2e): keep sandbox-id write out of the composite (zizmor github-env)
Pre-commit's zizmor audit flags any `>> $GITHUB_ENV` write inside a composite action as a cross-boundary env write (github-env, "may allow code execution") — even the identical line passes in a workflow file. Move the SANDBOX_NAME write back into each job as a one-liner (the pre-composite, zizmor-clean form) and have the e2e-prepare composite only copy the workspace + run prepare-env. GITHUB_JOB keeps the e2e and upgrade-e2e sandboxes distinct. Co-Authored-By: Claude Opus 4.8 <[email protected]> Signed-off-by: Myasnikov Daniil <[email protected]>
1 parent 8e25437 commit 52e30c6

2 files changed

Lines changed: 16 additions & 37 deletions

File tree

‎.github/actions/e2e-prepare/action.yaml‎

Lines changed: 6 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,15 @@
11
name: "E2E sandbox prepare"
22
description: >-
3-
Compute the sandbox id, copy the workspace into /tmp, and provision the Talos
4-
e2e sandbox (make prepare-env with the sanctioned 3x infra retry — the one
5-
retry justified by docs/agents/e2e-testing.md #1). Shared by the e2e and
6-
upgrade-e2e jobs so the sandbox bring-up lives in exactly one place.
7-
8-
inputs:
9-
sandbox-suffix:
10-
description: >-
11-
Appended to the sandbox id so jobs that run in parallel on the same
12-
workflow/ref (e2e vs upgrade-e2e) get distinct sandbox names. Empty
13-
reproduces the original single-job id byte-for-byte.
14-
required: false
15-
default: ""
16-
17-
outputs:
18-
sandbox-name:
19-
description: "The computed sandbox container name (also exported as SANDBOX_NAME)."
20-
value: ${{ steps.set.outputs.sandbox-name }}
3+
Copy the workspace into /tmp and provision the Talos e2e sandbox (make
4+
prepare-env with the sanctioned 3x infra retry — the one retry justified by
5+
docs/agents/e2e-testing.md #1). Shared by the e2e and upgrade-e2e jobs. The
6+
caller must set SANDBOX_NAME first (a one-liner kept in the job, not here,
7+
because a `>> $GITHUB_ENV` write inside a composite action trips zizmor's
8+
github-env audit).
219
2210
runs:
2311
using: composite
2412
steps:
25-
- name: Set sandbox ID
26-
id: set
27-
shell: bash
28-
run: |
29-
key="${GITHUB_REPOSITORY}:${GITHUB_WORKFLOW}:${GITHUB_REF}"
30-
# Only extend the hash key when a suffix is given, so the default
31-
# (e2e) sandbox name is identical to the pre-composite behaviour.
32-
[ -n "${{ inputs.sandbox-suffix }}" ] && key="${key}:${{ inputs.sandbox-suffix }}"
33-
name="cozy-e2e-sandbox-$(echo "$key" | sha256sum | cut -c1-10)"
34-
echo "SANDBOX_NAME=$name" >> "$GITHUB_ENV"
35-
echo "sandbox-name=$name" >> "$GITHUB_OUTPUT"
36-
3713
- name: Prepare workspace
3814
shell: bash
3915
run: |

‎.github/workflows/pull-requests.yaml‎

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -901,11 +901,14 @@ jobs:
901901
app-token: ${{ steps.app-token.outputs.token }}
902902
disk-id: ${{ needs.resolve_assets.outputs.disk_id }}
903903

904-
# ▸ Compute sandbox id, copy workspace, provision the Talos sandbox
905-
# (make prepare-env with the sanctioned 3x infra retry) — shared with
906-
# the upgrade-e2e job via a composite action.
904+
# ▸ Compute sandbox id (kept in the job — a $GITHUB_ENV write inside a
905+
# composite trips zizmor's github-env audit), then copy workspace +
906+
# provision the Talos sandbox via the shared composite (3x infra retry).
907+
# GITHUB_JOB makes the e2e and upgrade-e2e sandboxes distinct.
908+
- name: Set sandbox ID
909+
run: echo "SANDBOX_NAME=cozy-e2e-sandbox-$(echo "${GITHUB_REPOSITORY}:${GITHUB_WORKFLOW}:${GITHUB_REF}:${GITHUB_JOB}" | sha256sum | cut -c1-10)" >> $GITHUB_ENV
910+
907911
- name: Prepare e2e sandbox
908-
id: prepare
909912
uses: ./.github/actions/e2e-prepare
910913

911914
# ▸ Install Cozystack
@@ -1229,11 +1232,11 @@ jobs:
12291232
app-token: ${{ steps.app-token.outputs.token }}
12301233
disk-id: ${{ needs.resolve_assets.outputs.disk_id }}
12311234

1235+
- name: Set sandbox ID
1236+
run: echo "SANDBOX_NAME=cozy-e2e-sandbox-$(echo "${GITHUB_REPOSITORY}:${GITHUB_WORKFLOW}:${GITHUB_REF}:${GITHUB_JOB}" | sha256sum | cut -c1-10)" >> $GITHUB_ENV
1237+
12321238
- name: Prepare e2e sandbox
1233-
id: prepare
12341239
uses: ./.github/actions/e2e-prepare
1235-
with:
1236-
sandbox-suffix: upgrade
12371240

12381241
# ▸ Resolve the baseline (upgrade FROM) version on the runner, where the
12391242
# full tag history is available. For a release PR the target is the

0 commit comments

Comments
 (0)