feat: native opt-in git commit signing using Coder SSH key
- Dominant language
- Go
- Stars
- 14.5k
- Forks
- 1.5k
- Avg merge
- 1d 20h
- Merged PRs (30d)
- 601
Description
## Feature Request
### Problem
Coder generates an SSH keypair for every user and securely delivers it to workspace agents for git authentication (cloning/pushing). However, users who want to **sign git commits** with SSH keys cannot leverage this same key natively.
The agent already configures `gpg.format=ssh` and `gpg.ssh.program` to `coder gitsign`, but hard-codes `commit.gpgsign=false` with no user-facing way to enable it.
Currently, users must either:
- Use the [`git-commit-signing` Terraform module](https://registry.coder.com/modules/git-commit-signing) (which persists the private key to disk — less secure than the native `coder gitsign` approach that uses ephemeral temp files)
- Manually configure signing via startup scripts (as described in the workaround in #8922)
### Proposed Solution
Add a **user-level setting** to enable git commit signing with the Coder-managed SSH key. When enabled, the agent would set:
- `commit.gpgsign=true` (instead of the current hard-coded `false`)
- `user.signingkey` pointing to the user's Coder public key
The implementation effort is minimal since the core infrastructure already exists:
- `coder gitsign` command (`cli/gitssh.go`) — already implements `ssh-keygen -Y sign` with secure temp file handling
- Agent environment (`agent/agent.go:1359-1362`) — already sets `gpg.format=ssh` and `gpg.ssh.program`
- The SSH key API (`/api/v2/workspaceagents/me/gitsshkey`) — already delivers both keys to agents
### Implementation Scope
1. Add a user setting (e.g., "Enable git commit signing") to the user profile/settings
2. Propagate this setting to the agent via the agent manifest or metadata
3. In `agent/agent.go`, conditionally set `commit.gpgsign=true` and `user.signingkey` based on the user's preference
4. Expose the public key in the UI with context for adding it as a signing key on GitHub/GitLab (distinct from the authentication use case)
### Security Considerations
This was previously discussed in #8922, where it was noted that since admins can connect to any workspace, signing with a server-stored key doesn't cryptographically prove individual identity in the same way a personal hardware key would.
However:
- **The same trust model already applies to git authentication** — Coder's SSH key is already used for cloning and pushing, which can equally impersonate a user
- **Users are already doing this** via the module workaround, but in a *less secure* way (private key persisted to disk vs. `coder gitsign`'s ephemeral temp files)
- **This would be opt-in** — users who need stronger guarantees (e.g., hardware tokens) can continue using their own keys
- Many organizations use commit signing as a compliance checkbox rather than a strict identity proof, and this satisfies that requirement
### User Experience
1. User enables "Git commit signing" in their Coder profile settings
2. User copies their Coder public key and adds it to GitHub/GitLab as a **signing key**
3. All commits made in Coder workspaces are automatically signed — no further configuration needed
### Related
- #8922 — Original request (closed/stale)
- #6204 — S/MIME signing request (closed/stale)
- [git-commit-signing module](https://registry.coder.com/modules/git-commit-signing) — Current workaround
Contributor guide
Assessment
This issue has not been assessed yet.