What happened

GET /krill-token returned the PIN-derived cluster bearer token — the credential that authenticates every mutating endpoint (node create/invoke/ delete, backup restore, shutdown) — to any caller, with no authenticate {} wrapper. Found during the public-demo exposure audit (krill#915); demo mode already hard-blocks the route, but a normal (non-demo) server on any reachable network served the cluster credential to whoever asked.

Root cause

The route’s own comment explained the reasoning: “Unauthenticated — the WASM app is already trusted (served from the same server).” That assumption only holds if the request truly originates from the same machine the server runs on; Ktor gives the route no way to verify that, and on a LAN- or internet-reachable server the request is just another client. The endpoint also had no actual consumer — WasmClientPinStore.setServerToken(), the only call site referenced in its doc comment, was never invoked anywhere in the codebase.

Fix

Prevention