check_apt_key: reject extra pub without fpr, secret keys, option injection, and unnormalized expected (CHECK-APT-KEY-PARSING-AND-GUARDS) #1610
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1610"
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?
Imported from ubiquitarianism/leonida. Originally posted by IlyassRS3 on 2026-11-25T05:51:09Z.
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).Imported from ubiquitarianism/leonida. Originally posted by copilot-pull-request-reviewer[bot] on 2026-11-25T05:51:20Z.
Review: COMMENTED
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.
Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-11-28T10:37:09Z.
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)