Security

Security you can audit, not just take our word for it.

Engineering deep-dive: request path, database isolation, virtual keys, and credit-safety invariants.

security · architecture · contract

Architectural invariants

TLS1.3
RLS-protected tables100%
USING (true) policies0
Master-key surfaceisolated
Customer LLM authvirtual keys only
Reserve + settleenforced
CSPHSTSSOC 2 controlsGDPRHIPAA-eligible
Uptime SLA
99.9%

Backed by managed Azure Container Apps + Supabase

Encryption
AES-256

At rest + TLS 1.2+ in transit

RLS-protected tables
100%

Every nRouter table, no exceptions

Master-key surface
0 customer paths

LLM traffic uses virtual keys only

Framework status (SOC 2, GDPR, HIPAA, PCI) lives on the compliance page; documents and posture on the trust center.

Architecture

Always-in-path, by design

Auth checks, tenant scope, credit reservation, and guardrails all execute in-path before any request reaches a provider.

Request flow

  1. Client / SDK

    Bearer sk-nrouter-…

    Only virtual keys leave the client; master keys never ship.

  2. Frontend (Next.js)

    Azure Container Apps

    Server actions add auth + RLS scope before forwarding.

  3. nRouter Backend

    nRouter

    Auth, credit reserve, guardrails, observability — in path.

  4. nRouter routing core

    Routing engine

    Cost & usage tracking, rate limits, provider fallback chains.

  5. Provider

    Vertex / Anthropic / OpenAI

    Outbound traffic only; no inbound provider calls.

The nRouter routing core is fully managed. Every request is authed, scoped, and guardrailed before it reaches a provider, with nothing for you to harden.

Defenses

Six layers, all on by default

Full security posture from day one. No enterprise tier required for SSO, audit logs, or active guardrails.

Encryption at rest and in transit

TLS 1.2+ with HSTS preload and AES-256 storage. Virtual keys are SHA-256 hashed on creation—plaintext is shown once and never stored.

Tenant isolation by default

Postgres Row-Level Security on every table scoped by organization. Cross-tenant reads are blocked at the database layer.

Virtual keys for every call

Customer traffic uses virtual keys with per-key spend caps, rate limits, and instant revocation. Master keys never touch client code.

Hardened request path

Auth, tenant scoping, guardrails, and credit reserve+settle run on every request before reaching any model provider.

Active guardrails on every plan

PII redaction, prompt injection defense, secret scanning, abuse blocking, and output scanning included at zero extra cost.

Audit-grade observability

Append-only audit logs for all administrative actions, key changes, and budget events with actor, IP, and timestamp.

Deep Dive

Postgres Row-Level Security, on everything

Multi-tenancy enforced at the database layer. Even with application bugs, the database refuses to return rows from another tenant.

Tenant isolation

One tenant boundary, enforced at the database

Every record is scoped to your organization, and Row-Level Security enforces that boundary at the database itself. A query against the wrong tenant returns zero rows. There is no mapping table to drift, no sync layer to compromise.

  • Owner / Organization Admin / Member / Viewer roles enforced via RLS policies
  • Service role bypasses RLS only inside server-side API routes
  • Continuous gap-hunter scanner verifies cross-tenant denial
  • Org switch invalidates every TanStack Query cache key
psql · nrouter schema

RLS policy spot-check

organization_billing4 / 4 policies
credit_balances4 / 4 policies
guardrails4 / 4 policies
audit_trailappend-only
USING (true) policies0
every tableorg-scopedno gaps
Money Safety

Guaranteed non-negative credit balances

Every request reserves credits prior to forwarding and settles against provider usage. Failures automatically release reservations.

Reserve + settle

Atomic credit mutations

The credit ledger applies every increment/decrement atomically, so concurrent writes never race. Webhooks are idempotent on Stripe event id. Reservations expire automatically if a request never settles.

  • reserve → forward → settle with cost from x-nr-request-cost
  • Held credits released on every failure path (4xx/5xx/timeout)
  • 402 returned cleanly when a key would breach budget — no partial debit
  • Daily ledger parity check verifies total spend == balance
credit_ledger · architecture · contract

Money-safety invariants

Atomic mutationsevery write
Reserve → settleevery LLM request
Release on failure4xx / 5xx / timeout
Negative-balance writesblocked at DB
Webhook idempotencyon Stripe event id

Engineering principle

Built audit-ready from day one. Not retrofitted before a procurement call.

RLS, virtual keys, master-key isolation, reserve+settle credit safety, and the audit trail are non-negotiable invariants in our platform, enforced by tests that block merges, not by promises on sales calls.

Data residency

Pin where your data lives

Customer data resides in encrypted managed Postgres. US default; EU, UK, Canada, Australia, Singapore, and India available on request.

US East (Virginia)GA
European Union (Netherlands)On request
EU North (Stockholm)On request
United Kingdom (London)On request
Canada (Montréal)On request
Australia (Sydney)On request
SingaporeOn request
India (Mumbai)On request

The default US region is Azure East US (Virginia). EU residency is pinned on request for Enterprise, with Supabase Postgres co-located and subprocessors signed under EU SCCs. Need a region pinned? sales@nrouter.ai.

Session & tokens

Idle, refresh, revoke: predictable session policy

Predictable timeouts, transparent token rotation, and instant device revocation.

Idle timeout (30m default). Inactive sessions warn at 25 minutes and force re-auth at 30. Configurable per-org on Enterprise.

Refresh-token rotation. Tokens rotate on every use. Replaced tokens are immediately invalidated across all active sessions.

Device management. Account settings list active sessions by device, OS, and IP with one-click revocation.

Session vs API key. Dashboard sessions only sign management calls. All LLM requests require scoped, budget-capped virtual keys.

Disclosure

Reporting a vulnerability

We acknowledge reports within 48 hours and resolve critical issues within 7 days under coordinated disclosure.

FAQ

Common security questions

Where is data stored, and can I pin a region?

All customer data lives in managed Postgres (Supabase) with at-rest encryption, replicated within a single region. United States is the default footprint. EU residency is generally available on Enterprise; the UK, Canada, Australia, Singapore, and India are available on request for residency-sensitive workloads. We do not move tenant data across regions without an explicit migration request.

Is nRouter SOC 2 certified?

Not yet — and we will not say "certified" until the report is signed. nRouter operates SOC 2-aligned controls today: encryption, access control, audit logging, change management, and tenant isolation, enforced from day one. A formal SOC 2 Type II observation period is currently underway, with the audited report targeted for Q3 2026. The underlying infrastructure (Microsoft Azure, Supabase) is independently SOC 2 Type II certified. Enterprise customers who need assurance before the report lands can request a controls walkthrough or a completed vendor security questionnaire from security@nrouter.ai.

How does nRouter prevent cross-tenant data access?

Every nRouter table has Row-Level Security enabled with policies scoped by organization_id, so a query against the wrong tenant returns zero rows — there is no "leaky path" to fix because the database refuses to return them in the first place.

What if my virtual key is leaked?

Virtual keys are tenant-scoped, rate-limited, budget-capped, and observable. Revocation is immediate from the dashboard or API; the in-memory cache invalidation propagates within seconds. Keys are hashed in the database. The plaintext is shown exactly once at creation. The blast radius of a leak is the budget on that single key, not your account.

Are AI guardrails included on every plan?

Yes. PII redaction, prompt injection detection, secret scanning, abuse blocking, and response scanning all run on every request from day one — at zero additional cost. We do not gate safety features behind paid tiers.

How do I report a vulnerability?

Email security@nrouter.ai with details. We acknowledge within 48 hours and aim to resolve critical issues within 7 days. We follow responsible disclosure practices and credit reporters in our changelog when permitted.

Security review · 30 minutes

We will walk your security team through the controls

No NDAs to start, no sales gate. Bring your auditor. They will get the same answers we give the engineering team.