Skip to content

Commit eaba730

Browse files
committed
security: bind localhost by default in the sandbox helper
tools/demo_sandbox.sh defaulted to 0.0.0.0:8080. The binary itself already defaults to 127.0.0.1 and so do the just recipes, so this was the one host-run path that exposed every interface without being asked. It serves a language model with no authentication, no quota and no rate limit. Exposing that should be a decision someone makes, not one they inherit from a default, so MAINARCH_DEMO_BIND=0.0.0.0:8080 is now the explicit opt-in and the docs say to put a proxy in front when taking it. The container images still bind 0.0.0.0, which is correct inside a container where the real decision is which ports get published.
1 parent ceb1a63 commit eaba730

2 files changed

Lines changed: 13 additions & 2 deletions

File tree

docs/demo-sandbox.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,3 +169,10 @@ Not claimed in any mode:
169169

170170
Keep auth, quota, prompt policy, and abuse controls in front of this process,
171171
not inside it. It is a demonstration surface, not a public serving endpoint.
172+
173+
Everything here binds to `127.0.0.1` by default, deliberately. It serves a
174+
language model with no authentication, no quota and no rate limit, so exposing
175+
it should be something you choose rather than something you inherit. Set
176+
`MAINARCH_DEMO_BIND=0.0.0.0:8080` when you mean it, and put a reverse proxy in
177+
front. The container images bind `0.0.0.0` because that is correct inside a
178+
container, where the decision is which ports you publish.

tools/demo_sandbox.sh

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,11 @@
22
set -euo pipefail
33

44
MODE="${1:-serve}"
5-
BIND="${MAINARCH_DEMO_BIND:-0.0.0.0:8080}"
5+
# Localhost by default. This serves an LLM with no auth, no quota and no rate
6+
# limit, so binding every interface has to be a decision someone makes rather
7+
# than one they inherit. Set MAINARCH_DEMO_BIND=0.0.0.0:8080 to expose it, and
8+
# put a reverse proxy in front when you do.
9+
BIND="${MAINARCH_DEMO_BIND:-127.0.0.1:8080}"
610
NODE="${MAINARCH_DEMO_NODE:-2}"
711
BIN="${MAINARCH_DEMO_BIN:-./target/release/mainarch}"
812
PORT="${BIND##*:}"
@@ -23,7 +27,7 @@ Environment:
2327
2428
Examples:
2529
bash tools/demo_sandbox.sh build
26-
MAINARCH_DEMO_BIND=0.0.0.0:8080 MAINARCH_DEMO_NODE=2 bash tools/demo_sandbox.sh serve
30+
MAINARCH_DEMO_BIND=0.0.0.0:8080 MAINARCH_DEMO_NODE=2 bash tools/demo_sandbox.sh serve # expose it
2731
MAINARCH_DEMO_URL=http://127.0.0.1:8080 bash tools/demo_sandbox.sh smoke
2832
EOF
2933
}

0 commit comments

Comments
 (0)