Skip to content

fix(desktop): read the PPA key add-apt-repository writes into Signed-By - #8982

Merged
morluto merged 2 commits into
morluto:mainfrom
earakely-scale:feat/desktop-ppa-inline-keys
Nov 6, 2026
Merged

morluto merged 2 commits into
morluto:mainfrom
earakely-scale:feat/desktop-ppa-inline-keys

Conversation

@earakely-scale

@earakely-scale earakely-scale commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

Builds on main. Review 7d761ab4e, the change, and 8df5d3459, which fixes the review finding.

Summary

capture-desktop-application can now record a PPA added the standard way. On Ubuntu 24.04, add-apt-repository ppa:<owner>/<name> writes a deb822 .sources file whose Signed-By field 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-By or in the keys apt trusts. A PPA added with add-apt-repository keeps 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

  • Parse: src/domain/desktop/aptRepositories.ts reads 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. inlineKey is now the key text or null.
  • Verify: src/desktop/GpgvKeyCheck.ts adds heldVerifying. It shares the gpgv and retention steps with firstVerifying, through the same private keyring folder and cleanup owner.
  • Only that key: src/desktop/AptRepositoryInventory.ts makes 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.
  • Record and export: the retained key's path is the sources file and its format is armored, so the export writes apt-keys/<name>.asc. No schema change.
  • Refusal: a held key that does not verify is refused with a reason that names the sources and release files, not a URL.
  • Docs: the capture and export guides and the vendor-packages spec (inline keys leave its Non-goals).

Contract and boundary impact

  • Semantic owner and earliest changed stage: capture_desktop_application, apt repository facts.
  • Contribution scope fit and linked maintainer decision: same approved desktop-environments work as feat(desktop): capture a Linux desktop application in use #8874.
  • CLI and MCP/tool-catalog contract: unchanged.
  • Provider, bridge, target-format, or platform compatibility: the same gpgv call as for key files.
  • Evidence, artifact, provenance, or reconstruction contract: unchanged schema. signing_key.path names the sources file for a held key.
  • Target selection, authority, upstream behavior, and cleanup details: the held key is written only into the existing private keyring folder, which is removed afterwards.
  • Generated metadata: none.

Expected effects:

  • Read existing files or captured data.
  • Launch or attach to a process.
  • Inject instrumentation or run scripts/code.
  • Change process memory, registers, files, or configuration.
  • Contact network services.
  • Recover protected code or work around protections.
  • Documentation or usability only; no target interaction.
  • Not sure yet; investigation or maintainer guidance needed.

Evidence and regression coverage

Tests added, each failing on the parent commit:

  • Parsing: a PPA's key written as add-apt-repository writes it dearmors to the fixture key. A key starting on the Signed-By: line, tab-indented lines, a comment, and a field after the block are handled.
  • Real gpgv: a held armored key verifies, is kept as is, and its path is the sources file. Its keyring goes into the private folder and is removed afterwards. A non-verifying held key gets the no-URL reason.
  • Capture and export: a PPA capture records an armored signing_key and the export declares apt-keys/typora.asc. A PPA whose held key does not verify is refused without trying trusted.gpg.d.

Real file: I ran add-apt-repository -n ppa:freecad-maintainers/freecad-stable in a fresh ubuntu:24.04 container. The parser read the key block from the file it wrote, and the block's fingerprint is 9F0E375806520BD65BC61B18A728AE60A790F0EB, the PPA's published key.

For evidence-bearing changes:

  • Observed, derived, and inferred claims remain distinguishable.
  • Artifact identity, source provenance, and failed attempts remain preserved.
  • Unsupported, incomplete, unavailable, or uncertain outcomes remain visible.

Validation performed

  • These passed with no lint diagnostics in touched files: npm run typecheck, lint, lint:typed, format:check, build:cached then knip, jscpd, docs:check, docs:build, verify:test-discovery and verify:architecture-guards.
  • Desktop tests on macOS: 42 files passed and 2 skipped; 337 tests passed and 18 skipped.
  • Gap: no full capture of a PPA-installed app ran with this change yet. The overnight FreeCAD run uses a keyring file.

Compatibility, safety, and release

  • Breaking changes or migration steps: none; captures that recorded no inline key are unchanged.
  • Real Hopper/Ghidra, browser, or OS coverage: Ubuntu 24.04 add-apt-repository output; gpgv from GnuPG 2.4.
  • Package or release metadata impact: none.
  • Security, privacy, process, or containment review: the key is public and verified before it is trusted. Only the entry's own key is tried, as in apt.

Author readiness

Human owner: @earakely-scale

  • I reviewed the final diff and relevant existing code, understand the change and its edge cases, and take responsibility for the complete PR, including AI-assisted work.
  • I checked the evidence above, confirmed it supports the current change, and recorded meaningful validation gaps.
  • I declare this PR ready for initial maintainer review.

Before merge

  • This PR addresses a concrete problem or an agreed enhancement.
  • Material scope and authority questions are resolved, and any required maintainer scope decision covers the final diff.
  • The PR has one focused outcome and the title follows type(scope): outcome.
  • Related issue is linked, or the reason for not linking one is stated above.
  • Tests cover changed observable behavior and meaningful failure paths.
  • Owning docs, contracts, and generated metadata are updated where needed.
  • User-visible CLI/MCP changes include representative output.
  • I checked the final diff for secrets, unrelated cleanup, and unsupported claims.

🤖 Generated with Claude Code

@greptile-apps

greptile-apps Bot commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; no blocking issue was found.

Summary

This PR lets desktop capture read and verify public keys stored inside a deb822 Signed-By field.

  • Desktop captures can use keys stored inside PPA source files.

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]
Loading

Reviews (4) · Last reviewed commit: "Merge main into feat/desktop-ppa-inline-..." · Reviewed by Greptile

@earakely-scale
earakely-scale marked this pull request as ready for review November 5, 2026 16:10
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ⚠️ Failed 2026-11-05T16:10:19.164657Z
We couldn’t complete this review. Comment @codex review to try again.
a50d789 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Repo admins can enable using credits for code reviews in their settings.

earakely-scale and others added 2 commits November 5, 2026 19:49
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]>
@earakely-scale
earakely-scale force-pushed the feat/desktop-ppa-inline-keys branch from 26ccec5 to 8df5d34 Compare November 6, 2026 04:31
@earakely-scale

Copy link
Copy Markdown
Contributor Author

@morluto this one is ready for review, and it merges cleanly into main. All checks pass. Greptile scored 5/5 on its last review, 26ccec5b9; the branch was later replayed onto main as two commits, 7d761ab4e and 8df5d3459, with the same change.

It lets capture-desktop-application record a PPA added the standard way. On Ubuntu 24.04, add-apt-repository writes the PPA's armored key into the deb822 source's Signed-By field, which REA used to refuse.

@morluto
morluto merged commit f8356f3 into morluto:main Nov 6, 2026
45 of 46 checks passed
@morluto morluto added bug Something isn't working area: runtime Process capture and runtime observation labels Nov 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: runtime Process capture and runtime observation bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants