check_apt_key: reject extra pub without fpr, secret keys, option injection, and unnormalized expected (CHECK-APT-KEY-PARSING-AND-GUARDS) #1610
No reviewers
No assignees
Labels
No labels
bug
dependencies
documentation
enhancement
missing claim
needs rebase
needs-triage
question
ready-for-agent
submodules
No project
No milestone
Dependencies
No dependencies set
Notifications
1 participant
Due date
No due date set.
Reference
leonida/mandy!1610
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/check-apt-key-parsing-and-guards"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Pull request successfully merged and closed
Item ID:
CHECK-APT-KEY-PARSING-AND-GUARDS(unlisted; coordination issue #14 is at GitHub's 2,500-comment cap with no open successor at submission time, and no open PR touchesscripts/check_apt_key.py).What changed
pubkeys even when they lack anfprrecord (scripts/check_apt_key.py,primary_fingerprints): previously apubrecord followed by anotherpub,sub/ssb/sec, or EOF without anfprline was silently dropped, so appending an extrapubrecord withoutfprafter the pinned key passedcheck(). Now everypubrecord without a matchingfprappends""(rendered as<missing>in diagnostics), causingcheck()to fail.sec/ssb) incheck(): previously asecrecord appended after the pinnedpubkey was ignored and passedcheck(). Key files handed toaptmust contain public key material only.--end-of-options beforepathinshow_keys(): prevents a key file path starting with-from being interpreted as agpgoption.expectedinsidecheck()and guard non-strings innormalize(): direct callers passing lowercase/spaced fingerprints now match, invalid/emptyexpectedvalues are refused before invokinggpg, andnormalize(None)returnsNoneinstead of raisingTypeError.-h/--helpand defaultargv=Noneinmain().tests/test_check_apt_key.py): 6 new tests plus expandedtest_normalizecovering all of the above (no game files, no GPU, no realgpgrequired).Verification
python3 -W error -I tests/test_check_apt_key.py -v: 19 passedpython3 -W error -I tests/test_text_write_line_endings.py: passedpython3 -I scripts/check_no_game_data.py scripts/check_apt_key.py tests/test_check_apt_key.py: cleanpython3 -m compileall -q scripts/check_apt_key.py tests/test_check_apt_key.py: cleantests/test_check_apt_key.pyagainst unpatchedmain:scripts/check_apt_key.py): 7 failures, 1 error across the 19 tests (all new tests fail on unpatchedmain).Red/green: the PR's tests fail on main and pass with this PR (Linux, Python 3.13.18).
Targeted batch of 18 PRs (their tests, the tests importing the changed modules, the docs tests) on main 3ca0707: no new failure, Linux / Python 3.13.
AI-assisted (Claude Code, Claude Opus 5.5)