Repository navigation
Conversation
A card is the whole contract between two installs: endpoint, token, model, window, caps and a measured spec. The donor runs a small proxy beside its engine that enforces the window, the concurrency, token and body caps, and keeps the token out of the renderer; the renter gets an ordinary chat-completions provider that the router and the outbound guard treat like managed remote compute. - shared/donation.ts: `tensorfold-donation/1` schema, parsing and the provider row a card becomes; an endpoint may carry one path segment, which a relay uses to address individual cards - electron/donation-node-main.ts: the donor proxy, bundled separately - electron/main/host/donation*: private card storage, import probe, supervisor that runs the proxy inside the app (a packaged Electron app cannot spawn itself as Node) - DonationPanel, CommunityModels, onboarding and Models entry points - docs/donation-poc.md: what the POC does and does not promise
The in-app donor binds loopback only, so today a renter needs an SSH or a third-party tunnel. This adds a relay the donor dials out to: the card carries one HTTPS base URL and nothing changes on the renter side. - relay/: a Worker with one Durable Object per card id, a JSON frame protocol, donor attach over a WebSocket (the donor key travels as the second subprotocol), bounded request and response sizes, and tests that run on the real Workers runtime - relay is not the security boundary: it forwards the renter's authorization header and the donor proxy still enforces token, window and caps - electron/donation-relay-client.ts and scripts/donation-relay-attach.mjs: the donor dialer, which replays frames against the local proxy - docs/donation-relay.md: protocol, limits and what is still missing; docs/donation-lending-options.md: addressing and hardware-only options
6 tasks done
ashhart
requested changes
Oct 26, 2026
ashhart
left a comment
Owner
There was a problem hiding this comment.
Thanks @zweck. The design is careful: nothing is on by default, the lender listens on loopback only, tokens compare in constant time, windows are rechecked at forward time, and borrowed machines are treated as external providers. Security problems to fix before we can take it:
- The donor trusted any path the relay sent (
donation-relay-client.tsappends it to the local address unchecked), so a compromised relay could reach any route or method on the lender's node, and a path like1/v1/modelschanges the port (6000 becomes 60001). Please allow-list the lent routes with their methods (/healthGET,/v1/modelsGET,/v1/chat/completionsPOST,/v1/responsesPOST) and refuse everything else, with a test. - Anyone who learns a card id before its donor attaches can claim it permanently (
relay/src/donor.ts) and receive renters' tokens and prompts. Please bind the donor's key at card creation and expire stored claims with the card's window. - The borrower's token is stored as plain JSON (
donation/store.ts) while the app keeps other credentials in its encrypted store; please use that. - Forward only
content-typeandacceptheaders, and allow-list body fields: on/v1/responsesforcestore: falseand dropprevious_response_id, so renters don't fill the lender's response store. - Remove the
TF_DONATION_DEBUGtoken-hash prefix output, and consider authenticating/health(it shows the hardware spec). - Pin the relay's
viteand@cloudflare/vitest-pluginto releases at least a week old instead of^ranges on days-old versions. - Product text: the onboarding line implies a public community directory that doesn't exist, the lending panel says renters can use https while the host accepts loopback only, expired cards stay in the provider list, and the zh-Hant reformat (about 500 lines) is unrelated.
Both commits also use a personal email; please switch to your GitHub noreply address.
Owner
|
Thank you for exploring this. We're going to decline it, mainly on security and scope:
|
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.
Two commits, each reviewable on its own.
1.
donation: lend a machine's inference through a cardA card is the whole contract between two people's installs: endpoint, token, model, window, caps and a
measured spec. The donor runs a proxy beside its engine that enforces the window and the concurrency,
token and body caps, keeps the token out of the renderer, and writes receipts; the renter gets an
ordinary chat-completions provider that the router and the outbound guard treat exactly like managed
remote compute. No payment and no proof of computation — that is stated in the UI and in
app/docs/donation-poc.md.2.
relay: give a lent card a public address without inbound portsThe in-app donor binds loopback only, so until now a renter needed an SSH or third-party tunnel. The
relay inverts that: the donor dials out to
wss://<relay>/donor/<card-id>, and the card carrieshttps://<relay>/<card-id>instead. The relay is deliberately not the security boundary — it forwardsthe renter's
authorizationheader untouched and the donor proxy still decides.relay/is a Workerwith one Durable Object per card id; a card endpoint may now carry one path segment so it can address
a card on a shared host.
Testing
app:npm run verify→ 854/857. The three failures arescripts/mobile-*-dependency.test.mjs,which need
npm ciinsideapp/mobile; they fail identically onmain.relay:cd relay && npm install && npm test→ 9/9 inside the Workers runtime (workerd via@cloudflare/vitest-plugin): health, 503 without a donor, 404 for unlent routes, 413 for anoversized body, a streamed reply, a donor refusal passed through untouched, one donor per card id,
a wrong donor key refused, and the card-id path routing.
relay path driven from the packaged app — card import, picker, streamed reply, plus 401 / 503 / 413
and a refused second donor key.
Deliberate limits
the obvious follow-up and is not in this PR.
start, reconnect, relay URL in the card) is the next slice. The dialer and CLI in this PR are what
that slice will call.
takes strangers' traffic.
Coordination
atc overlap --jsoncould not be run:atcis not installed in this environment.changes, and this is none of those.
The two commits are stacked (the relay uses the card schema from the first). If you would rather review
them as separate PRs, the first commit can stand alone as its own PR and this one can follow it.