Scaffold dd0c/cost: Welford baseline, anomaly scorer, governance engine, tests
- Welford online algorithm for running mean/stddev baselines
- Anomaly scorer: z-score → 0-100 mapping, property-based tests (10K runs, fast-check)
- Governance engine: 14-day auto-promotion with FP rate gate, injectable Clock
- Panic mode: defaults to active (safe) when Redis unreachable
- Tests: 12 scorer cases (incl 2x 10K property-based), 9 governance cases, 3 panic mode cases
- PostgreSQL schema with RLS: baselines (optimistic locking), anomalies, remediation_actions
- Fly.io config, Dockerfile
2026-03-01 02:52:53 +00:00
|
|
|
{
|
|
|
|
|
"name": "dd0c-cost",
|
|
|
|
|
"version": "0.1.0",
|
|
|
|
|
"private": true,
|
|
|
|
|
"type": "module",
|
|
|
|
|
"scripts": {
|
|
|
|
|
"dev": "tsx watch src/index.ts",
|
|
|
|
|
"build": "tsc",
|
|
|
|
|
"start": "node dist/index.js",
|
|
|
|
|
"test": "vitest run",
|
|
|
|
|
"lint": "eslint src/ tests/"
|
|
|
|
|
},
|
|
|
|
|
"dependencies": {
|
2026-03-03 00:14:39 +00:00
|
|
|
"@aws-sdk/client-cloudtrail": "^3.600.0",
|
|
|
|
|
"@aws-sdk/client-cost-explorer": "^3.600.0",
|
|
|
|
|
"@aws-sdk/client-dynamodb": "^3.600.0",
|
|
|
|
|
"@aws-sdk/lib-dynamodb": "^3.600.0",
|
Scaffold dd0c/cost: Welford baseline, anomaly scorer, governance engine, tests
- Welford online algorithm for running mean/stddev baselines
- Anomaly scorer: z-score → 0-100 mapping, property-based tests (10K runs, fast-check)
- Governance engine: 14-day auto-promotion with FP rate gate, injectable Clock
- Panic mode: defaults to active (safe) when Redis unreachable
- Tests: 12 scorer cases (incl 2x 10K property-based), 9 governance cases, 3 panic mode cases
- PostgreSQL schema with RLS: baselines (optimistic locking), anomalies, remediation_actions
- Fly.io config, Dockerfile
2026-03-01 02:52:53 +00:00
|
|
|
"@fastify/cors": "^9.0.0",
|
Security hardening: auth encapsulation, pool restriction, rate limiting, invites, async webhooks
Phase 1 (Security Critical):
- Auth plugin encapsulation: replaced global addHook with Fastify plugin scope
- Removed startsWith URL matching; public routes registered outside auth scope
- JWT verify now enforces algorithms: ['HS256'] (prevents algorithm confusion)
- Raw pool no longer exported from db.ts; systemQuery() + getPoolForAuth() instead
- withTenant() remains primary tenant-scoped query path
Phase 2 (Infrastructure):
- docker-compose.yml: all secrets via env var substitution (${VAR:-default})
- Per-service Postgres users (dd0c_drift, dd0c_alert, etc.) in docker-init-db.sh
- .env.example with all configurable secrets
- build-push.sh uses $REGISTRY_PASSWORD instead of hardcoded
- .gitignore excludes .env files
- @fastify/rate-limit: 100 req/min global, 5/min login, 3/min signup
- CORS_ORIGIN default changed from '*' to 'http://localhost:5173'
Phase 3 (Product):
- Team invite flow: tenant_invites table, POST /invite, GET /invites, DELETE /invites/:id
- Signup accepts optional invite_token to join existing tenant
- Async webhook ingestion (P3): LPUSH to Redis, BRPOP worker, dead-letter queue
Console:
- All 5 product modules wired: drift, alert, portal, cost, run
- PageHeader accepts children prop
- 71 modules, 70KB gzipped production build
All 6 projects compile clean (tsc --noEmit).
2026-03-02 23:53:55 +00:00
|
|
|
"@fastify/rate-limit": "^9.1.0",
|
2026-03-03 00:14:39 +00:00
|
|
|
"@slack/web-api": "^7.1.0",
|
|
|
|
|
"fastify": "^4.28.0",
|
Scaffold dd0c/cost: Welford baseline, anomaly scorer, governance engine, tests
- Welford online algorithm for running mean/stddev baselines
- Anomaly scorer: z-score → 0-100 mapping, property-based tests (10K runs, fast-check)
- Governance engine: 14-day auto-promotion with FP rate gate, injectable Clock
- Panic mode: defaults to active (safe) when Redis unreachable
- Tests: 12 scorer cases (incl 2x 10K property-based), 9 governance cases, 3 panic mode cases
- PostgreSQL schema with RLS: baselines (optimistic locking), anomalies, remediation_actions
- Fly.io config, Dockerfile
2026-03-01 02:52:53 +00:00
|
|
|
"ioredis": "^5.4.0",
|
|
|
|
|
"jsonwebtoken": "^9.0.2",
|
2026-03-03 00:14:39 +00:00
|
|
|
"pg": "^8.12.0",
|
Scaffold dd0c/cost: Welford baseline, anomaly scorer, governance engine, tests
- Welford online algorithm for running mean/stddev baselines
- Anomaly scorer: z-score → 0-100 mapping, property-based tests (10K runs, fast-check)
- Governance engine: 14-day auto-promotion with FP rate gate, injectable Clock
- Panic mode: defaults to active (safe) when Redis unreachable
- Tests: 12 scorer cases (incl 2x 10K property-based), 9 governance cases, 3 panic mode cases
- PostgreSQL schema with RLS: baselines (optimistic locking), anomalies, remediation_actions
- Fly.io config, Dockerfile
2026-03-01 02:52:53 +00:00
|
|
|
"pino": "^9.1.0",
|
|
|
|
|
"uuid": "^9.0.1",
|
2026-03-03 00:14:39 +00:00
|
|
|
"zod": "^3.23.0"
|
Scaffold dd0c/cost: Welford baseline, anomaly scorer, governance engine, tests
- Welford online algorithm for running mean/stddev baselines
- Anomaly scorer: z-score → 0-100 mapping, property-based tests (10K runs, fast-check)
- Governance engine: 14-day auto-promotion with FP rate gate, injectable Clock
- Panic mode: defaults to active (safe) when Redis unreachable
- Tests: 12 scorer cases (incl 2x 10K property-based), 9 governance cases, 3 panic mode cases
- PostgreSQL schema with RLS: baselines (optimistic locking), anomalies, remediation_actions
- Fly.io config, Dockerfile
2026-03-01 02:52:53 +00:00
|
|
|
},
|
|
|
|
|
"devDependencies": {
|
2026-03-03 00:14:39 +00:00
|
|
|
"@types/jsonwebtoken": "^9.0.6",
|
Scaffold dd0c/cost: Welford baseline, anomaly scorer, governance engine, tests
- Welford online algorithm for running mean/stddev baselines
- Anomaly scorer: z-score → 0-100 mapping, property-based tests (10K runs, fast-check)
- Governance engine: 14-day auto-promotion with FP rate gate, injectable Clock
- Panic mode: defaults to active (safe) when Redis unreachable
- Tests: 12 scorer cases (incl 2x 10K property-based), 9 governance cases, 3 panic mode cases
- PostgreSQL schema with RLS: baselines (optimistic locking), anomalies, remediation_actions
- Fly.io config, Dockerfile
2026-03-01 02:52:53 +00:00
|
|
|
"@types/node": "^20.14.0",
|
|
|
|
|
"@types/pg": "^8.11.0",
|
|
|
|
|
"@types/uuid": "^9.0.8",
|
2026-03-03 00:14:39 +00:00
|
|
|
"eslint": "^9.5.0",
|
|
|
|
|
"fast-check": "^3.19.0",
|
|
|
|
|
"tsx": "^4.15.0",
|
2026-03-03 06:39:20 +00:00
|
|
|
"typescript": "^5.9.3",
|
2026-03-03 00:14:39 +00:00
|
|
|
"vitest": "^1.6.0"
|
Scaffold dd0c/cost: Welford baseline, anomaly scorer, governance engine, tests
- Welford online algorithm for running mean/stddev baselines
- Anomaly scorer: z-score → 0-100 mapping, property-based tests (10K runs, fast-check)
- Governance engine: 14-day auto-promotion with FP rate gate, injectable Clock
- Panic mode: defaults to active (safe) when Redis unreachable
- Tests: 12 scorer cases (incl 2x 10K property-based), 9 governance cases, 3 panic mode cases
- PostgreSQL schema with RLS: baselines (optimistic locking), anomalies, remediation_actions
- Fly.io config, Dockerfile
2026-03-01 02:52:53 +00:00
|
|
|
}
|
|
|
|
|
}
|