Repository navigation
fix(app): a published build must not go looking for localhost - #27
Merged
Merged
Conversation
Opening the deployed instrument raised Chrome's local-network prompt -- "wwstorymode.github.io wants to access other apps and services on this device" -- because the page probes http://localhost:8000/health at boot to fill the model list. I predicted that fetch would fail honestly. It does, eventually, but first it asks every visitor for a permission that sounds alarming, has nothing to do with what they came for, and whose answer was going to be "there is no service" either way. Asking is worse than the failure. A build served from the machine the service runs on -- a dev server, or a file:// page -- still probes exactly as before; that is the instrument in normal use. A build served from the open web stays quiet unless someone asks with ?service, which puts the prompt after a question the visitor actually asked rather than before one. Both routes to the service are closed, not just the boot probe. post() refuses before the fetch, so pressing Generate on a published copy explains itself instead of requesting permission to fail -- it is the single path drafting, baking and the triptych all go through. ?service takes an optional port, digits only. It decides what the page connects to, so an arbitrary address there would be a link someone else could aim -- the same reasoning as sessionUrl(). The hint now distinguishes the two cases: a local build says the service is not running and gives the command to start it; a published one says it has no service behind it, that importing works with nothing loaded, and how to connect if you do have the stack. The landing page says the same. Verified on the built bundle served under a /BodyPrompt prefix: no localhost reference is reachable at boot. npm test 78 passing; tsc and vite build clean. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014yJSPiRjB5WvTH2x4LB8V6
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.
Opening the deployed instrument raises Chrome's local-network prompt:
Because the page probes
http://localhost:8000/healthat boot to fill the model list, and a public origin reaching a private address is now gated behind that dialogue.Why this is worse than the failure it was guarding
I predicted that fetch would "fail honestly." It does — eventually. But first it asks every visitor for a permission that sounds alarming, has nothing to do with what they came for, and whose answer was going to be "there is no service" either way.
Asking is worse than failing. A page on the open web should not reach for something on your machine unprompted.
The fix
Local builds are unchanged. Served from the machine the service runs on — a dev server, or a
file://page — it probes exactly as before. That is the instrument in normal use.Published builds stay quiet unless someone asks with
?service. That puts the browser prompt after a question the visitor actually asked, rather than before one they didn't.Both routes are closed, not just the boot probe.
post()refuses before the fetch, so pressing Generate on a published copy explains itself instead of requesting permission to fail. It is the single path drafting, baking and the triptych all go through.?servicetakes an optional port, digits only. It decides what the page connects to, so an arbitrary address there would be a link somebody else could aim — the same reasoning that constrainssessionUrl().What a visitor sees now
The landing page says the same, and says why it doesn't look.
Verified
The built bundle, served under a real
/BodyPromptprefix: no localhost reference is reachable at boot, and the guard is present in the shipped JS.npm test78 passing,tsc --noEmitandvite buildclean.🤖 Generated with Claude Code
https://claude.ai/code/session_014yJSPiRjB5WvTH2x4LB8V6