Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
8 changes: 8 additions & 0 deletions base-action/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,14 @@ This GitHub Action allows you to run [Claude Code](https://www.anthropic.com/cla

For simply tagging @claude in issues and PRs out of the box, [check out the Claude Code action and GitHub app](https://github.com/anthropics/claude-code-action).

## Trust model

This action is a thin wrapper that installs and runs Claude Code with the inputs you provide. It does **not** enforce any trust boundaries on its own. Running this action in a directory is equivalent to running Claude Code in that directory — Claude reads project-level configuration (`.claude/`, `CLAUDE.md`, `.mcp.json`, etc.) from the working directory, and the action's own setup steps run from there as well.

**The caller is responsible for ensuring the working directory and prompt are trusted.** If your workflow processes untrusted input (issues, fork pull requests, external comments), use [`anthropics/claude-code-action`](https://github.com/anthropics/claude-code-action) instead — it provides actor permission checks, restores project configuration from the base ref in PR contexts, and is the supported path for those scenarios.

See [Claude Code's security documentation](https://docs.anthropic.com/en/docs/claude-code/security) and the [GitHub Actions guidance on `pull_request_target`](https://securitylab.github.com/research/github-actions-preventing-pwn-requests/) for background.

## Usage

Add the following to your workflow file:
Expand Down
31 changes: 31 additions & 0 deletions docs/security.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,37 @@
- **No Cross-Repository Access**: Each action invocation is limited to the repository where it was triggered
- **Limited Scope**: The token cannot access other repositories or perform actions beyond the configured permissions

## Using this action with `pull_request_target` or `workflow_run`

`pull_request_target` and `workflow_run` execute with the **base repository's secrets**. If your workflow checks out the PR head (`ref: ${{ github.event.pull_request.head.sha }}`) into `$GITHUB_WORKSPACE` before this action, the action and Claude run with that checkout as the working directory.
Comment thread
OctavianGuzu marked this conversation as resolved.
Outdated

**Do not check out an untrusted ref into the workspace root before this action.** Use one of these patterns instead:

```yaml
# Preferred — check out the base ref (default). Claude can still see the PR's
# changes via `gh pr diff` / `gh pr view`, which the action provides.
- uses: actions/checkout@v4 # no `ref:` → base branch
- uses: anthropics/claude-code-action@v1
```

```yaml
# If you need the PR's files locally — check out into a subdirectory and
# pass it via --add-dir, so the workspace root stays clean.
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
path: pr-head
- uses: anthropics/claude-code-action@v1
with:
claude_args: "--add-dir pr-head"
```
Comment thread
OctavianGuzu marked this conversation as resolved.

This is general `pull_request_target` guidance — see [GitHub's documentation](https://securitylab.github.com/research/github-actions-preventing-pwn-requests/).

Check warning on line 48 in docs/security.md

View check run for this annotation

Claude / Claude Code Review

4ac01f0 doc fixes not present in current diff despite resolved threads

It looks like the 4ac01f0 doc fixes referenced in the two resolved threads above didn't survive the descope to docs-only — the second example (lines 36-46) still lacks the base-ref `actions/checkout@v4` step before the `path: pr-head` checkout (so it hard-fails under `pull_request_target` with `fatal: not a git repository`), and lines 25/31/41/48 still have only the `pull_request.head.sha` ref, the PRT-only `gh pr diff`/`gh pr view` hint, and the "general `pull_request_target` guidance" closer w
Comment thread
claude[bot] marked this conversation as resolved.
Outdated

### `claude-code-action` vs `claude-code-base-action`

`claude-code-base-action` is a lower-level building block that installs and runs Claude Code with the inputs you provide. It does not perform actor permission checks or restore project configuration from the base ref. If you need those behaviors, use this action (`claude-code-action`). See the [base-action README](../base-action/README.md#trust-model) for details.

## Pull Request Creation

In its default configuration, **Claude does not create pull requests automatically** when responding to `@claude` mentions. Instead:
Expand Down
Loading