Files
dd0c/products/shared
Max Mayfield be3f37cfdd
Some checks failed
CI — P2 Drift (Go + Node) / agent (push) Successful in 45s
CI — P2 Drift (Go + Node) / saas (push) Successful in 28s
CI — P3 Alert / test (push) Successful in 24s
CI — P4 Portal / test (push) Successful in 27s
CI — P5 Cost / test (push) Successful in 26s
CI — P6 Run / saas (push) Successful in 25s
CI — P2 Drift (Go + Node) / build-push (push) Failing after 46s
CI — P3 Alert / build-push (push) Failing after 38s
CI — P4 Portal / build-push (push) Failing after 50s
CI — P5 Cost / build-push (push) Failing after 22s
CI — P6 Run / build-push (push) Failing after 1m3s
Fix CRITICAL auth bypass: exact match for login/signup paths
startsWith('/api/v1/auth/login') allowed any path with that prefix
to bypass authentication (e.g. /api/v1/auth/login-anything).
Changed to exact path match with query string stripping.
Fixed across all 5 products + shared/auth.ts.
2026-03-02 20:35:28 +00:00
..

dd0c Shared Modules

Reusable code shared across all dd0c products.

Files

  • auth.ts — JWT + API key authentication middleware, RBAC, login/signup routes
  • db.ts — PostgreSQL connection pool with RLS withTenant() helper

Usage

Copy into each product's src/ directory, or symlink during build. These are kept here as the canonical source of truth.

Auth Flow

  1. JWT (Browser/API): Authorization: Bearer <token> → decoded → req.tenantId, req.userId, req.userRole
  2. API Key (Agent/CLI): X-API-Key: dd0c_<32hex> → prefix lookup → bcrypt verify → tenant context
  3. Webhook (HMAC): Per-provider signature validation (skips JWT middleware)
  4. Slack (Signing Secret): Slack request signature verification (skips JWT middleware)

RBAC Hierarchy

owner > admin > member > viewer

Use requireRole(req, reply, 'admin') in route handlers for access control.