fix(security): harden auth, tenant scoping, and scrub secrets
Require session on APIs, scope KPIs/activos/simulate to the user tenant, strip real JWTs from .env.example, and add health/smoke/docs for 4Ventures ops. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
24
docs/CONVERGENCE.md
Normal file
24
docs/CONVERGENCE.md
Normal file
@@ -0,0 +1,24 @@
|
||||
# Un solo producto: 4Ventures Centro de Mando
|
||||
|
||||
## Source of truth
|
||||
|
||||
Este repo → https://app.4ventures.es + Supabase + n8n.
|
||||
|
||||
## Identidad
|
||||
|
||||
- Operador: `marketing@4ventures.es`
|
||||
- Clientes = tenants aislados por `tenant_id` / slug
|
||||
- Branding y rutas siempre 4Ventures
|
||||
|
||||
## Roadmap de piezas
|
||||
|
||||
1. Seguridad / RLS / rotación de secretos
|
||||
2. Creatividades (review + Storage)
|
||||
3. ETL/OAuth como complemento a n8n
|
||||
4. Ops digest / alertas
|
||||
|
||||
## No hacer
|
||||
|
||||
- Segundo portal por cliente
|
||||
- Nombrar el producto o el repo con un slug de cliente
|
||||
- Commitear `.env.local` o JWTs
|
||||
7
docs/IDENTITY.md
Normal file
7
docs/IDENTITY.md
Normal file
@@ -0,0 +1,7 @@
|
||||
# Identidad operativa 4Ventures
|
||||
|
||||
- Producto: **Centro de Mando** (`app.4ventures.es`)
|
||||
- Repo: `/Users/4ventures/4ventures-client-portal` ↔ Gitea `Marketing/4ventures-client-portal`
|
||||
- Operador plataforma: `marketing@4ventures.es`
|
||||
- El producto es siempre **4Ventures**. Los clientes son tenants (`slug`), nunca el nombre del monorepo ni de variables globales.
|
||||
- No usar nombres de cliente individuales como identidad del proyecto.
|
||||
33
docs/RUNBOOK.md
Normal file
33
docs/RUNBOOK.md
Normal file
@@ -0,0 +1,33 @@
|
||||
# Runbook — Centro de Mando 4Ventures
|
||||
|
||||
Operador: `marketing@4ventures.es`
|
||||
|
||||
## Health
|
||||
|
||||
```bash
|
||||
curl -sf https://app.4ventures.es/api/health
|
||||
./scripts/smoke.sh https://app.4ventures.es
|
||||
```
|
||||
|
||||
## Deploy (Dokploy)
|
||||
|
||||
1. Push a `main` en Gitea `Marketing/4ventures-client-portal`.
|
||||
2. Dokploy rebuild del servicio `app`.
|
||||
3. Env: `NEXT_PUBLIC_SUPABASE_*`, `SUPABASE_SERVICE_ROLE_KEY`, `ANTHROPIC_API_KEY`.
|
||||
4. Smoke: `/login` → KPIs → simulador → chat.
|
||||
|
||||
## Alta cliente
|
||||
|
||||
UI `/dashboard/agencia` (roles admin/team) o RPC `provision_client`.
|
||||
|
||||
## Atribución
|
||||
|
||||
```html
|
||||
<script src="https://app.4ventures.es/_4v_attr.js" defer></script>
|
||||
```
|
||||
|
||||
`POST https://n8n-agencia.4ventures.es/webhook/lead-inbound`
|
||||
|
||||
## Incidentes
|
||||
|
||||
Ver `SECURITY.md`.
|
||||
Reference in New Issue
Block a user