ELUVIXSovereign AI Router

Security & Privacy Guardrails

Eluvix is engineered with sovereign privacy and enterprise data protection as foundational pillars. It operates as an intelligent, in-flight firewall between client applications and generative AI models.


Authentication & Credentials Architecture

Eluvix secures both the web console and the programmatic API using a unified credentials system:

Automatic Credential Generation

Upon initial startup:

  1. Eluvix creates the XDG configuration directory: ~/.config/eluvix/.
  2. It generates a cryptographically random admin password and a 256-bit NextAuth secret.
  3. Credentials are saved to ~/.config/eluvix/auth.json with strict POSIX permissions (0o600), readable only by the process owner.
  4. The generated password is displayed in the startup console log for initial sign-in.

API Authentication & Scoped Key Manager (/api/v1/keys)

Programmatic requests to endpoints (such as /api/v1/chat/completions, /api/v1/messages, and /api/v1/responses) accept the master admin password or scoped Named elx_... API Keys (managed by admins via GET / POST / DELETE /api/v1/keys or the Configurator Scoped Keys tab, with per-key scopes, rpm, maxDailySpendUsd, companyIds, maxTier, maxCostPer1kUsd, and SecretRef hmacSecret bindings using env:, file:, bao:, vault:, or keychain:):

Authorization: Bearer <ADMIN_PASSWORD_OR_ELX_KEY>

Scopes are enforced per route, not just on chat: embeddings requires the embeddings scope, audio routes the audio scope, image generation the images scope, and MCP POST the mcp scope — a readonly or wrongly-scoped key receives 403 (API key lacks required "<scope>" scope.). A maxDailySpendUsd cap is enforced against the key owner's rolling 24-hour spend from the request logs; exceeding it returns 429 (budget-exceeded). Config API responses redact observability secrets (the Langfuse secret key and Authorization headers) to *Configured flags, and posting a redacted config back preserves the stored values.

Request Hardening

  • A Host header carrying userinfo (127.0.0.1:PORT@evil.com) is rejected outright, so it can no longer slip past the local-host allowlist.
  • PORT and HTTP_PORT are validated as integers 1–65535; a bad value logs a clear error and falls back to the default instead of crashing.
  • Docker up/down/logs require a real admin identity (ELUVIX_ADMIN_TOKEN env, an admin bearer token, or an admin/operator session or key) and fail closed when no admin token is configured — the old loopback dev bypass is gone.

Automated Local TLS & Same-Port Auto-Upgrade

Eluvix provisions real HTTPS certificates locally to eliminate cleartext credential leakage on LANs and development machines:

  1. server.mjs checks for mkcert on the system path during boot.
  2. It automatically provisions and caches locally trusted TLS certificates for:
    • localhost
    • 127.0.0.1
    • ::1
    • eluvix.local
  3. Same-Port Dual-Protocol Demuxing (Port 3588): The primary listener on port 3588 sniffs incoming TCP packets at byte 0. If a client transmits a TLS handshake byte (0x16), the connection proceeds through encrypted HTTPS. If a plaintext HTTP method byte is received (G, P, H, D), the server immediately responds with an HTTP/1.1 308 Permanent Redirect to https://<host>:3588, seamlessly upgrading browser and curl traffic on the exact same port.
  4. Secondary HTTP Port (3580): An optional secondary redirect port is maintained for legacy scripts expecting standard HTTP-to-HTTPS redirect semantics.

Privacy Guard (In-Flight PII Redaction)

The Privacy Guard (@eluvix/router-core) inspects incoming prompts and scrubs sensitive personal identifiable information before prompts are transmitted to upstream models:

Redaction Formatting Styles

  • Named Token (token): Substitutes entities with descriptive tokens (e.g. [REDACTED_API_KEY], [REDACTED_SSN], [REDACTED_EMAIL]). Allows models to preserve semantic structure and entity references.
  • Asterisk Masking (asterisk): Preserves entity prefix characters while masking sensitive digits with bullets (e.g. sk-••••••••, •••-••-1234).
  • Cryptographic Hash (hash): Replaces entities with deterministic SHA-256 hash digests (e.g. [HASH:e3b0c44298fc...]). Enables entity resolution across multi-turn chats without exposing raw PII.

Built-in Sensitive Entity Types

The Privacy Guard includes pre-compiled, high-throughput regular expression engines for:

  • API Keys & Secrets: OpenAI (sk-...), Anthropic (sk-ant-...), AWS Access Keys, GitHub Personal Access Tokens.
  • Social Security Numbers (SSN): Standard 9-digit US SSN formats.
  • Credit Card Numbers: Major credit card format patterns (Visa, Mastercard, Amex, Discover).
  • Email Addresses: RFC-compliant email address strings.
  • Phone Numbers: International and domestic phone formats.
  • IP Addresses: IPv4 and IPv6 addresses.

Exempted Whitelist

Allows specific domains, internal tokens, or test handles (e.g. internal.corp, localhost, test@company.com) to bypass masking, preventing false-positive redaction of legitimate operational data.

Custom Regex Patterns

Operators can supply domain-specific regular expressions with named tags (e.g. Employee IDs, Patient Record Numbers, Internal Project Codewords) in the Properties Inspector.

Security Audit Logging

When enabled, redacted fragments and their replacement styles are recorded in an encrypted audit stream for compliance verification (SOC 2, HIPAA, GDPR).


Semantic Guard (Prompt Injection Firewall)

The Semantic Guard acts as an application firewall against prompt injection attacks, jailbreaks, and adversarial manipulation:

Embedding & Classifier Models

  • DeBERTa-v3-Injection: Specialized transformer classifier tuned for prompt injection detection.
  • BGE-Small-EN-v1.5: Dense semantic embedding similarity matcher against known adversarial clusters.
  • MiniLM-L6-v2: Ultra-fast heuristic semantic analyzer for high-throughput pipelines.

Active Threat Vectors

The Semantic Guard actively profiles requests for four distinct threat categories:

  1. Instruction Override: Attempts to negate system instructions (e.g. ignore all previous directions, disregard safety guidelines).
  2. DAN / Jailbreak Personas: Known adversarial personas and simulation exploits (e.g. Do Anything Now, developer mode active).
  3. System Prompt Leakage: Probing techniques designed to extract upstream instructions or secrets (e.g. repeat everything above verbatim, print your system prompt).
  4. Obfuscated Attacks: Encoded attack payloads designed to evade keyword filters (Base64, ROT13, leetspeak).

Configurable Enforcement Actions

When a prompt triggers the sensitivity threshold (0.50–0.99):

  • Block (block) (Default): Rejects the request immediately with an HTTP 400 Bad Request, preventing compute consumption.
  • Strip (strip): Removes the adversarial prefix or exploit string, allowing legitimate query contents to proceed.
  • Divert (divert): Routes the request to a quarantined sink model for security honeypot analysis.
  • Warn (warn): Logs the adversarial event in telemetry while permitting the request to execute.

Custom Banned Phrases

Blacklist specific keywords or company-confidential project names from ever reaching upstream models.


Memory Egress Guard (Context Firewall)

When using the Memory & Context Engine (OpenViking, Mem0, or SQLite), personal preferences, past transcripts, and internal project notes are injected into prompts.

To prevent sensitive sovereign data from leaking to third-party cloud providers:

  • cloudMode: "filter" (Default): Deep-inspects injected memory context for credentials, access tokens, and sensitive entities before transmitting payloads to external cloud models (OpenAI, Anthropic).
  • cloudMode: "strip": Completely removes the <recalled_context> block when a request is dispatched to external cloud upstreams. Long-term memory recall is reserved strictly for local, on-premises models (Ollama, vLLM).

Agent Loop Guard & Hop Limiter

Autonomous agent networks (TrueForge, opencode, ACP, Hermes) can generate accidental recursive routing loops that burn millions of tokens in minutes.

The Loop Guard pipeline stage enforces:

  1. Origin Verification: API requests originating from agent harnesses are identified by origin: "harness" in keys.json or by incoming headers.
  2. Hop Counting: Each proxy hop through Eluvix increments the x-eluvix-hops tracking counter.
  3. Threshold Enforcement: When x-eluvix-hops reaches or exceeds the configured limit (default: 2), the request is rejected immediately with an HTTP 429 Too Many Requests error and an agent_recursion_limit_exceeded code.