Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions .github/workflows/claude-wif-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,11 @@ jobs:
- name: Get PR ref
if: github.event_name == 'issue_comment'
id: pr
env:
GH_TOKEN: ${{ github.token }}
run: |
PR_DATA=$(gh api repos/${{ github.repository }}/pulls/${{ github.event.issue.number }})
echo "ref=$(echo "$PR_DATA" | jq -r '.head.sha')" >> "$GITHUB_OUTPUT"
echo "repo=$(echo "$PR_DATA" | jq -r '.head.repo.full_name')" >> "$GITHUB_OUTPUT"
curl -fsSL -H "Authorization: token ${{ github.token }}" \
"https://api.github.com/repos/${{ github.repository }}/pulls/${{ github.event.issue.number }}" > /tmp/pr.json
echo "ref=$(jq -r '.head.sha' /tmp/pr.json)" >> "$GITHUB_OUTPUT"
echo "repo=$(jq -r '.head.repo.full_name' /tmp/pr.json)" >> "$GITHUB_OUTPUT"

- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
with:
Expand All @@ -39,7 +38,7 @@ jobs:

- name: Install Claude Code
run: |
curl -fsSL https://claude.ai/install.sh | sh
curl -fsSL https://claude.ai/install.sh | bash
echo "$HOME/.local/bin" >> $GITHUB_PATH
Comment on lines 39 to 42

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical | ⚡ Quick win

CRITICAL: Unverified script execution from the internet.

Downloading and executing a script from https://claude.ai/install.sh without integrity verification creates multiple attack vectors:

  1. Supply chain compromise: If the Claude.ai infrastructure is compromised, malicious code will be executed in the workflow with access to GCP credentials.
  2. Man-in-the-middle attacks: Despite HTTPS, certificate validation issues or DNS poisoning could serve malicious scripts.
  3. No version pinning: The script content can change at any time without notice.

The change from sh to bash does not address the underlying security issue.

As per coding guidelines: "Sign artifacts with Sigstore/cosign" – here unsigned, unverified code is executed directly.

🔒 Proposed fix: Verify installer integrity

Download the installer, verify its hash, then execute:

      - name: Install Claude Code
        run: |
-         curl -fsSL https://claude.ai/install.sh | bash
+         curl -fsSL https://claude.ai/install.sh -o /tmp/install.sh
+         # Update this hash when updating Claude Code version
+         echo "EXPECTED_HASH /tmp/install.sh" | sha256sum --check
+         bash /tmp/install.sh
          echo "$HOME/.local/bin" >> $GITHUB_PATH

Replace EXPECTED_HASH with the SHA-256 hash of the legitimate installer. Update the hash when intentionally updating Claude Code versions.

Alternatively, request that Anthropic provide signed releases or publish the installer to a package manager with built-in verification.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/claude-wif-test.yaml around lines 39 - 42, Replace the
unsafe "curl | bash" step in the "Install Claude Code" job by first downloading
the installer to a file (the current curl command), then verifying its integrity
(compare SHA-256 or verify a cosign/sigstore signature) before executing;
specifically update the workflow step that currently runs "curl -fsSL
https://claude.ai/install.sh | bash" to instead download the installer, validate
it against an EXPECTED_HASH or a provided signature, fail the job if
verification fails, and only then run the installer file (do not pipe directly
to bash and ensure version/hash/signature are pinned and updated when
intentionally changing Claude Code versions).


- name: Authenticate to GCP via WIF
Expand Down