Repository navigation
V23: Refuse to serve an unprotected agent on a public interface - #697
Merged
Merged
Conversation
The built node-server (and the Docker image, which binds 0.0.0.0) now exits with LOUSHO_SERVER_UNPROTECTED when it would listen on a non-loopback host with no route auth (no LOUSHO_API_TOKEN, build token or auth.ts). LOUSHO_ALLOW_PUBLIC=1 keeps the old open-with-warning behaviour. Loopback hosts are unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
LinuxDevil
force-pushed
the
v23-refuse-public-unprotected
branch
from
October 20, 2026 07:18
9e9aa14 to
2a26eb2
Compare
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Fixes audit finding SEC-2 (Vercel competitor audit, 2026-10-19).
Behavior change: the built node-server (and so the Docker image, which sets
HOST=0.0.0.0) now refuses to start on a non-loopback host when no route auth is configured (noLOUSHO_API_TOKEN, no build token, noauth.ts). It exits non-zero withLOUSHO_SERVER_UNPROTECTED. Opt out withLOUSHO_ALLOW_PUBLIC=1, which keeps the old open-with-warning behaviour. Loopback hosts (localhost,127.x.x.x,::1) are unchanged.What was wrong
HOST=0.0.0.0 LOUSHO_API_TOKEN= node dist/server.jsonly loggedwarning: no LOUSHO_API_TOKEN set, so anyone who can reach 0.0.0.0 can use this agent.and then servedPOST /chatto anyone. The Docker image binds 0.0.0.0 by default, so a docker-on-VPS deploy without a token was wide open.What changed
src/deploy/nodeServer.ts: newcheckServerExposure(host, authenticated, env). It uses the sameauthenticatedflag thatcreateDeployedServer()already derives from the token, build token or auth list (auth.ts), which is also what gates channel routes since V1: Gate unverified channel routes behind LOUSHO_API_TOKEN in the built server #676. Loopback meanslocalhost,::1/[::1]or 127.0.0.0/8. With no auth on any other host it throwsSDKErrorLOUSHO_SERVER_UNPROTECTEDunlessLOUSHO_ALLOW_PUBLICis1/true; in that case it returns the existing warning text.server.ts(src/deploy/adapters/node-server.ts): calls the check beforelisten. A refusal goes through the existingfailed to startpath and exits with code 1. The hard-codedLOOPBACKlist is gone.runtime.tsexports the check.LOUSHO_SERVER_UNPROTECTEDadded tosrc/utils/errorCodes.tsand todocs/errors.md(heading plus the index row).describe()now printsdocker run -p 3000:3000 -e LOUSHO_API_TOKEN=<token> lousho-agent.deployment.md(Auth, node-server and docker sections, plus the targets table now pass the token),hostinger-vps.md,upgrading.md(row in "HTTP routes, servers and channels" with opt-outLOUSHO_ALLOW_PUBLIC=1). Regenerated llms files.examples/hostinger-deployalready requires and passesLOUSHO_API_TOKEN, so it is unchanged.Tests
src/deploy/nodeServerPublic.test.ts(16 cases):0.0.0.0,::, a LAN IP or a hostname with no auth is rejected withLOUSHO_SERVER_UNPROTECTED, and the message names all four fixes.LOUSHO_API_TOKENis set, or when there is an auth list and no token.LOUSHO_ALLOW_PUBLIC=1/truereturns the warning.=0is not an opt-out.127.0.0.1,127.1.2.3,localhost,::1and[::1]start with no auth and no warning.node-server.test.ts(end to end against the builtdist/server.js):--host=0.0.0.0with no token exits non-zero, and stderr containsLOUSHO_SERVER_UNPROTECTED.LOUSHO_ALLOW_PUBLIC=1it starts and prints the warning.--hostbinding test now sets a token.docker.docker.test.tspasses-e LOUSHO_ALLOW_PUBLIC=1, because those tests call/chatwithout a token.docker.test.tscovers the newdescribe()string.npx tsc --noEmit,npm run typecheck:testsandnpm run lintall clean.npm run test:coveragepassed 413 files / 6106 tests, andnpm run fallowexited 0.npm run test:dockeragainst a real daemon passed 2 tests.docs:llms:checkis clean.Changelog: The built node-server and Docker image refuse to start on a non-loopback host with no auth (
LOUSHO_SERVER_UNPROTECTED); setLOUSHO_API_TOKEN, addauth.ts, bind to 127.0.0.1, or setLOUSHO_ALLOW_PUBLIC=1.🤖 Generated with Claude Code