fix(ci): run release safeguard test in unprivileged workflow - #77
Conversation
Move the PR-controlled shell test out of the workflow_run context and into the pull_request test workflow to resolve the CodeQL untrusted-checkout finding introduced by #76.
aheritier
left a comment
There was a problem hiding this comment.
Reviewed at head d725b67. CI is green (8/8 check-runs), but I can't recommend merging as-is: the PR has merge conflicts and its stated purpose has already been fixed on main.
[blocking] The CodeQL finding this PR targets is already fixed on main.
gh api repos/docker/docker-agent-action/code-scanning/alerts/204→"state": "fixed".git log 5396207..origin/main -- .github/workflows/test-e2e.yml→3776045 fix(security): harden fork workflow-run context (#88), which deletedref: ${{ github.event_name == 'workflow_run' && github.event.workflow_run.head_sha || '' }}from all three shell-test jobs and added a directpull_request:trigger totest-e2e.yml.- On current
main,.github/workflows/test-e2e.yml:60-77runstest-release-caller-permissionswithif: push || pull_request || workflow_dispatch,permissions: contents: read, and a default (base-ref) checkout — no PR-controlled ref, no secrets.
So the "Before" column in the PR description no longer describes main, and merging this delivers no security improvement — only a workflow reorganisation. Please either close it or re-scope/rebase it as an explicit consolidation change.
[blocking] Merge conflict.
git merge-tree --write-tree <pr-head> origin/main
CONFLICT (content): Merge conflict in .github/workflows/test-e2e.yml
The PR branch is based on 5396207; #88 rewrote the same lines.
[should-fix] If kept as a consolidation, keep the three shell tests together.
.github/workflows/test.yml:74-75 adds the caller-permissions script to the Unit Tests job while test-output-extraction and test-job-summary stay in test-e2e.yml (:22-58). That splits three sibling shell tests across two workflows, and a "keep both sides" conflict resolution would run this script twice per PR. Move all three, or none.
[optional] The new step lands in the job named Unit Tests (test.yml:57), so a shell-integration failure will be reported as a unit-test failure, and it serialises behind pnpm test. AGENTS.md:237-241 documents tests/*.sh as shell integration tests distinct from pnpm test.
Verified as correct in this change (no action needed):
- Dropping
cd testsis safe — the script resolves its own paths (tests/test-release-caller-permissions.sh:19-20,SCRIPT_DIR/REPO_ROOT). - Dropping
chmod +xis safe — the file is mode100755in the tree. - No
pnpm buildneeded — the script stubsgit/node/gh, so theUnit Testsjob'spnpm install-only setup suffices. Ran locally: all 7 scenarios pass, exit 0.
Summary
Follow-up to #76 that resolves CodeQL alert #204.
workflow_runjob checked outgithub.event.workflow_run.head_shaand executed a PR-controlled shell scriptpull_request/pushtest workflowcontents: readand no secretsChanges
.github/workflows/test-e2e.ymltests/test-release-caller-permissions.shafter unit tests in.github/workflows/test.ymlworkflow_runValidation
actionlint -shellcheck=bash tests/test-release-caller-permissions.sh(7 scenarios passed)git diff --check