Symptom

Krill needed to run as a public, internet-facing demo (live.krillswarm.com on EC2, port 8442 only). A security audit found the server was not safe to expose, independent of any “demo” feature:

Root cause

The auth model is a single cluster-wide PIN-derived bearer token shared by clients and peers, handed out freely by /krill-token on the assumption the WASM app is same-origin — false on the public internet. There was no notion of “read-only,” no server-side write chokepoint, and no read-time redaction.

Fix

Added a server-level demoMode flag (ServerConfig.demoMode, default false, backward-compatible via fastJson lenient parsing). When enabled:

Client + SDK (same feature, this PR + krill-oss#209):

The two policy functions are pure and unit-tested (DemoModeGuardTest) with no filesystem/port/PIN dependency — the route handlers and plugin delegate to them, per the repo’s “call the helper the route delegates to” test rule.

Prevention