Skip to content

Harden Claude fix workflow security - #50

Merged
leighmcculloch merged 2 commits into
mainfrom
harden-claude-action
May 12, 2026
Merged

leighmcculloch merged 2 commits into
mainfrom
harden-claude-action

Conversation

@leighmcculloch

Copy link
Copy Markdown
Member

What

Apply the best practices to the claude-fix-stellar-xdr workflow:

  • Move the broad contents: write/pull-requests: write/issues: write scope from workflow level to the single job that needs it; set top-level permissions: {} so any future job added to this file inherits nothing by default.
  • Add --max-turns 30 via claude_args to bound token spend per invocation.

The workflow's existing structural restrictions are kept:

  • Trigger restricted to workflow_run of the Rust workflow with conclusion == 'failure'.
  • Actor restricted to dependabot[bot].
  • Head branch restricted to dependabot/cargo/stellar-xdr- prefix.

The pull-request-target/pr-head subdir pattern and MEMBER/OWNER author-association gate (used by the claude-review.yml style) do not apply here: the trigger is workflow_run, not pull_request_target, and the actor gate (dependabot only) plays the equivalent role.

Why

Brings this workflow in line with the Claude-action security standards being applied across the stellar org (see stellar/stellar-core PR #5258 and the claude-code-action security guide). The two specific gaps closed:

  • Without --max-turns, a stuck-in-a-loop run could burn an unbounded number of tokens.
  • Without permissions: {} at the workflow root, any future job added to this file would silently inherit the broad write scopes. Moving them to the job level limits the blast radius.

Copilot AI review requested due to automatic review settings May 8, 2026 13:32
@github-project-automation github-project-automation Bot moved this to Backlog (Not Ready) in DevX May 8, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR hardens the .github/workflows/claude-fix-stellar-xdr.yml GitHub Actions workflow by applying tighter default GITHUB_TOKEN permissions and bounding Claude’s execution to limit token spend, while keeping the existing trigger/actor/branch restrictions for Dependabot stellar-xdr updates.

Changes:

  • Set workflow-level permissions: {} to ensure new jobs inherit no token permissions by default.
  • Move required write permissions (contents, pull-requests, issues) to the single job that needs them.
  • Add claude_args: --max-turns 30 to cap Claude tool-use cycles per invocation.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@leighmcculloch
leighmcculloch merged commit b610297 into main May 12, 2026
15 checks passed
@github-project-automation github-project-automation Bot moved this from Backlog (Not Ready) to Done in DevX May 12, 2026
@leighmcculloch
leighmcculloch deleted the harden-claude-action branch May 12, 2026 03:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants