Security

Secrets management

How Meridian handles API keys, environment variables, and sensitive configuration across development, CI, and production.

Never commit keys

API keys, database credentials, signing secrets, and license tokens must never appear in source code or version control. Meridian enforces this at the repository level with pre-commit hooks that scan for high-entropy strings matching known key patterns.

# .gitignore — always present in every Meridian repo
.env
.env.local
.env.production
*.pem
*.key

If a secret is accidentally committed, rotate it immediately and force-push a cleaned history. A compromised key invalidates the entire trust chain.

Use .env files

All secrets flow through environment variables. The loader reads from .env.local in development and from Vercel Environment Variables in production. Never hardcode fallback values — fail fast if a required variable is missing.

MERIDIAN_LICENSE_KEY=sk_live_...
UPSTASH_REDIS_URL=https://...
UPSTASH_REDIS_TOKEN=...
DISCORD_BOT_TOKEN=...
SELLAUTH_API_KEY=...

Rotate often

Every secret in Meridian has a maximum lifetime. License signing keys rotate every 90 days. API tokens rotate every 30 days. Session signing secrets rotate on every deploy. Automated rotation scripts run in CI and publish new values to Vercel before revoking the old ones — zero-downtime rotation is non-negotiable.

  • Ed25519 license keys — 90-day rotation
  • Upstash Redis tokens — 30-day rotation
  • Session HMAC secrets — per-deploy rotation

Scope per tier

Not every component needs every secret. The loader binary only receives the public verification key — never the private signing key. The dashboard only receives read-scoped Redis tokens. The Discord bot only receives the bot token and a webhook secret. Principle of least privilege applied at the environment-variable level.

ComponentSecrets granted
Loader (C++)Public Ed25519 key only
DashboardRead-scoped Redis, SellAuth API
Discord botBot token, webhook secret
CI pipelineVercel deploy hook, signing key

Quick reference

  • .env.local — local development secrets, gitignored
  • Vercel env vars — production secrets, encrypted at rest
  • CI secrets — GitHub Actions encrypted secrets for rotation jobs
  • 1Password — shared vault for emergency recovery keys