dump: walk multiple armored messages in --list-packets (#2036) - #2429
Merged
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2429 +/- ##
==========================================
+ Coverage 85.44% 85.46% +0.01%
==========================================
Files 125 125
Lines 22946 22962 +16
==========================================
+ Hits 19607 19625 +18
+ Misses 3339 3337 -2 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
ronaldtse
force-pushed
the
list-packets-parity
branch
from
August 10, 2026 02:09
3f7e6a0 to
5ad5eb1
Compare
ronaldtse
force-pushed
the
list-packets-parity
branch
4 times, most recently
from
August 23, 2026 11:34
a869763 to
7c6b40a
Compare
Contributor
Author
|
Retargeted onto #2439 (json-c → nlohmann): the multi-armor dump walk is now implemented with nlohmann on top of the migration, instead of json-c APIs that this stack removes. The diff here is now a single commit on top of #2439. Merge order: #2439 → this PR (and #2448, which is also stacked on it). The nlohmann version is also simpler — merging each armored block's packets into one array no longer needs refcount juggling. |
6 tasks
ronaldtse
force-pushed
the
replace-json-c-with-nlohmann
branch
from
August 29, 2026 01:42
13f2dfa to
871fe76
Compare
ronaldtse
force-pushed
the
list-packets-parity
branch
from
August 29, 2026 01:43
7c6b40a to
9f1b8c8
Compare
7 tasks
ronaldtse
force-pushed
the
list-packets-parity
branch
from
August 30, 2026 16:17
f060656 to
9f1b8c8
Compare
Reimplemented on top of the nlohmann/json migration: a single input file with several armored OpenPGP messages now dumps all of them, for both the text and the JSON dumper, instead of silently dropping everything after the first -----END--- marker. Merging each block's packets into one array no longer needs json-c refcount juggling.
ronaldtse
force-pushed
the
list-packets-parity
branch
from
August 30, 2026 16:18
9f1b8c8 to
9427b81
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.
Summary
Fixes #2036. The packet dumper now walks all armored messages in inputs that contain more than one, instead of stopping after the first.
Root cause
DumpContextDst::dump()andDumpContextJson::dump()usedinit_armored_src()which reads exactly one armor block and reports EOF at the-----END ...-----line. Inputs likedata/test_stream_key_merge/key-both.asc(public keys in the first block, secret keys in the second) silently dropped everything after the first block.The fix is the same pattern already used by
process_pgp_signatures()and the key loader:rnp::ArmoredSourceconstructed withAllowBinary | AllowMultiple, then loop onarmor.eof() && armor.multiple()→armor.restart().Behaviour change
Before:
After:
Output now matches
gpg --list-packetson the same fixture (modulo intentional formatting differences).Test plan
test_ffi_dump_multiple_armored_messages(new) — covers both the text and JSON dumpers; assertsSecret key packet/Secret subkey packetappear in the output and"tag":5/"tag":7appear in the JSONtest_ffi_key_dump,test_ffi_key_dump_edge_cases,test_ffi_signatures_dump— no regression./rnp --list-packets src/tests/data/test_stream_key_merge/key-both.ascto thegpgdump attached to issue rnp --list-packets dumps fewer packets than gpg --list-packets from the same source #2036 — same number of packets, same typesOut of scope
Issue #2036 also mentions a broader audit (vendor subpackets, partial-length packets, PQC messages). This PR is scoped to the specific bug the maintainer identified in the issue thread (multiple armored messages). The broader audit belongs in follow-up PRs and intersects with #13 (Photo ID) for one of the gap categories.