Repository navigation
fix(provenance): fix multi-block armored keyring parsing on arbitrary alignments - #32610
Open
zanarellidev wants to merge 2 commits into
Open
zanarellidev wants to merge 2 commits into
zanarellidev wants to merge 2 commits into
Conversation
Author
|
Hi maintainers, this PR has been ready for review since 01/09. Could you please advise whether a rebase or any further change is needed? I am ready to update it promptly. |
… alignments Signed-off-by: Raphael Zanarelli <[email protected]>
Signed-off-by: Raphael Zanarelli <[email protected]>
zanarellidev
force-pushed
the
fix/multi-block-keyring-alignment
branch
from
October 2, 2026 00:53
87fc54c to
eb1cb84
Compare
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.
What this PR does / why we need it:
When parsing armored PGP keyrings with multiple blocks in
pkg/provenance/sign.go:loadArmoredKeyRing,armor.Decode(in)uses an internal buffered reader (bufio.NewReaderSize(in, 100)). When a block ends, any remaining bytes buffered across the boundary to the next block are discarded upon creating the next decoder. For keyrings formatted with short base64 lines (e.g. 32–56 characters), subsequent PGP keys are silently dropped without error.This PR splits each armored block (
-----BEGIN...-----END) before feeding it into a freshbytes.NewReader, preventing buffer readahead from dropping keys across multi-block armored keyrings.Which issue(s) this PR fixes:
Fixes #32567
Special notes for your reviewer:
TestLoadKeyRingArmoredMultiBlockLineAlignmentsinpkg/provenance/sign_test.gocovering 8 different line-length alignments (32 to 56 chars) to ensure full regression coverage.