Documentation
¶
Overview ¶
Package safehttp provides SSRF-guarded HTTP clients shared across every mesh path that fetches a user- or config-controlled URL: the ingest connectors, and the BYOAI embedding / rerank / LLM endpoints. The guard resolves the destination host, refuses any resolved address that is loopback, private, link-local (incl. 169.254.169.254 cloud metadata), CGNAT/Tailscale (100.64/10), ULA, multicast, or unspecified, then dials the vetted IP directly so a DNS-rebind flip between check and dial cannot slip a private IP through. Redirects are capped at 3, each re-dialed through the guard.
This was previously private to internal/ingest and covered only the connectors; the embedding/rerank/LLM clients used a bare http.Client, so a config-set endpoint could probe the host/tailnet/metadata and exfil note content. Lifting it here closes that.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AllowPrivateLLMEndpoint ¶
func AllowPrivateLLMEndpoint() bool
AllowPrivateLLMEndpoint reports whether the operator opted into private BYOAI endpoints (a localhost Ollama, an in-tailnet model server) via the env var.
func Client ¶
Client returns an http.Client that refuses non-public destinations (the SSRF guard) and follows at most 3 redirects, each re-dialed through the guard.
func LLMClient ¶
LLMClient returns the HTTP client for BYOAI endpoints (embeddings, rerank, LLM). It is SSRF-guarded by default so a config-set endpoint cannot probe the host, the Tailscale tailnet, or cloud metadata and exfil vault content. An OPERATOR (not a member via the config API) may set MESH_ALLOW_PRIVATE_LLM_ENDPOINT=1 to permit a sovereign localhost endpoint. The config API never writes this var, so a member cannot flip the guard off.
func LoopbackAllowed ¶
LoopbackAllowed is like Client but permits private/loopback destinations. Use ONLY for an operator-configured sovereign endpoint (e.g. a self-hosted Ollama on 127.0.0.1), gated behind an operator env var, never a member-editable config field.
Types ¶
This section is empty.