Security

Superfluid binds to loopback and asks for no credential unless told to. Nothing in it speaks TLS: the HTTP API is meant for a trusted network or a reverse proxy, the unix socket trusts whoever can open it, and the session log holds every prompt and completion in plain text. To report a vulnerability, see the security policy.

Listeners

listenerflagdefaultcredential
OpenAI / Anthropic / Ollama HTTP--http, --host/--port127.0.0.1:8453--api-key or --key-policy, optional
native session API--socket~/.superfluid/superfluid.socknone: file permissions
browser transport--weboff; loopback onlya minted bearer token
fleet node agentsuperfluid-noded --listen0.0.0.0:8454the fleet token (--auth-file, default $SUPERFLUID_HOME/fleet/token); required off loopback
fleet head, for nodes that joinserve --fleet-listenoffthe fleet token; without one, only nodes on this machine

Without a key (--api-key-file, --api-key or SUPERFLUID_API_KEY) or --key-policy, a server on loopback says so in one line; one bound anywhere else warns:

superfluid: WARNING no API key set. Authentication is OFF — anyone who can reach this port can use the API. Bind loopback or set --api-key-file (or --api-key, $SUPERFLUID_API_KEY).

Requests from web pages

Every HTTP listener refuses, with 403 and code origin_refused, a request whose Origin header names a page that is not on this machine (localhost, 127.0.0.0/8, [::1]). It also checks the Host header, which is how a DNS-rebinding page is caught: a listener bound to loopback answers only to a loopback Host, and a listener bound elsewhere with no --api-key or --key-policy answers only to an IP address, localhost, or this machine's own hostname (and <hostname>.local). To reach a keyless server by another DNS name, set --api-key; a keyed server off loopback accepts any Host, since a rebound page cannot present the key. Clients that send no Origin (curl, the OpenAI and Anthropic SDKs, server-side code) are unaffected, and the server sends no CORS headers.

API key

superfluid serve <model> --api-key-file /etc/superfluid/key
curl -H 'Authorization: Bearer <key>' http://127.0.0.1:8453/v1/models
curl -H 'x-api-key: <key>' http://127.0.0.1:8453/v1/models
  • The key comes from --api-key <key>, else --api-key-file <path>, else the SUPERFLUID_API_KEY environment variable. ps shows a key on the command line to every user of the machine; the file and the variable it does not. The two flags together are refused.
  • --api-key-file reads the file with the whitespace around the key trimmed, and refuses a missing or empty one. Like ssh with a private key, it warns when group or others may read the file: chmod 600 it. Windows has no such mode to read, so nothing warns there: keep the file where only you can read it, as a file under your profile is.
  • superfluid launch hands the server it starts the key in SUPERFLUID_API_KEY, not on its command line. superfluid top takes --api-key-file and the variable too.
  • Every route except GET /health needs the key, including /metrics and the Ollama routes. An unknown path without a key is a 401.
  • Keys are compared in constant time against a SHA-256 digest.
  • A missing or wrong key is 401 with type: "authentication_error", code: "invalid_api_key".

Admin routes change the server for everyone and need the global key or a policy key with admin: true: POST /v1/models/load, /v1/models/unload, DELETE /v1/models/{id}, POST /v1/lora/load, /v1/lora/unload, and on a fleet head DELETE /v1/fleet/nodes/{name}. A fleet head with no key takes node removal only from its own machine.

WARNING

POST /v1/models/load loads any path the daemon's user can read. Never expose an unauthenticated server beyond the host.

Key policy

--key-policy <file.json> loads named keys with per-key scheduling and limits. It turns authentication on: a request must present a listed key or the global --api-key.

{
  "keys": [
    {"name": "chat-ui", "key_env": "CHAT_UI_KEY", "class": "interactive", "max_concurrent": 16},
    {"name": "batch", "key": "sk-batch-...", "class": "background", "rate_limit_rpm": 60, "max_concurrent": 2},
    {"name": "ops", "key_env": "OPS_KEY", "class": "agent", "admin": true}
  ]
}
fielddefaultmeaning
namerequiredpublic name in logs and metrics ([A-Za-z0-9._-], unique)
key / key_envone requiredthe secret inline, or the environment variable holding it
classagentQoS class for the key's requests
max_classclassbest class the x-superfluid-qos header may ask for; asking beyond is a 403
batch_invariantfalsemay ask for a batch-invariant lane
rate_limit_rpm0 (unlimited)per-key token bucket; exempts the key from the per-IP --rate-limit
max_concurrent0 (unlimited)in-flight requests; a stream holds its slot while it streams
adminfalsemay use admin routes
  • The file is validated at startup: unknown fields, an empty list, duplicate secrets, a name equal to a secret, or a secret equal to --api-key are refused.
  • Files and batches are scoped to the key that created them.
  • Listing, reading and cancelling one's own files and batches take no concurrency slot.
  • A non-admin key scraping /metrics sees only its own superfluid_key_* rows.
statuscodewhen
429rate_limit_exceededthe key's bucket is empty
429concurrency_limit_exceededall max_concurrent slots are held
403admin_requiredadmin route without admin
403QoS header above max_class, or batch-invariant without permission

Rate limits

--rate-limit <rpm> is a token bucket per client IP. /health, /metrics and /v1/metrics are exempt, as are requests under a key with its own rate_limit_rpm. Over the limit is 429 rate_limit_exceeded.

NOTE

The address is the TCP peer's; X-Forwarded-For is not read. Behind a reverse proxy every client shares the proxy's address, so rate-limit at the proxy or per key instead.

Fill-in-the-middle completions have their own per-client bucket (--completion-rate, --completion-burst), keyed on the authenticated credential and peer address.

QoS headers

flagdefaultmeaning
--http-default-qos <class>agentclass for requests that name none
--no-http-qos-headerhonouredignore x-superfluid-qos, so untrusted clients cannot claim interactive and preempt agents
--http-allow-batch-invariantrefusedallow batch-invariant lanes, which can serialize the server

Unix socket

The session API socket has no credential: whoever can connect controls every session and the daemon's log level. The daemon binds it with the process umask. Keep it in a directory private to the daemon's user. On Windows the socket takes the access list of its directory, which under your profile, where the default one is, admits you, the system and the administrators.

Browser transport

  • Loopback only, enforced at startup.
  • A random bearer token is written to <sessions>/web-token (mode 0600). /web/rpc and /web/stream need it in Authorization: Bearer and echoed in X-Superfluid-CSRF.
  • --web-origin <url> (repeatable) is the Origin allow-list. A request with an unlisted Origin is 403; one with no Origin relies on the token.
  • /web/ws requires an allow-listed Origin; the token may ride Sec-WebSocket-Protocol as superfluid.token.<token>, beside superfluid.v1.
  • /web/health answers without the token.
  • The listener sends no CORS headers, so a page on another origin can reach only /web/ws; see Session API.

What is stored and logged

path under --sessionscontentsmode
wal.log, models/<id>/every prompt and completion, as tokens and textumask
files/, batches//v1/files and /v1/batchesumask
media/images and audio requests carried0600
park/sealed KV, with --parkumask
logs/, web-tokenJSON logs under the TUI, the --web token0600

A Windows file has no mode. Where this page says 0600, the file there gets an access list of its own: this user, the system and the administrators, with nothing inherited from its directory, so it stays private in a home outside the profile. Where it says umask, the file takes its directory's access list.

Logs, metrics and OTLP traces carry ids, counts, timings and codes, never content. Key secrets are never logged; keys appear by name. Session exports include content only with --include-content, and send it off the host only with --allow-content-egress.

Code and network egress

  • --basert-lib, BASERT_LIB and SUPERFLUID_LLAMA_LIB load a shared library you name.
  • An MLX directory that ships its own Python is refused unless SUPERFLUID_MLX_TRUST_MODEL_CODE=1. Models pulled by id are fetched without *.py files.
  • serve <id> downloads from the Hugging Face Hub; --offline forbids it. runtime install downloads over HTTPS with pinned digests.
  • OTLP exports and session export --endpoint use plain HTTP to the collector you name.
  • superfluid serve reads GitHub's release listing for Superfluid (api.github.com) once a day, after the server is up, to say when a newer release is out. SUPERFLUID_NO_UPDATE_CHECK=1 or --offline turns it off; see Updating.

The fleet token (superfluid fleet token: 32 random bytes as hex at $SUPERFLUID_HOME/fleet/token, mode 0600) keys the link between head and node. With a token, every connection is a Noise handshake (Noise_NNpsk0_25519_ChaChaPoly_BLAKE2s, its pre-shared key the SHA-256 of the token), and everything after it, prompts and tokens included, is encrypted and authenticated. A peer with another token fails the handshake and is refused. The token never crosses the network in the clear; the head repeats it inside the encrypted hello, and the node compares it in constant time.

  • The head reads the token from --fleet-auth <path>, else $SUPERFLUID_HOME/fleet/token. superfluid-noded reads it from --auth-file <path>, else the same path. superfluid node join --token <value> keeps the value at that path.
  • With no token, the links are plain TCP and nothing is checked. A head with --fleet-listen and no token takes only nodes on its own machine; node join with no token dials only a head on loopback.
  • superfluid-noded bound off loopback refuses to start without a token, unless --insecure-no-auth, which accepts any peer that reaches it. Use that only behind a transport that already authenticates (WireGuard, Tailscale).
  • --api-key, --key-policy and --rate-limit protect the head's own HTTP listener and a policy's class ceilings apply there as on a single server.

Fleet discovery

A head with --fleet-listen announces itself on the local network over mDNS (_superfluid-fleet._tcp): its fleet port, its HTTP port, the models it serves and, when it has a token, a network id. The network id is the first 16 hex digits of SHA-256 over a fixed prefix and the token. Nodes use it to join only a head of their own network.

The network id reveals nothing practical about a token made by superfluid fleet token (256 random bits). A short or guessable --token can be brute-forced from it offline by anyone on the network, so use a generated token. A head with no token announces no network id.

Putting it on a network

  1. Keep --http on loopback and put a TLS-terminating reverse proxy in front.
  2. Set --api-key, or --key-policy when clients differ in class or limits.
  3. Allow long responses through the proxy; --nonstream-keepalive <sec> keeps a long non-streaming prefill from being dropped as idle.
  4. Do not expose /metrics publicly.
  5. Do not expose --web or the unix socket beyond the host.
  6. Leave --rate-limit off behind a proxy; limit at the proxy or per key.
  7. Keep the fleet node port (8454) and the head's port on the private network.