Repository navigation
fix(desktop): read the PPA key add-apt-repository writes into Signed-By - #8982
Conversation
[Medium impact] The PR appears safe to merge; no blocking issue was found. SummaryThis PR lets desktop capture read and verify public keys stored inside a deb822
Diagram%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[Read deb822 sources entry] --> B{Signed-By holds a key?}
B -->|Yes| C[Reconstruct armored key]
B -->|No| D[Find candidate key files]
C --> E[Verify release with gpgv]
D --> E
E -->|Verified| F[Retain only the verifying key]
E -->|Not verified| G[Record refusal reason]
F --> H[Export retained key]
E --> I[Remove private keyring folder]
Reviews (4) · Last reviewed commit: "Merge main into feat/desktop-ppa-inline-..." · Reviewed by Greptile |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
On Ubuntu 24.04, add-apt-repository puts the PPA's armored key inside the deb822 Signed-By field, and REA refused such repositories, so PPAs added the standard way could not be exported. REA now reads that key by deb822 rules, verifies the release with it through the same private gpgv keyring as key files, as the entry's only candidate (as apt does), retains it as armored and exports it as apt-keys/<name>.asc. A held key that does not verify is refused with a reason that names no URL. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The PPA refusal tests now assert that the reason names the sources file and the release file and no URL, and that export carries that reason, instead of comparing whole sentences. Co-Authored-By: Claude Opus 5.5 <[email protected]>
26ccec5 to
8df5d34
Compare
|
@morluto this one is ready for review, and it merges cleanly into main. All checks pass. Greptile scored 5/5 on its last review, It lets |
Summary
capture-desktop-applicationcan now record a PPA added the standard way. On Ubuntu 24.04,add-apt-repository ppa:<owner>/<name>writes a deb822.sourcesfile whoseSigned-Byfield holds the PPA's armored key. Until now REA refused such a repository ("its Signed-By field holds the key itself, which REA does not read"), so the export could not declare it.Problem and expected behavior
#8934 verifies a vendor repository's release with gpgv before the export declares it. It found keys only in keyring files named by
Signed-Byor in the keys apt trusts. A PPA added withadd-apt-repositorykeeps its key inside the sources file instead, so the capture refused it. FreeCAD, which Ubuntu 24.04 ships only through such a PPA, hit this.After this change, the key that the field holds is read, verified and exported like a key file.
Change and scope
src/domain/desktop/aptRepositories.tsreads the key block from the field by deb822 rules. Continuation lines are stripped,.becomes an empty line, and the block runs from its BEGIN line to its last END line.inlineKeyis now the key text or null.src/desktop/GpgvKeyCheck.tsaddsheldVerifying. It shares the gpgv and retention steps withfirstVerifying, through the same private keyring folder and cleanup owner.src/desktop/AptRepositoryInventory.tsmakes the held key an entry's only candidate. As in apt, an entry that holds a key never falls back to the keys apt trusts for every repository.armored, so the export writesapt-keys/<name>.asc. No schema change.Contract and boundary impact
capture_desktop_application, apt repository facts.signing_key.pathnames the sources file for a held key.Expected effects:
Evidence and regression coverage
Tests added, each failing on the parent commit:
add-apt-repositorywrites it dearmors to the fixture key. A key starting on theSigned-By:line, tab-indented lines, a comment, and a field after the block are handled.signing_keyand the export declaresapt-keys/typora.asc. A PPA whose held key does not verify is refused without tryingtrusted.gpg.d.Real file: I ran
add-apt-repository -n ppa:freecad-maintainers/freecad-stablein a freshubuntu:24.04container. The parser read the key block from the file it wrote, and the block's fingerprint is9F0E375806520BD65BC61B18A728AE60A790F0EB, the PPA's published key.For evidence-bearing changes:
Validation performed
npm run typecheck,lint,lint:typed,format:check,build:cachedthenknip,jscpd,docs:check,docs:build,verify:test-discoveryandverify:architecture-guards.Compatibility, safety, and release
add-apt-repositoryoutput; gpgv from GnuPG 2.4.Author readiness
Human owner: @earakely-scale
Before merge
type(scope): outcome.🤖 Generated with Claude Code