Pit toggle: trust each pit name's certificate on first https use, against the registry pin - #104
Merged
Merged
Conversation
…inst the registry pin https://chovy.hacker/ on the pit route showed an invalid certificate: the resolver reaches the real origin, which serves a self-signed leaf for its own name, and nothing told the browser to trust it. moshcode dns trust <name> does that for the system store with root; the helper now does the no-root browser equivalent per name. On the first HTTPS CONNECT it fetches the served certificate, computes the RFC 7469 pin of its key (small DER walker, no deps), checks it against the registry's published pins, refuses CA:TRUE, and imports the leaf as a peer (certutil -t P,,) into ~/.pki/nssdb under the launcher's nickname, all before the SOCKS reply so the browser's handshake already finds it trusted. Linux + certutil only; /pit/start reports trust availability and the sidebar says which case applies. Proven with tstclnt: 200 OK with the imported DB, SEC_ERROR_UNKNOWN_ISSUER with an empty one. Helper 3.4.0. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
ThreatCrush Security Scan54 finding(s) HIGH/CRITICAL: 2 | MEDIUM: 32 | LOW: 20
…and 4 more. Full results in the Security tab. Snippets are redacted; ThreatCrush never prints matched credential material. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
https://chovy.hacker/on the 🤘 Pit route showed an invalid certificate. The pit resolver connects to the real origin, which serves a self-signed leaf for its own name (no public CA issues outside the ICANN root), and nothing had told the browser to trust it.moshcode dns trust <name>solves this for the system store, with root. This PR does the no-root equivalent for the browser, automatically, per name.How
On the first HTTPS
CONNECTfor a pit name, before replying to the browser, the helper:/api/moshpit/pins?name=); the key must match one, and the certificate must not beCA:TRUE(same refusalmoshcode dns trustmakes: a CA trusted directly could vouch for any name);~/.tronbrowser/pit-certs/moshpit-<name>.crtand imports it into~/.pki/nssdbas a peer (certutil -t P,,) under the nicknamemoshpit <name>, the same one the launcher's trust sync uses, so neither imports the other's work twice.Because it happens before the SOCKS reply, the browser's TLS handshake that follows already finds the leaf trusted. Once per name per pit run; refusals leave the browser's own warning in place. A 404 from the pins endpoint means "no pin", not an outage.
Linux only (Chromium on macOS reads the keychain) and needs
certutil;/pit/statusand/pit/startnow reporttrust: {available, why}and the sidebar's "Pit is on" line says which case applies (trusted per name / install libnss3-tools / run moshcode dns enable). Helper 3.4.0, matched in the launcher. Doc updated.Verified (scratch NSS database, scratch cert dir, scratch ports)
v6k99jmaVZC/RqHH5nBEXcCFgqKErHQTsn2umcBHPzQ=, CA:FALSE. Matchesopenssland the registry's published pin.https://chovy.hacker/through the pit → the helper log shows the import;certutil -Lshowsmoshpit chovy.hacker P,,;certutil -V -u Vsays valid.tstclnt(NSS's own TLS client) against the origin with the scratch DB: handshake completes,HTTP/1.1 200 OK. Same connection with an empty DB:SEC_ERROR_UNKNOWN_ISSUER. The import is what makes it pass.https://mosh.eggs/(registry publishes no pin): logged "publishes no pin", nothing imported.pnpm lintclean, extension tests 30/30, helper compiles, launchersh -nok.Not clicked through in a live TronBrowser (no browser here). One caveat for that: if a name was already opened and rejected earlier in the session, Chromium may keep the verdict cached; reopen the tab or restart.
🤖 Generated with Claude Code