Skip to content

Security: Harden GitHub Actions workflows for public hook submissions#444

Merged
marktoda merged 16 commits into
mainfrom
security/workflow-hardening
Apr 6, 2026
Merged

Security: Harden GitHub Actions workflows for public hook submissions#444
marktoda merged 16 commits into
mainfrom
security/workflow-hardening

Conversation

@marktoda

@marktoda marktoda commented Apr 2, 2026

Copy link
Copy Markdown
Contributor

Security: Harden GitHub Actions workflows for public hook submissions

Problem

The current analyze-hook.yml gives Claude contents: write, git, gh, and python3 access — triggered by anyone opening an issue. This means arbitrary repo writes, shell injection via hook names, validator/prompt tampering from PR head checkout, and API key exposure to the LLM.

Solution

Split Claude's god-mode into a read-only analysis step (structured JSON output, Read/Grep only) plus deterministic script steps for all writing, git, and PR operations.

Workflow changes:

  • analyze-hook.yml — 6-step pipeline: prefilter → fetch source → compute flags → Claude classify (read-only) → assemble JSON → create PR. Claude never touches git/gh/files. Auto-merge enabled via gh pr merge --auto.
  • validate.yml — Two-checkout pattern (base branch scripts, PR head hooks). New exact-diff policy: PR must change exactly one file under hooks/.
  • review-hook.yml — Two-checkout pattern. Claude reads prompt from base branch (not PR head). Review posted via --body-file (not shell-interpolated --body). Real --approve for auto-merge.

New scripts: prefilter.py, fetch_source.py, compute_flags.py, assemble_hook.py, sync_chains.py — 28 new tests.

Other fixes:

  • id-token: write removed from all workflows
  • ETHERSCAN_API_KEY scoped only to fetch steps, never passed to Claude
  • claude-code-action upgraded from v1.0.75 to latest
  • Schema tightened (chain enum, field length limits, URL validation)
  • Issue template synced with chains.json (removed xlayer, tempo)

Branch protection required after merge

  • Required status checks: validate, review
  • Required approving reviews: 1
  • Allow auto-merge: enabled

marktoda and others added 14 commits April 2, 2026 16:04
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Wraps curl + parse_etherscan.py into a standalone script for use in the
hardened analyze-hook workflow. Includes unit tests with mock responses.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@vercel

vercel Bot commented Apr 2, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
hooklist Ready Ready Preview, Comment Apr 2, 2026 8:28pm

Request Review

@marktoda
marktoda merged commit dcc656b into main Apr 6, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants