Identity & access

Rate limits, safe start-up and response headers

Keeps a server from being exposed without credentials and limits how fast any one client can call it.

Available in previewEngine edition 5f8ea3af

What it does

Start-up checks that refuse an unauthenticated server on a non-loopback address, fixed-window rate limits per client address and per project, and a standard set of security headers on every response.

How it works

A server bound to a loopback address starts with no configuration, and unauthenticated API access is allowed there for development. A server bound to any other address refuses to start unless KYNETRA_API_KEY holds at least 32 bytes or at least one user account already exists. KYNETRA_INSECURE_REMOTE=true overrides this for isolated test environments. KYNETRA_REQUIRE_AUTH=true closes unauthenticated access even on loopback, which matters behind a local reverse proxy.

A fixed-window limiter keeps a count for each client address and route class. The defaults over a 60-second window are 30 requests for authentication routes, 300 for admin routes, 600 for other writes and 1,200 for other reads. A second budget applies per project, keyed on the verified credential and never on a client-supplied project header, and defaults to 1,200 for the window. A refused request receives status 429 with Retry-After and x-ratelimit headers. The client address is the socket address, and forwarded-address headers are trusted when KYNETRA_TRUST_PROXY_HEADERS is set.

Every response carries nosniff, frame denial, no-referrer, a restrictive permissions policy and same-origin opener headers, plus Strict-Transport-Security when the server is bound beyond loopback. Cross-origin requests are refused until KYNETRA_CORS_ORIGINS lists origins (or *).

Health and readiness probes and CORS preflight requests are not counted against the budgets.

Where you reach it

  • ConfigKYNETRA_API_KEY, KYNETRA_REQUIRE_AUTH, KYNETRA_INSECURE_REMOTE
  • ConfigKYNETRA_RATE_LIMIT_GENERAL, _AUTH, _ADMIN, _WRITE, _PROJECT, _WINDOW_SECS
  • ConfigKYNETRA_TRUST_PROXY_HEADERS, KYNETRA_HTTPS_ONLY, KYNETRA_CORS_ORIGINS

Example

Settings for a server behind a reverse proxybash
# A key of at least 32 bytes is required when the server listens beyond loopback
export KYNETRA_API_KEY="$(openssl rand -hex 32)"
# Close unauthenticated access even if the proxy reaches the server over loopback
export KYNETRA_REQUIRE_AUTH=true
# Trust forwarded client addresses when a proxy you control sets them
export KYNETRA_TRUST_PROXY_HEADERS=true
# Tighten the sign-in budget (requests per window per client address)
export KYNETRA_RATE_LIMIT_AUTH=20

Limits

  • The limiter lives in process memory. Counts are kept per node, reset on restart and are not shared across a cluster or between replicas.
  • Fixed windows allow a burst across a window boundary of up to twice the budget.
  • The API listener does not terminate TLS. Put a TLS-terminating proxy in front of it. The HSTS header does not encrypt the listener itself.
  • There is no per-account lockout, CAPTCHA or address reputation in this release.

Evidence

  • On this siteSecurity overview
  • Tests17 tests in the security module (exposure rules for loopback and remote binds, limiter windows, per-project budgets keyed on verified credentials, forged-claim handling, response headers)

Test coverage is listed as present in the engine repository at this edition. This page does not report test results.

KynetraDB is in private preview

Request a preview to try this against your own workload.