Skip to Content
SPAPS is proprietary hosted SaaS. Paid access required; pre-1.0 contracts may change. Terms and access
Maintainer OperationsSecurity Invariants

Security Invariants

SPAPS is security-sensitive because it touches identity, payment state, wallet signatures, email, webhooks, and encrypted PII. The code uses startup validation and dependency checks to fail closed before unsafe configuration can receive traffic.

Startup Invariants

InvariantWhy it exists
JWT and refresh secrets must be present for SPAPS settingsTokens cannot be trusted without signing material
Legacy API-key auth must be disabled in productionPlaintext legacy key paths are migration-only
Wildcard CORS with credentials is rejected in productionBrowser credentials must not be exposed to arbitrary origins
Webhook destination governance must be enabled in productionWebhook delivery should not target arbitrary domains
Self-service endpoints need network boundaries in productionOperator tools should not be internet-open
PII-enabled applications require SPAPS_PII_MASTER_KEYEncrypted fields must not fail open
Production email overrides are rejectedTest recipient overrides must not leak into production

Runnable Checklist

CheckCommand or signalExpected resultFailure mode
Local persona mode is explicitcurl -fsS http://localhost:3301/health/local-modeResponse names local-mode state and hintsLocal-mode docs or runtime mode are stale
Readiness fails closed on dependenciescurl -fsS http://localhost:3301/health/readyDatabase, Redis, and PII checks are namedPII or dependency startup invariant is unresolved
Browser origins are allowlistedInspect the owning app row and CORS_ALLOW_ORIGINSNo wildcard credentialed production originPublishable-key traffic could cross app boundaries
Webhook destinations are governedCheck WEBHOOK_ALLOWED_DOMAINS before productionDestination policy exists for outbound webhooksWebhook delivery can target arbitrary domains
PII key exists when neededCheck SPAPS_PII_MASTER_KEY in the runtime secret sourcePII-enabled apps have encryption materialEncrypted fields cannot be safely read or written

Request-time Invariants

Common Mistakes

A local environment containing production credentials is not a safe local environment. Startup safety exists to catch that case before a developer accidentally emails, charges, or leaks real data.

  • Loosening startup checks to make local boot easier.
  • Assuming a service secret can replace user identity.
  • Allowing arbitrary webhook destinations during production testing.

See Also