Knotrel Docs

ADR 0017: authentication and trust boundary

Status: Accepted on 2026-11-29 (knotrel/knotrel#224). Scope decisions Q8 and Q9 approved by the maintainer on 2026-11-29. Issues: #185 (native authentication and untrusted exposure), #223 (native TLS and mTLS, backlog), #155 (tenant-scoped authorization).

Related: threat model, ADR 0015 (runtime and registry).

Context

Knotrel has no authentication, authorization or TLS of its own. The supported exposures are loopback (E1), a fully trusted network (E2) and a gateway that terminates TLS and authenticates every request (E3); untrusted exposure (E4) is not supported. Feeder takeover is mitigated only by the boundary (G3).

Multi-tenant graphs (ADR 0015) need to know which tenant a request belongs to, and that identity must come from a trusted source, never from what the client claims.

Decision

  1. Authentication is an optional extension of knotrel-server, defined by two traits: an authenticator that turns a request into a principal (subject, tenant, roles) before admission, and an authorizer that decides an action (probe, metrics, read, inspect, mutate, feeder control, feeder data, import, graph admin, tenant admin) on a resource (the server or one graph). The default keeps today’s behavior: every request is the local principal, and E1–E3 stay the supported exposures.
  2. Q9: the first implementation trusts a verified identity from the gateway. The gateway authenticates the client by any means it supports and forwards the identity in a fixed set of headers. Static tokens and JWT/OIDC are later implementations of the same traits.
  3. Two conditions keep a client from forging an identity. Both are deployment requirements, stated as such in the deployment documentation:
    • The gateway strips or overwrites every identity header the client sent, on every forwarded request. A gateway that only adds headers when it authenticates someone lets any client forge an identity.
    • Only the gateway can reach the listener that trusts those headers (loopback in a namespace shared only with the gateway, a Unix socket, or a network policy). A client that connects directly can send any identity.

    The gateway-identity authenticator is off by default, and the startup log states these conditions when it is enabled.

  4. Q8: in v1.3.0 TLS and mTLS terminate at the gateway. A client certificate identity exists only at the gateway, which forwards it as a verified identity. Native TLS and mTLS in the server, with certificate identity mapped to a principal by one more authenticator implementation, are evaluated in #223.
  5. E4 stays unsupported even with an extension installed, until the abuse tests of #185 (rate limits, resource bounds, audit) exist.

Alternatives considered

Consequences