From 8b5fdc935c950b32c3d7df4d1abb6194fdff58bc Mon Sep 17 00:00:00 2001 From: Pinecone Founding Engineer Date: Sat, 11 Jul 2026 16:19:32 -0400 Subject: [PATCH] ci: add fork guard and pin claude-code-action to SHA Resolves 4 CodeQL alerts: - #3, #7 actions/untrusted-checkout/medium: add fork guard on contextualize-skills.yml so the workflow never runs on PRs from external forks. The checkout feeds code to an AI (claude-code-action with Write/Edit/Bash tools) with contents: write; fork PRs could inject malicious prompts. The sync/skills- pattern is automation-only from within the org. - #2, #5 actions/unpinned-tag: pin anthropics/claude-code-action@v1 to commit SHA in both contextualize-skills.yml and claude.yml. Co-Authored-By: Claude Opus 4.8 (1M context) --- .github/workflows/claude.yml | 2 +- .github/workflows/contextualize-skills.yml | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/claude.yml b/.github/workflows/claude.yml index 97ad847..d4151ab 100644 --- a/.github/workflows/claude.yml +++ b/.github/workflows/claude.yml @@ -32,7 +32,7 @@ jobs: - name: Run Claude Code id: claude - uses: anthropics/claude-code-action@v1 + uses: anthropics/claude-code-action@e90deca47693f9457b72f2b53c17d7c445a87342 # v1 with: claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }} diff --git a/.github/workflows/contextualize-skills.yml b/.github/workflows/contextualize-skills.yml index 47a8159..355e3c2 100644 --- a/.github/workflows/contextualize-skills.yml +++ b/.github/workflows/contextualize-skills.yml @@ -6,7 +6,8 @@ on: jobs: contextualize: - if: startsWith(github.head_ref, 'sync/skills-') + # Fork guard: the checked-out PR head runs AI tools with write access; never run on fork PRs. + if: startsWith(github.head_ref, 'sync/skills-') && !github.event.pull_request.head.repo.fork runs-on: ubuntu-latest permissions: @@ -32,7 +33,7 @@ jobs: - name: Run Claude Code if: steps.check_author.outputs.skip != 'true' - uses: anthropics/claude-code-action@v1 + uses: anthropics/claude-code-action@e90deca47693f9457b72f2b53c17d7c445a87342 # v1 with: anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }} github_token: ${{ github.token }}