Skip to content

Fix SSH signing for 1Password and bare public key setups#1002

Merged
pfleidi merged 4 commits intomainfrom
fix/1password-ssh-signing
Apr 21, 2026
Merged

Fix SSH signing for 1Password and bare public key setups#1002
pfleidi merged 4 commits intomainfrom
fix/1password-ssh-signing

Conversation

@pfleidi
Copy link
Copy Markdown
Contributor

@pfleidi pfleidi commented Apr 21, 2026

Summary

  • PR Add support for signing checkpoint commits #960 introduced checkpoint commit signing via go-git's auto signer library. This broke setups where gpg.ssh.program is configured (e.g. 1Password's op-ssh-sign), because go-git signs natively via the SSH agent protocol while the external program uses a separate mechanism. The signing key typically isn't in the SSH agent, causing warnings on every push.
  • Detects gpg.ssh.program in the raw git config and skips native signing silently with a debug log. Checkpoint commits will be unsigned in this setup, which is acceptable since signing is best-effort.

Test plan

  • Unit tests for hasSSHSignProgram (4 cases: nil, empty, program set, gpg without ssh.program)
  • mise run check passes (fmt, lint, unit, integration, E2E canary)
  • Manual verification: git push no longer emits signing warnings with 1Password SSH setup

pfleidi added 2 commits April 21, 2026 11:55
The go-git auto signer library expects a key:: prefix for literal SSH
public keys, but tools like 1Password set user.signingKey to a bare
public key string (e.g. "ssh-ed25519 AAAA..."). Without the prefix,
the library falls through to the private-key-file codepath and fails
with "reading SSH private key: open ssh-ed25519".

Detect bare SSH public key strings by their key type prefix and prepend
key:: so the library routes them through the SSH agent matching path.

Entire-Checkpoint: 8b089d71bc99
When gpg.ssh.program is set (e.g. 1Password's op-ssh-sign), signing
happens via an external binary that go-git cannot invoke. The SSH
agent at SSH_AUTH_SOCK typically does not hold the signing key in this
setup, causing a "no keys found matching signingKey" error.

Detect gpg.ssh.program in the raw git config and skip native signing
silently. Checkpoint commits will be unsigned, which is acceptable
since signing is best-effort. Add a debug log for observability.

Entire-Checkpoint: 68cdcfe4732a
Copilot AI review requested due to automatic review settings April 21, 2026 20:22
@pfleidi pfleidi requested a review from a team as a code owner April 21, 2026 20:22
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

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 restores best-effort checkpoint commit signing compatibility for SSH-signing setups where user.signingKey is configured as a bare SSH public key (common with 1Password and some Git configs), and avoids attempting go-git native SSH signing when Git is configured to delegate signing to an external gpg.ssh.program.

Changes:

  • Add normalizeSigningKey() to detect bare SSH public key literals and prepend key:: so the auto signer routes through the SSH-agent path.
  • Add hasSSHSignProgram() to detect gpg.ssh.program from raw git config and skip native signing (debug-log only) when external SSH signing is configured.
  • Add unit tests covering SSH key normalization and gpg.ssh.program detection.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
cmd/entire/cli/objectsigner.go Normalizes SSH signing keys and skips native signing when gpg.ssh.program is set.
cmd/entire/cli/objectsigner_test.go Adds unit tests for signing key normalization and raw-config detection of gpg.ssh.program.

Comment thread cmd/entire/cli/objectsigner.go Outdated
Comment thread cmd/entire/cli/objectsigner_test.go Outdated
Comment thread cmd/entire/cli/objectsigner.go Outdated
The hasSSHSignProgram check already short-circuits before reaching
auto.FromConfig for external-program setups. No realistic config
uses a bare public key string without gpg.ssh.program, so the
normalization logic is dead code.

Entire-Checkpoint: f791d4afad16
Comment thread cmd/entire/cli/objectsigner.go Outdated
Comment thread cmd/entire/cli/objectsigner.go Outdated
Rename hasSSHSignProgram to hasCustomSSHSignProgram and exclude the
git default value "ssh-keygen", which works with go-git's native SSH
agent signing. Only truly external programs like 1Password's
op-ssh-sign should skip native signing.

Entire-Checkpoint: fe883bace626
@pfleidi pfleidi merged commit 794edf9 into main Apr 21, 2026
9 checks passed
@pfleidi pfleidi deleted the fix/1password-ssh-signing branch April 21, 2026 22:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

4 participants