Skip to content

Harden CI workflows against prompt injection and supply chain attacks#4034

Merged
ChrisJBurns merged 1 commit intomainfrom
harden-ci-agent-workflows
Mar 6, 2026
Merged

Harden CI workflows against prompt injection and supply chain attacks#4034
ChrisJBurns merged 1 commit intomainfrom
harden-ci-agent-workflows

Conversation

@JAORMX
Copy link
Collaborator

@JAORMX JAORMX commented Mar 6, 2026

Summary

Security hardening of GitHub Actions workflows based on an audit informed by the Clinejection and hackerbot-claw attack patterns.

Changes by priority

Priority File Fix
CRIT claude.yml Add author_association checks — blocks untrusted users (NONE, FIRST_TIMER, FIRST_TIME_CONTRIBUTOR) from invoking the AI agent
CRIT issue-triage.yml Remove Bash(gh label list) tool access, add prompt injection defense instruction
HIGH claude.yml Add explicit allowed_tools — scopes Bash to task, go, git, helm-docs only
HIGH CODEOWNERS Protect CLAUDE.md, .claude/ (skills, agents, rules) from unauthorized modification
MED security-scan.yml Pin codeql-action and govulncheck-action to SHA hashes
MED releaser.yml Disable Go module cache for release builds (cache poisoning prevention)
MED pr-size-labeler.yml Move ${{ }} interpolation to env: variable in github-script
LOW image-build-and-publish.yml Reduce permissions from contents: write to contents: read

Attack vectors mitigated

  • Prompt injection via comments/issues: Untrusted users can no longer invoke @claude or influence the triage bot to execute unintended actions
  • Arbitrary code execution: AI agents no longer have unrestricted Bash access
  • Poisoned system prompt: CLAUDE.md and .claude/ now require CODEOWNERS review
  • Supply chain (tag mutation): All actions are now SHA-pinned
  • Cache poisoning: Release builds install dependencies fresh
  • Expression injection: User-controlled values no longer interpolated in executable contexts

Not addressed (separate effort)

  • SLSA provenance generation is still commented out in releaser.yml — re-enabling requires additional configuration work

Test plan

  • Verify claude.yml still triggers for MEMBER/OWNER/COLLABORATOR comments containing @claude
  • Verify claude.yml does NOT trigger for comments from users with no association
  • Verify issue-triage.yml can still list labels via mcp__github__list_label
  • Verify security-scan.yml still uploads SARIF results with pinned action
  • Verify release workflow still builds successfully without Go cache
  • Verify PR size labeler still calculates and applies labels correctly
  • Verify image builds succeed with contents: read permissions

🤖 Generated with Claude Code

Apply security hardening to GitHub Actions workflows based on an audit
informed by the Clinejection and hackerbot-claw attack patterns:

- claude.yml: Add author_association checks to block untrusted users from
  invoking the AI agent, and restrict allowed_tools to prevent arbitrary
  shell execution via prompt injection
- issue-triage.yml: Remove Bash tool access (replaced with MCP GitHub
  tool for label listing), add prompt injection defense instruction
- CODEOWNERS: Protect CLAUDE.md, .claude/ skills, agents, and rules
  from unauthorized modification (poisoned system prompt vector)
- security-scan.yml: Pin codeql-action and govulncheck-action to SHA
  hashes (were using unpinned tag references)
- releaser.yml: Disable Go module cache for release builds to prevent
  cache poisoning attacks
- pr-size-labeler.yml: Move expression interpolation to env variable
  to prevent injection in github-script context
- image-build-and-publish.yml: Reduce permissions from contents:write
  to contents:read (no git write operations are performed)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@github-actions github-actions bot added the size/XS Extra small PR: < 100 lines changed label Mar 6, 2026
@codecov
Copy link

codecov bot commented Mar 6, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 68.61%. Comparing base (e469d48) to head (6108022).
⚠️ Report is 7 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4034      +/-   ##
==========================================
- Coverage   68.62%   68.61%   -0.01%     
==========================================
  Files         444      444              
  Lines       45222    45222              
==========================================
- Hits        31033    31030       -3     
- Misses      11790    11793       +3     
  Partials     2399     2399              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@JAORMX JAORMX requested a review from rdimitrov March 6, 2026 13:11
@ChrisJBurns ChrisJBurns merged commit c3aeb02 into main Mar 6, 2026
32 checks passed
@ChrisJBurns ChrisJBurns deleted the harden-ci-agent-workflows branch March 6, 2026 19:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/XS Extra small PR: < 100 lines changed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants