Skip to content

Pit https on Flatpak engines: pass the trusted names' pins at launch; write every NSS database a Chromium could open - #106

Merged
ralyodio merged 1 commit into
mainfrom
fix/pit-trust-flatpak-pins
Sep 16, 2026
Merged

ralyodio merged 1 commit into
mainfrom
fix/pit-trust-flatpak-pins

Conversation

@ralyodio

Copy link
Copy Markdown
Contributor

What

https://chovy.hacker/ still warned on bonita after v3.12.1, with the leaf present in every NSS database. This makes it work on Flatpak engines by a different route, and fixes database selection for everyone.

What bonita showed (Flathub ungoogled-chromium 152.0.7977.82-1)

  • strace: Chromium opens ~/.pki/nssdb/cert9.db inside the sandbox, i.e. the persisted database, which held the leaf as P,, and later CP,,.
  • Headless runs with --no-sandbox, --disable-features=NetworkServiceSandbox, --single-process, --no-zygote: all still "Privacy error".
  • Net log: net_error -202, ERROR: No matching issuer found, cert_status 4. So TrustStoreNSS returned Unspecified for a certificate NSS had trust records for.
  • The system store held no stale copy (only the Local CA); p11-kit exported nothing for the name.
  • --ignore-certificate-errors-spki-list=<registry pin> → page loads. Chromium's own per-key allowance works where NSS trust does not.
  • In a Debian container, the same portable ungoogled-chromium 152 accepts the leaf from NSS with P,, and CP,,, with and without p11-kit-trust loaded, with and without the leaf in the system store. The Flatpak difference remains unexplained; this PR routes around it.

Fix

  • Helper (3.4.2): every accepted pin is also written to ~/.tronbrowser/pit-certs/pins.txt (name pin, once per pair). /pit/start reports trust.engine and trust.relaunch (true for Flatpak).
  • Launcher: tells the helper the engine kind (TRON_PIT_ENGINE). For a Flatpak engine it reads pins.txt and passes --ignore-certificate-errors-spki-list=<pins> at launch, only when at least one pin exists, because that switch is on Chromium's bad-flags list and shows the "unsupported command-line flag" bar at start. Junk lines are rejected, pins deduped.
  • Sidebar: on a Flatpak engine the "Pit is on" line says a first https visit records the key and loads after the next restart.
  • Database selection (both helper and launcher sync): Chromium opens one of two databases per home, ~/.pki/nssdb or since M146 $XDG_DATA_HOME/pki/nssdb, and a Flatpak's are ~/.var/app/<app>/.pki/nssdb and .../data/pki/nssdb. Write every candidate that exists; create the legacy one only when none does, so a newer Chromium is never flipped onto a fresh empty store.
  • Doc updated with the findings and the two real fixes for later: a registry-run Moshpit CA, or shipping the portable ungoogled-chromium as TronBrowser's own engine (it honours NSS).

Verified

  • Helper under a fake $HOME with a Flatpak app dir holding both .pki/nssdb and data/pki/nssdb, an XDG home database, a Firefox one, engine flatpak: https through the pit → leaf in the three Chromium candidates, Firefox untouched, legacy ~/.pki not created (XDG existed), pins.txt has one line, second visit adds nothing, trust: {engine: flatpak, relaunch: true}.
  • Launcher pit_spki_flag: builds --ignore-certificate-errors-spki-list=<a>,<b> from a file with duplicates and junk lines; prints nothing for empty or missing files. sync_moshpit_trust with a Flatpak engine writes only the existing databases.
  • pnpm lint clean, extension tests 30/30, helper compiles, launcher sh -n ok.

Trade-offs

On a Flatpak engine a name's first https visit needs one relaunch, and machines with pins see Chromium's one-line flag bar at start. Native engines take the NSS path and get neither.

🤖 Generated with Claude Code

… and write every NSS database a Chromium could open

Bonita, Flathub ungoogled-chromium 152: the leaf sat in the very database strace showed Chromium opening (peer and anchor trust both tried; single-process, no-sandbox and NetworkServiceSandbox off made no difference) and the net log still said No matching issuer found. What that build honours is --ignore-certificate-errors-spki-list, verified headless on the machine. The helper now records every pin it accepts (a key the registry vouches for, for that name) in ~/.tronbrowser/pit-certs/pins.txt, and for a Flatpak engine the launcher passes those pins at start; the sidebar says a first visit needs one relaunch there. Chromium shows its unsupported-flag bar when the switch is present, so it is only passed with at least one pin.

Also: Chromium opens one of two NSS databases per home, ~/.pki/nssdb or since M146 XDG_DATA_HOME/pki/nssdb, and which one a build picks has changed between versions; a Flatpak's are ~/.var/app/<app>/.pki/nssdb and .../data/pki/nssdb. Helper and launcher sync now write every candidate that exists and create the legacy one only when none does. Helper 3.4.2.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown

ThreatCrush Security Scan

54 finding(s)

HIGH/CRITICAL: 2 | MEDIUM: 32 | LOW: 20

Severity Rule Location
HIGH py-ssrf-outbound-request apps/desktop/launcher/tron-tor-helper:303
HIGH py-ssrf-outbound-request apps/desktop/launcher/tron-tor-helper:439
MEDIUM js-open-redirect apps/desktop/extensions/ai-sidebar/install-helper.js:156
MEDIUM js-unescaped-html-sink apps/desktop/extensions/ai-sidebar/media.js:34
MEDIUM js-unescaped-html-sink apps/desktop/extensions/ai-sidebar/media.js:57
MEDIUM js-unescaped-html-sink apps/desktop/extensions/ai-sidebar/newtab.js:237
MEDIUM js-unescaped-html-sink apps/desktop/extensions/ai-sidebar/newtab.js:266
MEDIUM js-unescaped-html-sink apps/desktop/extensions/ai-sidebar/newtab.js:336
MEDIUM js-unescaped-html-sink apps/desktop/extensions/ai-sidebar/options.js:305
MEDIUM js-unescaped-html-sink apps/desktop/extensions/ai-sidebar/sidepanel.js:78
MEDIUM js-unescaped-html-sink apps/desktop/extensions/ai-sidebar/sidepanel.js:166
MEDIUM sh-remote-script-execution apps/desktop/launcher/tronbrowser:122
MEDIUM sh-remote-script-execution apps/desktop/launcher/tronbrowser:444
MEDIUM js-unescaped-html-sink apps/extensions/public/store.js:77
MEDIUM js-unescaped-html-sink apps/extensions/public/store.js:227
MEDIUM js-unescaped-html-sink apps/extensions/public/store.js:569
MEDIUM js-unescaped-html-sink apps/web/public/app.js:29
MEDIUM js-unescaped-html-sink apps/web/public/dns.js:54
MEDIUM sh-remote-script-execution apps/web/public/install.sh:161
MEDIUM sh-remote-script-execution apps/web/public/install.sh:166
MEDIUM sh-remote-script-execution apps/web/public/install.sh:279
MEDIUM sh-remote-script-execution apps/web/public/install.sh:297
MEDIUM sh-remote-script-execution apps/web/public/install.sh:704
MEDIUM sh-remote-script-execution apps/web/public/install.sh:985
MEDIUM js-unescaped-html-sink apps/web/public/settings.js:96
MEDIUM js-unescaped-html-sink apps/web/public/settings.js:168
MEDIUM js-dynamic-code-execution packages/sdk/src/mcp/tools.ts:80
MEDIUM js-dynamic-code-execution packages/sdk/src/mcp/tools.ts:92
MEDIUM js-dynamic-code-execution packages/sdk/src/mcp/tools.ts:103
MEDIUM js-dynamic-code-execution packages/sdk/src/page.ts:65
MEDIUM js-dynamic-code-execution packages/sdk/src/page.ts:70
MEDIUM sql-template-interpolation services/api/src/store/db.ts:116
MEDIUM js-dynamic-code-execution services/api/src/store/scanner.ts:44
MEDIUM sh-predictable-temp-path start.sh:25
LOW js-dynamic-code-execution apps/desktop/extensions/ai-sidebar/pit-proxy.test.js:8
LOW js-dynamic-code-execution packages/agent-runtime/src/analyze/form-script.test.ts:6
LOW js-unescaped-html-sink packages/agent-runtime/src/analyze/form-script.test.ts:26
LOW js-unescaped-html-sink packages/agent-runtime/src/analyze/form-script.test.ts:49
LOW js-dynamic-code-execution packages/browser-core/src/automation/extract-script.test.ts:6
LOW js-unescaped-html-sink packages/browser-core/src/automation/extract-script.test.ts:35
LOW js-unescaped-html-sink packages/browser-core/src/automation/extract-script.test.ts:47
LOW js-unescaped-html-sink packages/browser-core/src/automation/extract-script.test.ts:70
LOW js-unescaped-html-sink packages/browser-core/src/automation/extract-script.test.ts:89
LOW js-dynamic-code-execution packages/browser-core/src/automation/snapshot-script.test.ts:11
LOW js-unescaped-html-sink packages/browser-core/src/automation/snapshot-script.test.ts:24
LOW js-unescaped-html-sink packages/browser-core/src/automation/snapshot-script.test.ts:63
LOW js-unescaped-html-sink packages/provenance/src/scan.test.ts:47
LOW js-unescaped-html-sink packages/provenance/src/scan.test.ts:170
LOW js-unescaped-html-sink packages/provenance/src/scan.test.ts:216
LOW js-dynamic-code-execution packages/sdk/src/mcp/automate.test.ts:258

…and 4 more. Full results in the Security tab.

Snippets are redacted; ThreatCrush never prints matched credential material.

@ralyodio
ralyodio merged commit 6cd3f98 into main Sep 16, 2026
8 checks passed
ralyodio added a commit that referenced this pull request Sep 16, 2026
…m, prefer it, drop the pin-flag workaround (#107)

The Flathub ungoogled-chromium ignores NSS user trust (bonita, 152: the leaf sat in the exact database strace showed it opening, every sandbox switch made no difference, net log said No matching issuer found), while the same 152 as a portable build accepts that database. The pin flag from #106 worked but Chromium marks it unsupported at every start. So install.sh now fetches the pinned portable ungoogled-chromium into <launcher dir>/engine on install and upgrade, the launcher prefers it after a --version probe, and https on Moshpit names goes back to the silent per-name NSS import. The helper (3.4.3) reports flatpak-engine so the sidebar points at tron upgrade when a Flatpak is still running. Verified end to end in a container: the real launcher picked the engine, the helper imported the leaf, https://chovy.hacker loaded with no flags.

Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant