Enterprise Deployment
Tank supports enterprise deployments with OIDC single sign-on, on-premises hosting, and air-gapped environments.Architecture (Self-Hosted)
OIDC Single Sign-On
Supported Identity Providers
- Okta
- Azure Active Directory (Entra ID)
- Google Workspace
- Auth0
- Any OpenID Connect compliant provider
Configuration
Set environment variables in.env or .env.local:
Discovery URL vs Manual Endpoints
Discovery URL (preferred):- Automatically fetches all OIDC endpoints
- Self-healing if provider changes URLs
- Standard OpenID Connect discovery
- Explicit control over each endpoint
- Required if IdP doesn’t support discovery
- More configuration overhead
Better Auth Configuration
The OIDC plugin is configured inapps/web/lib/auth.ts:
IdP Configuration Examples
Okta
- Create new App Integration (OIDC - Web Application)
- Set redirect URI:
https://tankpkg.example.com/api/auth/callback/oidc - Copy Client ID and Client Secret
- Get Discovery URL:
https://{org}.okta.com/.well-known/openid-configuration
Azure AD (Entra ID)
- Register new App Registration
- Add redirect URI:
https://tankpkg.example.com/api/auth/callback/oidc - Create client secret in Certificates & Secrets
- Copy Application (client) ID and Directory (tenant) ID
Google Workspace
- Create OAuth 2.0 Client ID in Google Cloud Console
- Add authorized redirect URI:
https://tankpkg.example.com/api/auth/callback/oidc - Copy Client ID and Client Secret
Login Flow
- User visits
https://tankpkg.example.com/login - Clicks “Sign in with ”
- Redirected to IdP authorization page
- User authenticates with corporate credentials
- IdP redirects back with authorization code
- Tank exchanges code for access token
- Fetches user info from IdP
- Creates/updates user in database
- Establishes session cookie
- Sessions stored in PostgreSQL (
sessiontable) - Optional Redis for session caching
- Configurable expiration (default: 7 days)
On-Premises Deployment
Quick Start
Docker Compose Stack
Database Migrations
Tank does not auto-run migrations on startup. Development:Storage Backend
Tank supports multiple storage providers:Supabase (Cloud)
MinIO (Self-Hosted)
S3-Compatible
Security Checklist
Secrets Management
- Use strong values for
BETTER_AUTH_SECRET(32+ bytes, cryptographically random) - Rotate secrets regularly (DB passwords, Redis, MinIO credentials)
- Store in secret manager (HashiCorp Vault, Kubernetes Secrets, Docker Secrets)
- Never commit
.envfiles to version control
Network Segmentation
- Private network for DB, Redis, MinIO, Scanner
- Expose only web app through ingress/load balancer
- TLS termination at load balancer (Let’s Encrypt, corporate CA)
- Firewall rules to restrict outbound scanner traffic
Authentication
- Enforce OIDC for all user authentication (disable GitHub OAuth in production)
- MFA required at IdP level
- Short session lifetimes (default: 7 days, consider 1 day for high-security)
- IP allowlisting for admin routes (optional)
Data Protection
- Snapshot/backup PostgreSQL daily (automated via
pg_dumpcron) - Replicate object storage to secondary region
- Encrypt at rest (PostgreSQL TDE, S3 SSE, MinIO encryption)
- Encrypt in transit (TLS everywhere, no plaintext HTTP)
Audit Logging
All admin actions logged toaudit_events table:
api_key.create,api_key.revokeskill.publish,skill.deleteuser.promote_admin,user.disableorg.create,org.invite,org.remove_member
Scanner Isolation
- Restrict outbound internet where possible (allow package registries if needed)
- Run in sandboxed container (Docker, gVisor, Kata Containers)
- Resource limits (CPU, memory, disk I/O)
- Timeout enforcement (max 5 minutes per scan)
Observability
Logging
Structured logs via Pino → Loki:Metrics
Next.js Built-in:- Web Vitals (CLS, FID, LCP)
- API route latencies
- React Server Component timings
Health Checks
Current Scope and Limitations
Implemented:- Single-tenant env-driven OIDC SSO
- On-premises deployment via Docker Compose
- Pluggable storage backends (Supabase, MinIO, S3)
- Audit logging for admin actions
- Multi-tenant SSO (per-organization IdP config UI)
- HA/multi-region replication
- SAML 2.0 support (OIDC only)
- Automated database migration runner
- Built-in backup/restore tooling
Next Steps: