You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: add ssh_signing_key input for SSH commit signing (#784)
* feat: add ssh_signing_key input for SSH commit signing
Add a new ssh_signing_key input that allows passing an SSH signing key
for commit signing, as an alternative to the existing use_commit_signing
(which uses GitHub API-based commits).
When ssh_signing_key is provided:
- Git is configured to use SSH signing (gpg.format=ssh, commit.gpgsign=true)
- The key is written to ~/.ssh/claude_signing_key with 0600 permissions
- Git CLI commands are used (not MCP file ops)
- The key is cleaned up in a post step for security
Behavior matrix:
| ssh_signing_key | use_commit_signing | Result |
|-----------------|-------------------|--------|
| not set | false | Regular git, no signing |
| not set | true | GitHub API (MCP), verified commits |
| set | false | Git CLI with SSH signing |
| set | true | Git CLI with SSH signing (ssh_signing_key takes precedence)
* docs: add SSH signing key documentation
- Update security.md with detailed setup instructions for both signing options
- Explain that ssh_signing_key enables full git CLI operations (rebasing, etc.)
- Add ssh_signing_key to inputs table in usage.md
- Update bot_id/bot_name descriptions to note they're needed for verified commits
* fix: address security review feedback for SSH signing
- Write SSH key atomically with mode 0o600 (fixes TOCTOU race condition)
- Create .ssh directory with mode 0o700 (SSH best practices)
- Add input validation for SSH key format
- Remove unused chmod import
- Add tests for validation logic
Copy file name to clipboardExpand all lines: action.yml
+11Lines changed: 11 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -81,6 +81,10 @@ inputs:
81
81
description: "Enable commit signing using GitHub's commit signature verification. When false, Claude uses standard git commands"
82
82
required: false
83
83
default: "false"
84
+
ssh_signing_key:
85
+
description: "SSH private key for signing commits. When provided, git will be configured to use SSH signing. Takes precedence over use_commit_signing."
86
+
required: false
87
+
default: ""
84
88
bot_id:
85
89
description: "GitHub user ID to use for git operations (defaults to Claude's bot ID)"
Copy file name to clipboardExpand all lines: docs/security.md
+58-1Lines changed: 58 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -38,7 +38,64 @@ The following permissions are requested but not yet actively used. These will en
38
38
39
39
## Commit Signing
40
40
41
-
Commits made by Claude through this action are no longer automatically signed with commit signatures. To enable commit signing set `use_commit_signing: True` in the workflow(s). This ensures the authenticity and integrity of commits, providing a verifiable trail of changes made by the action.
41
+
By default, commits made by Claude are unsigned. You can enable commit signing using one of two methods:
42
+
43
+
### Option 1: GitHub API Commit Signing (use_commit_signing)
44
+
45
+
This uses GitHub's API to create commits, which automatically signs them as verified from the GitHub App:
46
+
47
+
```yaml
48
+
- uses: anthropics/claude-code-action@main
49
+
with:
50
+
use_commit_signing: true
51
+
```
52
+
53
+
This is the simplest option and requires no additional setup. However, because it uses the GitHub API instead of git CLI, it cannot perform complex git operations like rebasing, cherry-picking, or interactive history manipulation.
54
+
55
+
### Option 2: SSH Signing Key (ssh_signing_key)
56
+
57
+
This uses an SSH key to sign commits via git CLI. Use this option when you need both signed commits AND standard git operations (rebasing, cherry-picking, etc.):
58
+
59
+
```yaml
60
+
- uses: anthropics/claude-code-action@main
61
+
with:
62
+
ssh_signing_key: ${{ secrets.SSH_SIGNING_KEY }}
63
+
bot_id: "YOUR_GITHUB_USER_ID"
64
+
bot_name: "YOUR_GITHUB_USERNAME"
65
+
```
66
+
67
+
Commits will show as verified and attributed to the GitHub account that owns the signing key.
Copy file name to clipboardExpand all lines: docs/usage.md
+4-3Lines changed: 4 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -71,9 +71,10 @@ jobs:
71
71
|`branch_prefix`| The prefix to use for Claude branches (defaults to 'claude/', use 'claude-' for dash format) | No |`claude/`|
72
72
|`settings`| Claude Code settings as JSON string or path to settings JSON file | No | "" |
73
73
|`additional_permissions`| Additional permissions to enable. Currently supports 'actions: read' for viewing workflow results | No | "" |
74
-
|`use_commit_signing`| Enable commit signing using GitHub's commit signature verification. When false, Claude uses standard git commands | No |`false`|
75
-
|`bot_id`| GitHub user ID to use for git operations (defaults to Claude's bot ID) | No |`41898282`|
76
-
|`bot_name`| GitHub username to use for git operations (defaults to Claude's bot name) | No |`claude[bot]`|
74
+
|`use_commit_signing`| Enable commit signing using GitHub's API. Simple but cannot perform complex git operations like rebasing. See [Security](./security.md#commit-signing)| No |`false`|
75
+
|`ssh_signing_key`| SSH private key for signing commits. Enables signed commits with full git CLI support (rebasing, etc.). See [Security](./security.md#commit-signing)| No | "" |
76
+
|`bot_id`| GitHub user ID to use for git operations (defaults to Claude's bot ID). Required with `ssh_signing_key` for verified commits | No |`41898282`|
77
+
|`bot_name`| GitHub username to use for git operations (defaults to Claude's bot name). Required with `ssh_signing_key` for verified commits | No |`claude[bot]`|
77
78
|`allowed_bots`| Comma-separated list of allowed bot usernames, or '\*' to allow all bots. Empty string (default) allows no bots | No | "" |
78
79
|`allowed_non_write_users`|**⚠️ RISKY**: Comma-separated list of usernames to allow without write permissions, or '\*' for all users. Only works with `github_token` input. See [Security](./security.md)| No | "" |
79
80
|`path_to_claude_code_executable`| Optional path to a custom Claude Code executable. Skips automatic installation. Useful for Nix, custom containers, or specialized environments | No | "" |
0 commit comments