Skip to content

fix(signature): prevent SSH path from succeeding in GPG verification#84

Merged
benner merged 1 commit into
mainfrom
fix/signature-pin-gpg-format
May 2, 2026
Merged

fix(signature): prevent SSH path from succeeding in GPG verification#84
benner merged 1 commit into
mainfrom
fix/signature-pin-gpg-format

Conversation

@benner
Copy link
Copy Markdown
Owner

@benner benner commented May 2, 2026

git auto-detects signature format from the commit object regardless of
gpg.format — so _verify_gpg was silently verifying SSH-signed commits via
the system gpg.ssh.allowedSignersFile instead of the imported GPG keys,
causing it to report "signature type: GPG" for SSH-signed commits.

Setting gpg.ssh.allowedSignersFile=/dev/null in the verify-commit call
neutralises the SSH path (empty signers file → no principal matches →
exit 1) while leaving GPG verification unaffected. The gpg.format=ssh
flag in _verify_ssh is kept to ensure SSH format is always used there.

git auto-detects signature format from the commit object regardless of
gpg.format — so _verify_gpg was silently verifying SSH-signed commits via
the system gpg.ssh.allowedSignersFile instead of the imported GPG keys,
causing it to report "signature type: GPG" for SSH-signed commits.

Setting gpg.ssh.allowedSignersFile=/dev/null in the verify-commit call
neutralises the SSH path (empty signers file → no principal matches →
exit 1) while leaving GPG verification unaffected. The gpg.format=ssh
flag in _verify_ssh is kept to ensure SSH format is always used there.

Signed-off-by: Nerijus Bendžiūnas <nerijus.bendziunas@gmail.com>
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 2, 2026

Coverage

Coverage Report (Δ +0.0%)
FileStmtsMissCoverMissing
src/git_commit_guard
   __init__.py4660100% 
TOTAL4660100% 

@benner benner marked this pull request as ready for review May 2, 2026 08:01
@benner benner merged commit cab0d35 into main May 2, 2026
7 checks passed
@benner benner deleted the fix/signature-pin-gpg-format branch May 2, 2026 08:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant