Bind local Plannotator servers to loopback by default#533
Bind local Plannotator servers to loopback by default#533backnotprop merged 5 commits intobacknotprop:mainfrom
Conversation
|
Running review workflows |
|
Thanks for this PR. Two pieces of feedback: 1. The loopback binding: keep this. Changing all servers to bind to 2. The session token: I don't think this adds real protection. The token is returned by To put it another way: we are protecting the door with a password, but giving out the password at a window right next to the door. I would suggest either removing the token for now and shipping just the loopback change, or redesigning how the token is delivered so it cannot be fetched from an open endpoint. Either way, the loopback binding is the real security improvement here and I would love to get that merged. What do you think? Happy to discuss if you see a threat model where the token helps that I am missing. |
|
I agree loopback is the primary fix. The token was intended as browser-origin CSRF friction, not local-process isolation. Since same-user local processes can still read /api/diff, I’m happy to drop it from this PR and keep the loopback change. If useful, I can follow up separately with Host/Origin validation for browser-side hardening. |
68273a3 to
e78e9d6
Compare
|
Updated the PR to match that direction. I removed the session-token gating changes and kept the loopback binding only. The branch is now rebased onto the latest Re-ran:
|
|
Sorry for the extra round. One more thing we missed. When Plannotator runs inside a Docker container with bridge networking and The old behavior was actually correct for this case. Suggested fix for both export function getServerHostname(): string {
return isRemoteSession() ? "0.0.0.0" : LOOPBACK_HOST;
}Local sessions get the loopback security fix. Remote/Docker sessions keep working on |
|
All right. I didn't expect this. I changed it again! Review please @backnotprop Thank you |
Summary
127.0.0.1instead of listening on all interfaces0.0.0.0so Docker/SSH/devcontainer forwarding still worksWhy this patch
The local Plannotator servers expose review and annotation APIs, including the review agent job launcher. Local sessions should not listen on all interfaces by default.
This patch narrows local sessions to loopback while preserving the existing remote-session behavior needed for Docker bridge networking and remote forwarding workflows.
Testing
/tmp/bun/bin/bun test packages/server/remote.test.ts apps/pi-extension/server/network.test.ts apps/pi-extension/server.test.ts