Skip to main content

Security (OWASP & 12-Factor)

Security baseline for every service and every tenant. Two reference frames: OWASP ASVS / Top 10 (application security) and 12-Factor (config/operations hygiene).

12-Factor checklist​

FactorApplication here
I. CodebaseOne repo, many per-tenant deploys (Multi-Tenancy)
II. DependenciesExplicit lockfiles; SCA scanning in CI
III. ConfigAll env/secret config injected; nothing brand-specific hard-coded
IV. Backing servicesPostgres/Mongo/Redis/S3/Hyperswitch as attached resources via URLs
V. Build/release/runImmutable images; release = image + config; reproducible
VI. ProcessesStateless services; state in PG/Mongo/Redis/S3
VII. Port bindingEach service self-contained behind the gateway
VIII. ConcurrencyHorizontal scale per service; BullMQ workers scale independently
IX. DisposabilityFast startup/shutdown; idempotent consumers; graceful drain
X. Dev/prod paritySame images across envs; differences only in config
XI. LogsStructured logs to a central sink (stdout → collector)
XII. Admin processesMigrations/jobs run as one-off tasks in the same image

OWASP Top 10 — controls​

RiskControl
A01 Broken Access ControlCapability + row-level scope (RBAC); deny-by-default; server-derived scope only
A02 Cryptographic FailuresTLS everywhere; secrets in k8s secrets/Vault; encrypt PII at rest; no secrets in DB config doc
A03 InjectionParameterized queries (MikroORM/Mongoose); input validation (class-validator / zod); output encoding
A04 Insecure DesignThreat-model per module; signed webhooks; outbox + idempotency; least privilege
A05 MisconfigurationHardened base images; no default creds; security headers; CSP on storefront
A06 Vulnerable ComponentsSCA + image scanning in CI; pinned/patched deps
A07 Auth FailuresShort-lived JWT + refresh rotation; MFA for admin/finance; rate-limit + lockout; secure session in Redis
A08 Integrity FailuresSigned images; verify in/out webhook signatures (HMAC); SRI where relevant
A09 Logging/MonitoringCentral logs, audit trail on all mutations, alerting on auth anomalies + DLQ
A10 SSRFAllow-list outbound (marketplace/courier/automation endpoints); no user-controlled fetch

Payments & PCI​

  • Card data handled by Hyperswitch + gateways; the platform avoids storing PANs.
  • Webhooks from Hyperswitch/gateways are signature-verified.
  • Reconciliation data (non-card) stored in the Finance Postgres schema. See Payments.

Tenant isolation​

  • Separate namespace, DBs, buckets, and secrets per tenant → no cross-tenant data path.
  • Per-tenant keys for Hyperswitch/courier/marketplace/automation.

Secrets management​

  • Env/k8s secrets/Vault only. Never in the Mongo TenantConfig document (that holds non-secret branding/behavior only).
  • Rotation policy for gateway/courier/marketplace/webhook secrets.

Webhooks (in & out)​

  • Inbound (Hyperswitch, Shiprocket, marketplaces): verify signature, check timestamp/nonce, idempotent processing.
  • Outbound (Zapier/Pabbly): HMAC-sign payloads with the tenant secret; document verification for receivers (Automation).

Privacy / compliance​

  • PII minimization; encryption at rest for personal data.
  • Data export/delete pathways (customer rights).
  • Audit logs retained per policy.

CI security gates​

  • SAST + dependency/SCA + container scan must pass.
  • No high/critical findings merged without sign-off.
  • See Testing Strategy.