Repository navigation
V1: Gate unverified channel routes behind LOUSHO_API_TOKEN in the built server - #676
Merged
Merged
Conversation
…n the built server A channel with no verify of its own (e.g. httpChannel()) was served by the built node-server without the bearer token, even with LOUSHO_API_TOKEN set. Now such a route is guarded by the server's auth like /chat; channels that verify their own requests (platform signatures, webhook secrets, a custom verify) stay reachable without it. createDeployedServer() reports each channel route's guard, and the generated server logs it at start-up. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
LinuxDevil
force-pushed
the
v1-gate-channel-routes
branch
from
October 19, 2026 20:14
1b7d779 to
f9128f7
Compare
This was referenced Oct 19, 2026
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-1 (Vercel competitor audit, 2026-10-19).
What was wrong
lousho build --target=node-serverwithchannels/http.ts=export default httpChannel()andLOUSHO_API_TOKEN=secret:/chatand/sessionswithout the token answered 401, butPOST /channels/httpwithout the token answered 200 and ran the agent.httpChanneltakessessionKeyfrom the body, so anyone could read or continue another user's conversation by guessing a key. The start-up log only saidchannels: http.What changed
createDeployedServer()(src/deploy/nodeServer.ts): when server auth is configured (LOUSHO_API_TOKEN, the build's token, or the agent directory'sauth.ts), a channel route (POST /channels/<name>and/channels/<name>/approvals/:id) whose channel has noverifynow runs that auth first (samerouteAuthas/chat: 401 / 403 /WWW-Authenticate). The check reads headers only, so the channel still gets the untouched body.verify(Slack, Discord, Telegram, GitHub, Teams,webhookChannel({ secret | auth }),httpChannel({ verify }), or any userdefineChannel({ verify })) still authenticates itself and stays reachable without the bearer token, since platform callers can't send it. No new flag was needed: "self-verifying" is simply "hasverify", which already holds for every built-in platform channel (webhookChannelonly setsverifywhen it has a secret/auth). Non-breaking for user channel definitions.DeployedServergainschannelRoutes: { name, auth: 'self-verified' | 'server-auth' | 'open' }[].server.tslogs each channel route's guard at start-up, e.g.channels: slack (verifies its own requests), http (behind the server auth), and warns when any route isopen(no verify, no token).Behavior change: with
LOUSHO_API_TOKEN(orauth.ts) set, channel routes for channels that have noverifynow require the sameAuthorizationas/chat; before, they were open. Callers of such channels must send the bearer token, or the channel must be given averify.Docs (ticket V2 owns docs/deployment.md and docs/channels.md, so not edited here) need a line like: "In the built server, a channel without
verifysits behindLOUSHO_API_TOKEN/auth.tslike/chat; a channel withverify(Slack, Discord, Telegram, GitHub, Teams, a webhook with a secret) authenticates its own callers and is reachable without the token. The start-up log lists each channel route as verifies-its-own-requests, behind-the-server-auth, or open."Tests
src/deploy/nodeServerChannels.test.ts(newroute authblock):httpChannel()withLOUSHO_API_TOKEN→ 401 without / with a wrong token (also on the approvals route), 200 with it (reproduced as 200 before the fix);httpChannel({ verify })reachable without the bearer token and its own verify still rejects;webhookChannel({ secret })401 unsigned, 200 signed without the bearer token; no token → route reportedopenand reachable;channelRoutesasserted in each case.src/deploy/nodeServer.test.ts(auth list now guards a channel without verify),src/deploy/adapters/node-server-dir.test.ts(built server: echo channel 401 without, 200 withauth.ts's token; start-up logchannels: echo (behind the server auth)),src/oauth/signInRoutes.test.ts(sends the bearer token).npx tsc --noEmit,npm run typecheck:tests,npm run lint: pass.npm run test:coverage: 6005 passed; failures onlyscripts/changelogGuard.test.tsandpackages/create-lousho-agent(index + e2e) — the known missing alpha.24 CHANGELOG heading (V0) plus the sub-package's unbuiltdist/in a fresh worktree — and one run of a timing-sensitive MCP test (src/tools/mcp/connect.test.ts, passed on the previous full run).npm run fallow(on coverage written with--coverage.reportOnFailure): exit 0.Changelog: The built node-server now protects channel routes without a
verifywithLOUSHO_API_TOKEN/auth.ts, like/chat; self-verifying channels (Slack, Discord, Telegram, GitHub, Teams, signed webhooks) are unchanged, and the start-up log lists each channel route's guard.🤖 Generated with Claude Code