Skip to content

Serve a Moshpit name from a c0mpute site - #600

Merged
ralyodio merged 1 commit into
mainfrom
feat/name-c0mpute-site
Nov 9, 2026
Merged

ralyodio merged 1 commit into
mainfrom
feat/name-c0mpute-site

Conversation

@ralyodio

@ralyodio ralyodio commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

What

A Moshpit name can now point at a static site on c0mpute (p2p hosting, three self-healing copies, served by every gateway at /s/<site_id>/):

c0mpute hosting publish ./public --name blog     # prints the 20-hex site id
moshcode name c0mpute blue.eggs <site_id>        # or: off

API: PUT /api/moshpit/tlds/:tld/names/c0mpute { label, site } (bearer key, holder or tenant).

How it reaches a browser

c0mpute gateways speak plain HTTP on :7777 and hold no Moshpit certificate, so answering A/AAAA with gateway addresses would give https://blue.eggs a refused connection. Instead the name resolves to a c0mpute edge (profullstack/moshpit-proxy#31, bin/moshpit-c0mpute-edge.ts) that holds a Moshpit CA leaf for the name and fetches /s/<site_id>/ from any healthy gateway with failover.

  • moshpit_names.c0mpute_site (migration 028, sqlite + pg).
  • When MOSHPIT_C0MPUTE_EDGE (a hostname) is set, /api/moshpit/resolve answers it as the name's target, plus c0mpute: <site_id>. Every resolver already deployed (bridge, dns.moshcode.sh DoH, TronBrowser) follows a hostname target, so no resolver change. Unset = nothing resolves differently (safe to merge before an edge exists).
  • Setting a target clears the site; a sale (handOverName) or a lapsed lease clears it too, and a lapsed-but-unswept lease never serves it.
  • CA: an account in MOSHPIT_C0MPUTE_EDGE_USERS may get a leaf for a name only while its holder has it pointed at c0mpute. The pin is published under the holder. Unset = only holders, as before.
  • Docs: apps/pwa/docs/moshpit-ca.md, CLI help/README table regenerated.

No DNS on any user machine is touched; the CLI is one registry write.

Tests

  • apps/pwa/test/moshpit-c0mpute.test.mjs (real libSQL + in-memory CA): validation, holder-only, resolve with/without edge, target clears site, edge issuance allowed only while the site is set and only for edge accounts.
  • test/name-c0mpute.test.mjs: CLI request shape, off, bad input never sent, auth and registry errors, name dispatch + --json.
  • Full suite locally: root node --test 3702 tests, 3698 pass, 0 fail (rest skipped); apps/pwa 828/828.

🤖 Generated with Claude Code

A name may now point at a static site on the c0mpute network:

  moshcode name c0mpute blue.eggs <site_id>
  PUT /api/moshpit/tlds/:tld/names/c0mpute { label, site }

Registry: new moshpit_names.c0mpute_site (migration 028, both dialects).
When MOSHPIT_C0MPUTE_EDGE names the edge's hostname, /api/moshpit/resolve
answers that hostname as the name's target (and the site id as `c0mpute`),
so the bridge, dns.moshcode.sh and TronBrowser reach the edge with no
change. With it unset nothing resolves differently. Setting a target
clears the site; a sale or a lapsed lease clears it too.

CA: an account in MOSHPIT_C0MPUTE_EDGE_USERS may be issued a leaf for a
name only while its holder has it pointed at c0mpute; the pin is published
under the holder. The edge itself is profullstack/moshpit-proxy
bin/moshpit-c0mpute-edge.ts.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Nov 9, 2026

Copy link
Copy Markdown

ThreatCrush Security Scan

50 finding(s) in the 13 file(s) this pull request changes.

MEDIUM: 50

Severity Rule Location
MEDIUM sql-template-interpolation apps/pwa/src/lib/moshpit-certs.mjs:56
MEDIUM sql-template-interpolation apps/pwa/src/lib/moshpit-certs.mjs:117
MEDIUM sql-template-interpolation apps/pwa/src/moshpit.mjs:140
MEDIUM sql-template-interpolation apps/pwa/src/moshpit.mjs:154
MEDIUM sql-template-interpolation apps/pwa/src/moshpit.mjs:180
MEDIUM sql-template-interpolation apps/pwa/src/moshpit.mjs:374
MEDIUM sql-template-interpolation apps/pwa/src/moshpit.mjs:378
MEDIUM sql-template-interpolation apps/pwa/src/moshpit.mjs:423
MEDIUM sql-template-interpolation apps/pwa/src/moshpit.mjs:707
MEDIUM sql-template-interpolation apps/pwa/src/moshpit.mjs:909
MEDIUM sql-template-interpolation apps/pwa/src/moshpit.mjs:911
MEDIUM sql-template-interpolation apps/pwa/src/moshpit.mjs:970
MEDIUM sql-template-interpolation apps/pwa/src/moshpit.mjs:1016
MEDIUM sql-template-interpolation apps/pwa/src/moshpit.mjs:1086
MEDIUM sql-template-interpolation apps/pwa/src/moshpit.mjs:1189
MEDIUM sql-template-interpolation apps/pwa/src/moshpit.mjs:1212
MEDIUM sql-template-interpolation apps/pwa/src/moshpit.mjs:1234
MEDIUM sql-template-interpolation apps/pwa/src/moshpit.mjs:1433
MEDIUM sql-template-interpolation apps/pwa/src/moshpit.mjs:1583
MEDIUM sql-template-interpolation apps/pwa/src/moshpit.mjs:1732
MEDIUM sql-template-interpolation apps/pwa/src/moshpit.mjs:1738
MEDIUM sql-template-interpolation apps/pwa/src/moshpit.mjs:1785
MEDIUM sql-template-interpolation apps/pwa/src/moshpit.mjs:1834
MEDIUM sql-template-interpolation apps/pwa/src/moshpit.mjs:1865
MEDIUM sql-template-interpolation apps/pwa/src/moshpit.mjs:1965
MEDIUM sql-template-interpolation apps/pwa/src/moshpit.mjs:2084
MEDIUM sql-template-interpolation apps/pwa/src/moshpit.mjs:2096
MEDIUM sql-template-interpolation apps/pwa/src/moshpit.mjs:2108
MEDIUM sql-template-interpolation apps/pwa/src/moshpit.mjs:2142
MEDIUM sql-template-interpolation apps/pwa/src/moshpit.mjs:2340
MEDIUM sql-template-interpolation apps/pwa/src/moshpit.mjs:2353
MEDIUM sql-template-interpolation apps/pwa/src/moshpit.mjs:2379
MEDIUM sql-template-interpolation apps/pwa/src/moshpit.mjs:2385
MEDIUM sql-template-interpolation apps/pwa/src/moshpit.mjs:2389
MEDIUM sql-template-interpolation apps/pwa/src/moshpit.mjs:2399
MEDIUM sql-template-interpolation apps/pwa/src/moshpit.mjs:2530
MEDIUM sql-template-interpolation apps/pwa/src/moshpit.mjs:2682
MEDIUM sql-template-interpolation apps/pwa/src/moshpit.mjs:2690
MEDIUM sql-template-interpolation apps/pwa/src/moshpit.mjs:2698
MEDIUM sql-template-interpolation apps/pwa/src/moshpit.mjs:2728
MEDIUM sql-template-interpolation apps/pwa/src/moshpit.mjs:2867
MEDIUM js-unescaped-html-sink apps/pwa/src/routes/moshpit.mjs:3014
MEDIUM sql-string-concatenation src/cli-schema.mjs:271
MEDIUM sql-string-concatenation src/cli-schema.mjs:386
MEDIUM sql-string-concatenation src/cli-schema.mjs:835
MEDIUM sql-string-concatenation src/cli-schema.mjs:868
MEDIUM sql-string-concatenation src/cli-schema.mjs:975
MEDIUM sql-string-concatenation src/cli-schema.mjs:1338
MEDIUM sql-string-concatenation src/cli-schema.mjs:1875
MEDIUM sql-string-concatenation src/cli-schema.mjs:1893
64 pre-existing finding(s) elsewhere in the repository — **HIGH/CRITICAL**: 8 | **MEDIUM**: 37 | **LOW**: 19

Not introduced by this pull request. The full set is in the Security tab.

Severity Rule Location
HIGH js-ssrf-outbound-request apps/pwa/public/sw.js:76
HIGH tls-verification-disabled apps/pwa/src/lib/moshpit-gateway.mjs:299
HIGH sh-remote-script-execution install.sh:87
HIGH sh-remote-script-execution install.sh:91
HIGH sh-remote-script-execution install.sh:259
HIGH sh-remote-script-execution install.sh:270
HIGH sh-remote-script-execution install.sh:276
HIGH tls-verification-disabled src/dns.mjs:823
MEDIUM js-unescaped-html-sink apps/pwa/public/herd/herd.js:117
MEDIUM sql-template-interpolation apps/pwa/src/routes/mcp.mjs:87
MEDIUM js-dynamic-code-execution apps/pwa/test/apikey-mask.test.mjs:129
MEDIUM sql-template-interpolation apps/pwa/test/credits-webhook-event-match.test.mjs:121
MEDIUM sql-template-interpolation apps/pwa/test/credits-webhook-event-match.test.mjs:141
MEDIUM sql-template-interpolation apps/pwa/test/moshpit-terms.test.mjs:207
MEDIUM redos-nested-quantifier src/clients.mjs:29
MEDIUM js-uninitialized-buffer src/pty.mjs:138
MEDIUM js-timing-unsafe-mac-compare src/settings-sync.mjs:366
MEDIUM sql-string-concatenation src/transcript.mjs:512
MEDIUM insecure-temp-file test/dns-disable-restore.test.mjs:93
MEDIUM insecure-temp-file test/dns-disable-restore.test.mjs:314

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

Snippets are redacted; ThreatCrush never prints matched credential material.

@ralyodio
ralyodio merged commit 9ec3578 into main Nov 9, 2026
7 checks passed
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