Fix OpenPGP key-fingerprint panic under GODEBUG=fips140=only - #458
Open
sameerforge wants to merge 2 commits into
Open
Fix OpenPGP key-fingerprint panic under GODEBUG=fips140=only#458sameerforge wants to merge 2 commits into
sameerforge wants to merge 2 commits into
Conversation
sameerforge
force-pushed
the
topic/sameerkh/fips140-openpgp-armor-panic
branch
11 times, most recently
from
August 14, 2026 10:12
53d626d to
47a44b0
Compare
…UG=fips140=only Under a native-FIPS build running with GODEBUG=fips140=only, two OpenPGP operations trigger unhandled panics: 1. Parsing public keys via openpgp.ReadArmoredKeyRing computes an RFC 4880 v4 key fingerprint (SHA-1) unconditionally, causing an immediate panic. 2. Verifying signed commits or tags via openpgp.CheckArmoredDetachedSignature call, which panics unconditionally under strict FIPS mode. To resolve these panics, wrap both the keyring parsing call (openpgp.ReadArmoredKeyRing) and the signature verification call (openpgp.CheckArmoredDetachedSignature) in crypto/fips140.WithoutEnforcement. This allows key parsing and signature verification to execute without panicking under GODEBUG=fips140=only. Adds unit tests to cover key parsing and DSA signature verification under GODEBUG=fips140=only. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Signed-off-by: Sameer <sameer.khan@broadcom.com>
- Update Go version to 1.26.5 in go.mod - Bump carvel.dev/imgpkg dependency to v0.48.1 - Update golangci-lint to align with Go version - Run `go mod tidy` and `go mod vendor` to update go.sum and vendor/ Signed-off-by: Sameer <sameer.khan@broadcom.com>
sameerforge
force-pushed
the
topic/sameerkh/fips140-openpgp-armor-panic
branch
from
August 14, 2026 10:24
47a44b0 to
6273fcb
Compare
Contributor
Author
|
@joaopapereira Please review the PR. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Go 1.26+ ships a native FIPS 140-3 validated cryptographic module (
crypto/fips140). When running withGODEBUG=fips140=only, any use of a cryptographic primitive that isn't FIPS-approved panics instead of returning an error. Running vendir's Git commit/tag signature verification under this mode currently crashes the process in two separate places insidegolang.org/x/crypto/openpgp: key-fingerprint parsing and signature verification.This PR wraps both operations in
crypto/fips140.WithoutEnforcementto prevent runtime panics under strict FIPS mode, and bumps the project's Go version and dependencies accordingly.Detailed Changes
1. Key-fingerprint parsing (
openpgparmor/armor.go)openpgp.ReadArmoredKeyRingcomputes each key's RFC 4880 v4 fingerprint with SHA-1 unconditionally upon parsing. Underfips140=only, this panics immediately before signature verification can even begin.Wrapped
openpgp.ReadArmoredKeyRingincrypto/fips140.WithoutEnforcementso public key rings can be parsed without triggering a panic.2. Signature verification (
fetch/git/verification.go)Verifying signatures made with non-FIPS-approved algorithms via
openpgp.CheckArmoredDetachedSignaturepanics unconditionally underfips140=only.Wrapped
openpgp.CheckArmoredDetachedSignatureincrypto/fips140.WithoutEnforcementto allow signature verification of legacy commits and tags to execute without panicking.3. Toolchain & Dependency Updates
Since
crypto/fips140.WithoutEnforcementrequires Go 1.26+:go mod tidyandgo mod vendorto update go.sum and the vendor/ directory.Test Plan
TestReadArmoredKeys_UnderFIPS140Onlyreproduces the fingerprint panic on unfixed code and passes with the fix applied underGODEBUG=fips140=only.TestGitVerification(trusted/stranger/unsigned commit and tag cases) passes unchanged.go build ./...,go vet ./..., andgolangci-lintrun pass cleanly across the vendor tree.