Security Hardening

Built-in security mechanisms

MechanismDescription
Encrypted upstream key storageEach tenant has a random tenant key that encrypts upstream keys and Vertex private keys with XChaCha20-Poly1305; the tenant key is in turn encrypted with the account's own API key
Credential isolationApplications hold only XSI keys; all caller credentials and client IP headers are stripped before forwarding, and upstream keys are never returned to regular accounts
Admission pipelineIP, status, quota, rate limits, and resource and model allowlists are checked layer by layer
Tenant isolationKeys, configuration, and pricing are isolated per tenant; account management only applies to the operator's own subtree
Memory protectionCore dumps are disabled at process startup

Deployment checklist

Secrets

  • The root key and database password use randomly generated values, and docker-compose.yml has permissions 600.
  • The root key is used only for administration, never for model calls or distribution to applications.
  • Applications use dedicated sub-account keys, split by environment and purpose.
  • If a leak is suspected, rotate the key with POST /x-self; the old key is invalidated immediately.

Network

  • Ports stay bound to 127.0.0.1, so only the reverse proxy can reach the API and console ports.
  • PostgreSQL and Redis are not published to host ports (the template default).
  • HTTPS is enabled on every entry point.
  • TRUSTED_PROXY_CIDRS contains only your own proxy addresses, so clients cannot spoof their IP.
  • Block utility paths that need no public exposure at the proxy: /x-gkey, /x-ekey/, /x-dkey/. They require no authentication, only generate and encode/decode keys, and serve no purpose for external users.
location ~ ^/x-(gkey|ekey|dkey) { return 404; }
  • If the configuration console is not meant for the public, restrict access to it by source IP.

Mail

  • Configure your own SMTP for the mail service in docker-compose.yml.
  • Keep EMAIL_SMTP, EMAIL_AUTH, and EMAIL_PASS for the API container as empty strings, as in the template, or set them explicitly to your own values. Do not rely on the defaults in the code.
  • Set XAI_MAIL to your own operations mailbox to receive notifications such as unknown models and failovers.
  • Welcome emails and key rotation emails contain the API key in plaintext, so make sure the mail path uses TLS.

Upstream keys

  • Use fields=summary when querying keys; full mode and the sleeping/disabled lists in GET /x-conf return plaintext.
  • Set AUTO_DISABLE_KEY_STATUS=401 so keys revoked by the upstream drop out of rotation automatically.
  • Rotate upstream keys regularly, and set usage caps in the upstream consoles as a last line of defense.

Access control

  • Accounts that need quotas and rate limits enforced use Role 2 or 3 (Role 0/1 skips quota and rate limit checks).
  • Set AllowIPs on production accounts; set AllowModels and Resources on accounts distributed externally.
  • Keep USER_FILTER=true.
  • For deployments without open signup, set SIGN_ENABLE=false; with open signup, configure SIGNUP_ALLOW_DOMAINS or SIGNUP_DENY_DOMAINS.

Logs and errors

  • For services facing end users, set MASK_ERRORS=true to hide upstream error details.
  • Redact the Authorization and x-api-key request headers in proxy and application logs.

Data

  • Copy PostgreSQL and Redis backups to another machine, and rehearse restores regularly.
  • Restrict access to the backups/ directory on the host.

Reporting vulnerabilities

If you find a security issue, email [email protected]. Do not disclose details in a public issue.