Security Architecture

DBKnox Security:
Enterprise-Grade from Day One

Your database credentials are encrypted at rest and never exposed in transit. Every action is logged. Access is scoped to the minimum required.

AES-256-GCM

Credential encryption at rest

JWT + MFA + SSO

Multi-layer authentication

RBAC + RLS

Role and row-level isolation

Full Audit Trail

Every action logged immutably

01

Authentication & Identity

DBKnox uses JWT-based session tokens with short expiry and refresh rotation. Every auth flow is protected by MFA — either TOTP-based or via hardware WebAuthn authenticators. Enterprise tenants can federate identity through SAML 2.0 or OIDC SSO, eliminating password management entirely.

  • JWT sessions — short-lived access tokens with refresh rotation. Tokens are signed with RS256 and validated on every request.
  • MFA via TOTP — time-based one-time passwords compatible with any TOTP authenticator app.
  • SAML 2.0 SSO — enterprise identity federation via Okta, Azure AD, Google Workspace (Enterprise plan).
  • OIDC SSO — OAuth 2.0 / OIDC flow for identity providers exposing an OIDC endpoint (Enterprise plan).
  • WebAuthn / Passkeys — hardware security keys (YubiKey) and device biometrics (Touch ID, Face ID) via the WebAuthn standard.

Auth flow

1

Email + Password

Argon2id hashing, brute-force protection

2

MFA Challenge

TOTP or WebAuthn — required

3

JWT Issued

Short-lived access + refresh token

✓

Session Active

Tenant-scoped, role-enforced

02

Authorization

DBKnox enforces RBAC at the application layer and tenant isolation at the database layer. The roleGuard middleware checks the caller's role on every protected API route. Even if the application layer is bypassed, PostgreSQL RLS policies ensure no tenant can read or write another tenant's data.

👑

Admin

Full control: manage team members, configure AI providers, configure webhooks, view audit log, generate reports, and access all databases owned by the tenant.

🔑

Owner

Can connect databases, use AI SQL Chat, run health checks, generate reports, configure webhooks, and view the audit log. Cannot manage team members.

👤

Member

Read access and AI SQL Chat. Cannot connect new databases, manage team, configure webhooks, or access the audit log.

03

Credential Encryption

Every database connection string and API key stored in DBKnox is encrypted using AES-256-GCM before being written to the database. The encryption key is loaded from an environment variable — it is never stored alongside the encrypted data. Credentials are decrypted only at the moment of connection establishment and are never logged, never serialised to responses, and never transmitted in plain text.

AES-256-GCM

Encryption algorithm

96-bit IV

Random per record

128-bit tag

Authenticated encryption

Env-only key

Never in database

04

API Security

DBKnox applies defence-in-depth to every API request. Rate limiting is tiered by endpoint sensitivity. Input sanitisation runs before any data reaches a database query. Body size guards prevent memory exhaustion. Helmet sets security headers on every response.

Tiered Rate Limiting

Endpoint tier Limit
General API100 req/min
AI SQL Chat30 req/min
Auth endpoints10 req/min
Report generation5 req/min

Input Sanitisation & Guards

  • ▸ XSS sanitisation on all string inputs via DOMPurify equivalent
  • ▸ SQLi prevention — parameterised queries only, no string concatenation
  • ▸ Request body size limit: 1MB default, 10MB for report requests
  • ▸ Helmet.js security headers on every response
  • ▸ CORS restricted to app.dbknox.com origin
05

Audit Trail

Every meaningful action in DBKnox generates an immutable audit log entry. The log captures the actor (user ID), tenant, event type, affected resource, outcome, and timestamp. Log entries cannot be edited or deleted — they persist for the tenant's configured retention period (default: 90 days; configurable on Enterprise).

sql.evaluated
sql.executed
sql.confirmed
role.changed
db.created
db.deleted
user.login
user.logout
mfa.enabled
apikey.created
health.completed
policy.override
06

Data Protection

DBKnox uses soft-delete for all user-initiated deletions. Deleted database connections enter a 30-day restore window before permanent purge — no accidental data loss. Metrics retention is configurable per tenant on Enterprise.

Soft-Delete Pattern

When a database connection is deleted, it is marked deleted_at = NOW() but not removed from the database. It is hidden from all queries but restorable for 30 days. After 30 days, a background job permanently purges the record.

Metrics Retention

Health check metrics are retained for 90 days by default. Enterprise tenants can configure a custom retention window. Metrics older than the retention window are automatically purged by a scheduled maintenance job.

07

Network & Infrastructure

DBKnox runs in a private AWS VPC. The backend is not directly reachable from the internet — all traffic flows through an Application Load Balancer with TLS termination. The RDS database has no public endpoint and is accessible only from within the VPC via RDS Proxy.

  • ECS Fargate tasks in private VPC subnet
  • RDS with no public endpoint — VPC-only access
  • RDS Proxy for connection pooling and failover
  • ALB with TLS 1.2+ and HSTS headers
  • CloudWatch alarms for latency spikes and error rates
  • Secrets Manager for environment secrets rotation
08

AI Safety

DBKnox AI SQL Chat includes a mandatory safety level evaluation before any generated SQL is executed. This ensures that destructive or sensitive operations always require human review — the AI cannot autonomously execute data-modifying queries.

Low Risk

SELECT, EXPLAIN, SHOW — read-only queries. Execute immediately without user confirmation.

Medium Risk

INSERT, UPDATE with WHERE clause. Prompted for confirmation before execution. Logged in audit trail.

High Risk

DELETE, DROP, TRUNCATE, UPDATE without WHERE. Requires explicit text confirmation. Cannot be bypassed.

Security built in, not bolted on

Every DBKnox plan includes AES-256-GCM encryption, MFA, RBAC, and a full audit trail — not just Enterprise.