wizz-method 2.2.0 → 2.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +62 -62
- package/SECURITY.md +15 -16
- package/THIRD-PARTY-NOTICES.md +49 -49
- package/package.json +1 -1
- package/src/bmm-skills/1-analysis/wizz-agent-analyst/customize.toml +1 -1
- package/src/bmm-skills/2-plan-workflows/wizz-agent-pm/customize.toml +1 -1
- package/src/bmm-skills/2-plan-workflows/wizz-agent-ux-designer/customize.toml +1 -1
- package/src/bmm-skills/3-solutioning/wizz-agent-architect/customize.toml +1 -1
- package/src/bmm-skills/4-implementation/wizz-agent-dev/customize.toml +1 -1
- package/src/core-skills/_shared/handoff-protocol.md +72 -71
- package/src/core-skills/wizz-review-adversarial-general/SKILL.md +1 -1
- package/src/modules/lowticket/skills/wizz-lowticket-funil/references/copy-das-paginas.md +39 -39
- package/src/modules/lowticket/skills/wizz-lowticket-funil/references/mapa-do-funil.md +23 -23
- package/src/modules/lowticket/skills/wizz-lowticket-metodologia/CATALOGO.md +72 -72
- package/src/modules/lowticket/skills/wizz-lowticket-metodologia/knowledge/01-principios.md +10 -10
- package/src/modules/lowticket/skills/wizz-lowticket-metodologia/knowledge/02-diagnostico-funil.md +50 -50
- package/src/modules/lowticket/skills/wizz-lowticket-metodologia/knowledge/03-campanha-bidcap.md +68 -68
- package/src/modules/lowticket/skills/wizz-lowticket-metodologia/knowledge/04-criativos.md +44 -44
- package/src/modules/lowticket/skills/wizz-lowticket-metodologia/knowledge/04a-criativos-ia.md +77 -77
- package/src/modules/lowticket/skills/wizz-lowticket-metodologia/knowledge/04b-criativos-formatos.md +121 -121
- package/src/modules/lowticket/skills/wizz-lowticket-metodologia/knowledge/05-oferta.md +35 -35
- package/src/modules/lowticket/skills/wizz-lowticket-metodologia/knowledge/06-pagina-vendas.md +122 -122
- package/src/modules/lowticket/skills/wizz-lowticket-metodologia/knowledge/06a-instagram.md +93 -93
- package/src/modules/lowticket/skills/wizz-lowticket-metodologia/knowledge/06b-player-vsl.md +57 -57
- package/src/modules/lowticket/skills/wizz-lowticket-metodologia/knowledge/07-funil-upsell.md +83 -83
- package/src/modules/lowticket/skills/wizz-lowticket-metodologia/knowledge/07a-copy-humanizacao.md +61 -61
- package/src/modules/lowticket/skills/wizz-lowticket-metodologia/knowledge/08-pesquisa-publico.md +11 -11
- package/src/modules/lowticket/skills/wizz-lowticket-metodologia/knowledge/09-especialista-coproducao.md +26 -26
- package/src/modules/lowticket/skills/wizz-lowticket-metodologia/knowledge/10-levantar-caixa.md +29 -29
- package/src/modules/lowticket/skills/wizz-lowticket-metodologia/knowledge/11-checklist-roi.md +22 -22
- package/src/modules/lowticket/skills/wizz-lowticket-metodologia/knowledge/12-mineracao-ofertas.md +80 -80
- package/src/modules/lowticket/skills/wizz-lowticket-metodologia/knowledge/12a-mineracao-veredito.md +72 -72
- package/src/modules/lowticket/skills/wizz-lowticket-metodologia/knowledge/12b-fabrica-de-ofertas.md +63 -63
- package/src/modules/lowticket/skills/wizz-lowticket-metodologia/knowledge/12c-anatomia-low-ticket.md +71 -71
- package/src/modules/lowticket/skills/wizz-lowticket-metodologia/knowledge/13-benchmarks-vsl.md +6 -6
- package/src/modules/lowticket/skills/wizz-lowticket-metodologia/knowledge/14-vocabulario.md +53 -51
- package/src/modules/lowticket/skills/wizz-lowticket-metodologia/knowledge/15-como-estender.md +26 -26
- package/src/modules/lowticket/skills/wizz-lowticket-metodologia/knowledge/17-rastreamento.md +76 -76
- package/src/modules/lowticket/skills/wizz-lowticket-metodologia/knowledge/18-copy-desejo-oferta.md +149 -149
- package/src/modules/lowticket/skills/wizz-lowticket-metodologia/knowledge/INDEX.md +45 -45
- package/src/modules/lowticket/skills/wizz-lowticket-metodologia/knowledge/guardrails.md +45 -45
- package/src/modules/lowticket/skills/wizz-lowticket-metodologia/knowledge/pontos-em-aberto.md +64 -66
- package/src/modules/lowticket/skills/wizz-lowticket-minerador/references/rubrica.md +63 -63
- package/src/modules/lowticket/skills/wizz-lowticket-pagina/references/metas-e-medicao.md +23 -23
- package/src/modules/lowticket/skills/wizz-lowticket-pagina/references/padroes-de-codigo.md +50 -50
- package/src/modules/lowticket/skills/wizz-lowticket-trafego/references/formato-do-diagnostico.md +9 -9
- package/src/modules/lowticket/skills/wizz-lowticket-trafego/references/reguas.md +42 -42
- package/src/modules/wizz/README.md +27 -27
- package/src/modules/wizz/_shared/cerebro.md +37 -37
- package/src/modules/wizz/_shared/communication-rules.md +15 -15
- package/src/modules/wizz/_shared/despacho-barato.md +6 -6
- package/src/modules/wizz/_shared/encerramento.md +23 -23
- package/src/modules/wizz/_shared/model-ladder.md +29 -29
- package/src/modules/wizz/_shared/planning-gate.md +30 -30
- package/src/modules/wizz/_shared/token-economy.md +28 -28
- package/src/modules/wizz/_shared/video-pipeline.md +42 -42
- package/src/modules/wizz/agents/wizz-ads/SKILL.md +16 -16
- package/src/modules/wizz/agents/wizz-ads/customize.toml +21 -21
- package/src/modules/wizz/agents/wizz-copy/SKILL.md +18 -18
- package/src/modules/wizz/agents/wizz-copy/customize.toml +24 -24
- package/src/modules/wizz/agents/wizz-designer/SKILL.md +24 -24
- package/src/modules/wizz/agents/wizz-designer/customize.toml +29 -29
- package/src/modules/wizz/agents/wizz-growth/SKILL.md +20 -20
- package/src/modules/wizz/agents/wizz-growth/customize.toml +34 -34
- package/src/modules/wizz/agents/wizz-maestro/SKILL.md +63 -63
- package/src/modules/wizz/agents/wizz-maestro/customize.toml +38 -38
- package/src/modules/wizz/agents/wizz-memoria/SKILL.md +19 -19
- package/src/modules/wizz/agents/wizz-memoria/customize.toml +24 -24
- package/src/modules/wizz/agents/wizz-qa/SKILL.md +22 -22
- package/src/modules/wizz/agents/wizz-qa/customize.toml +29 -29
- package/src/modules/wizz/agents/wizz-seo/SKILL.md +19 -19
- package/src/modules/wizz/agents/wizz-seo/customize.toml +27 -27
- package/src/modules/wizz/agents/wizz-social/SKILL.md +53 -53
- package/src/modules/wizz/agents/wizz-social/customize.toml +37 -37
- package/src/modules/wizz/agents/wizz-social/knowledge/analise-imagem-referencia.md +20 -20
- package/src/modules/wizz/agents/wizz-social/knowledge/biblioteca-prompts-imagem.md +71 -71
- package/src/modules/wizz/agents/wizz-social/knowledge/blueprint-roteiro-viral.md +196 -196
- package/src/modules/wizz/agents/wizz-social/knowledge/legenda-instagram.md +32 -32
- package/src/modules/wizz/agents/wizz-social/knowledge/prompts-imagem-video.md +48 -48
- package/src/modules/wizz/module.yaml +28 -28
- package/src/modules/wizz/overrides/wizz-agent-analyst.toml +17 -17
- package/src/modules/wizz/overrides/wizz-agent-architect.toml +21 -21
- package/src/modules/wizz/overrides/wizz-agent-dev.toml +20 -20
- package/src/modules/wizz/overrides/wizz-agent-pm.toml +11 -11
- package/src/modules/wizz/overrides/wizz-agent-tech-writer.toml +14 -14
- package/src/modules/wizz/overrides/wizz-agent-ux-designer.toml +14 -14
- package/src/modules/wizz/subagents/codex/wizz-exec-haiku.toml +17 -17
- package/src/modules/wizz/subagents/codex/wizz-exec-opus.toml +19 -19
- package/src/modules/wizz/subagents/codex/wizz-exec-review.toml +18 -18
- package/src/modules/wizz/subagents/codex/wizz-exec-sonnet.toml +18 -18
- package/src/modules/wizz/subagents/gemini/wizz-exec-haiku.md +17 -17
- package/src/modules/wizz/subagents/gemini/wizz-exec-opus.md +19 -19
- package/src/modules/wizz/subagents/gemini/wizz-exec-review.md +18 -18
- package/src/modules/wizz/subagents/gemini/wizz-exec-sonnet.md +18 -18
- package/src/modules/wizz/subagents/opencode/wizz-exec-haiku.md +17 -17
- package/src/modules/wizz/subagents/opencode/wizz-exec-opus.md +19 -19
- package/src/modules/wizz/subagents/opencode/wizz-exec-review.md +18 -18
- package/src/modules/wizz/subagents/opencode/wizz-exec-sonnet.md +18 -18
- package/src/modules/wizz/subagents/spec.yaml +84 -83
- package/src/modules/wizz/subagents/wizz-exec-haiku.md +17 -17
- package/src/modules/wizz/subagents/wizz-exec-opus.md +19 -19
- package/src/modules/wizz/subagents/wizz-exec-review.md +18 -18
- package/src/modules/wizz/subagents/wizz-exec-sonnet.md +18 -18
- package/src/skills-lib/cerebro/SKILL.md +61 -61
- package/src/skills-lib/cerebro/references/comandos-pesquisa-e-memoria.md +46 -46
- package/src/skills-lib/cerebro/references/comandos-rotina-e-captura.md +65 -65
- package/src/skills-lib/cerebro/references/comandos-sessao.md +74 -74
- package/src/skills-lib/ctc-align/SKILL.md +37 -37
- package/src/skills-lib/find-skills/SKILL.md +19 -19
- package/src/skills-lib/pesquisa-de-publico-do-piva/README.md +33 -33
- package/src/skills-lib/pesquisa-de-publico-do-piva/SKILL.md +42 -42
- package/src/skills-lib/pesquisa-de-publico-do-piva/prompts.md +20 -20
- package/src/skills-lib/references/premium-agency-rules.md +63 -63
- package/src/skills-lib/security-audit-pentest/SKILL.md +31 -31
- package/src/skills-lib/security-audit-pentest/references/stage-1-validacao-entrada.md +37 -37
- package/src/skills-lib/security-audit-pentest/references/stage-2-autorizacao.md +61 -61
- package/src/skills-lib/security-audit-pentest/references/stage-3-abuso-volume.md +37 -37
- package/src/skills-lib/security-audit-pentest/references/stage-4-vazamento-resposta.md +52 -52
- package/src/skills-lib/site-launch-kit/SKILL.md +42 -42
- package/src/skills-lib/site-launch-kit/references/01-cta-principal.md +20 -20
- package/src/skills-lib/site-launch-kit/references/02-barra-fixa-mobile.md +24 -24
- package/src/skills-lib/site-launch-kit/references/03-tempo-de-resposta.md +21 -21
- package/src/skills-lib/site-launch-kit/references/04-prova-social.md +22 -22
- package/src/skills-lib/site-launch-kit/references/05-faq-decisao.md +28 -28
- package/src/skills-lib/site-launch-kit/references/06-imagens-reais.md +27 -27
- package/src/skills-lib/site-launch-kit/references/07-endereco-como-chegar.md +25 -25
- package/src/skills-lib/site-launch-kit/references/08-titles.md +30 -30
- package/src/skills-lib/site-launch-kit/references/09-open-graph.md +23 -23
- package/src/skills-lib/site-launch-kit/references/10-breadcrumbs.md +23 -23
- package/src/skills-lib/site-launch-kit/references/11-alt-text.md +28 -28
- package/src/skills-lib/site-launch-kit/references/12-schema-local.md +22 -22
- package/src/skills-lib/site-launch-kit/references/13-robots-sitemap.md +26 -26
- package/src/skills-lib/site-launch-kit/references/14-privacidade-termos.md +27 -27
- package/src/skills-lib/site-launch-kit/references/15-medicao.md +23 -23
- package/src/skills-lib/wizz-ai-product-design/SKILL.md +70 -70
- package/src/skills-lib/wizz-auth-and-secrets/SKILL.md +78 -78
- package/src/skills-lib/wizz-caching-and-queues/SKILL.md +40 -40
- package/src/skills-lib/wizz-cloud-and-infra/SKILL.md +22 -22
- package/src/skills-lib/wizz-database-and-deps/SKILL.md +52 -52
- package/src/skills-lib/wizz-database-scaling/SKILL.md +31 -31
- package/src/skills-lib/wizz-desktop-security/SKILL.md +49 -49
- package/src/skills-lib/wizz-implementation-planner/SKILL.md +56 -56
- package/src/skills-lib/wizz-implementation-planner/references/folder-structure-and-dependencies.md +14 -14
- package/src/skills-lib/wizz-implementation-planner/references/implementation-phases.md +15 -15
- package/src/skills-lib/wizz-implementation-planner/references/implementation-types.md +9 -9
- package/src/skills-lib/wizz-implementation-planner/references/motion-path-implementation.md +19 -19
- package/src/skills-lib/wizz-implementation-planner/references/performance-plan.md +27 -27
- package/src/skills-lib/wizz-infrastructure/SKILL.md +21 -21
- package/src/skills-lib/wizz-inicio-de-projeto/SKILL.md +63 -63
- package/src/skills-lib/wizz-inicio-de-projeto/references/implementacao-api-forms.md +27 -27
- package/src/skills-lib/wizz-inicio-de-projeto/references/padroes-arquiteturais-e-pastas.md +31 -31
- package/src/skills-lib/wizz-inicio-de-projeto/references/seguranca-e-regras-codigo.md +21 -21
- package/src/skills-lib/wizz-launch-readiness/SKILL.md +61 -61
- package/src/skills-lib/wizz-launch-readiness/references/01-tecnico-build.md +16 -16
- package/src/skills-lib/wizz-launch-readiness/references/02-seguranca.md +16 -16
- package/src/skills-lib/wizz-launch-readiness/references/03-seo-descoberta.md +16 -16
- package/src/skills-lib/wizz-launch-readiness/references/04-analytics-medicao.md +15 -15
- package/src/skills-lib/wizz-launch-readiness/references/05-conteudo-prova-social.md +15 -15
- package/src/skills-lib/wizz-launch-readiness/references/06-legal-lgpd.md +15 -15
- package/src/skills-lib/wizz-launch-readiness/references/07-infra-deploy-rollback.md +16 -16
- package/src/skills-lib/wizz-launch-readiness/references/08-fusao-priorizacao.md +19 -19
- package/src/skills-lib/wizz-launch-readiness/references/09-persistencia-project-context.md +26 -26
- package/src/skills-lib/wizz-motion-3d-director/SKILL.md +70 -70
- package/src/skills-lib/wizz-motion-3d-director/references/image-to-video-workflow.md +34 -35
- package/src/skills-lib/wizz-motion-3d-director/references/motion-paths.md +70 -70
- package/src/skills-lib/wizz-motion-3d-director/references/performance-and-handoff.md +17 -17
- package/src/skills-lib/wizz-offer-forge/README.md +9 -9
- package/src/skills-lib/wizz-offer-forge/SKILL.md +64 -64
- package/src/skills-lib/wizz-offer-forge/references/empilhamento-valor.md +17 -17
- package/src/skills-lib/wizz-offer-forge/references/garantia-reversa.md +16 -16
- package/src/skills-lib/wizz-offer-forge/references/mecanismo-unico.md +19 -19
- package/src/skills-lib/wizz-offer-forge/references/ponte-trafego.md +17 -17
- package/src/skills-lib/wizz-premium-landing-ui-researcher/SKILL.md +36 -36
- package/src/skills-lib/wizz-premium-landing-ui-researcher/references/audit-protocol.md +81 -82
- package/src/skills-lib/wizz-premium-landing-ui-researcher/references/component-sources.md +105 -105
- package/src/skills-lib/wizz-premium-landing-ui-researcher/references/core-goal.md +39 -39
- package/src/skills-lib/wizz-premium-landing-ui-researcher/references/dashboard-and-portfolio-modes.md +49 -50
- package/src/skills-lib/wizz-premium-landing-ui-researcher/references/handoffs.md +33 -34
- package/src/skills-lib/wizz-premium-landing-ui-researcher/references/landing-page-strategy.md +141 -142
- package/src/skills-lib/wizz-premium-landing-ui-researcher/references/mandatory-process.md +24 -24
- package/src/skills-lib/wizz-premium-landing-ui-researcher/references/output-format-and-quality.md +73 -73
- package/src/skills-lib/wizz-premium-landing-ui-researcher/references/prompt-templates.md +4 -4
- package/src/skills-lib/wizz-premium-landing-ui-researcher/references/site-levels.md +282 -283
- package/src/skills-lib/wizz-premium-landing-ui-researcher/references/source-first-protocol.md +39 -39
- package/src/skills-lib/wizz-premium-landing-ui-researcher/references/source-links.md +8 -8
- package/src/skills-lib/wizz-premium-landing-ui-researcher/references/stack-and-visual-direction.md +63 -64
- package/src/skills-lib/wizz-router/SKILL.md +38 -38
- package/src/skills-lib/wizz-router/references/auditoria-360.md +12 -12
- package/src/skills-lib/wizz-router/references/routing-table-flat.md +80 -80
- package/src/skills-lib/wizz-tracking-audit/SKILL.md +48 -48
- package/src/skills-lib/wizz-tracking-audit/references/modo-diagnostico.md +43 -43
- package/src/skills-lib/wizz-tracking-audit/references/modo-implantacao.md +59 -59
- package/src/skills-lib/wizz-tracking-audit/references/utm-e-atribuicao.md +35 -35
- package/src/skills-lib/wizz-web-security/SKILL.md +35 -35
- package/src/skills-lib/wizz-web-security/references/checklist-deploy.md +50 -50
- package/src/skills-lib/wizz-web-security/references/headers-rate-limit-cors.md +33 -33
- package/src/skills-lib/wizz-web-security/references/owasp-top5-detalhado.md +36 -36
- package/tools/hooks/session-rules.js +14 -11
|
@@ -1,36 +1,36 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: wizz-cloud-and-infra
|
|
3
|
-
description:
|
|
3
|
+
description: Cloud cost optimization — right-sizing, spot instances, reserved instances, S3 lifecycle, auto-scaling, AWS/GCP cost audits. Use when the request involves reducing infra cost, cloud spend, cloud billing.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# Cloud and Infrastructure Cost Optimization
|
|
7
7
|
|
|
8
|
-
##
|
|
8
|
+
## Main cloud savings levers
|
|
9
9
|
|
|
10
10
|
### Compute (EC2, VPS, Cloud Run)
|
|
11
|
-
- **Right-sizing**:
|
|
12
|
-
- **Spot/Preemptible instances**:
|
|
13
|
-
- **Reserved instances**:
|
|
14
|
-
- **Auto-scaling**:
|
|
11
|
+
- **Right-sizing**: oversized instances are the most common mistake. Use CPU/RAM metrics from the last 30 days to size correctly
|
|
12
|
+
- **Spot/Preemptible instances**: for interruption-tolerant workloads, 60-90% savings
|
|
13
|
+
- **Reserved instances**: a 1-year commitment = ~40% discount vs. on-demand
|
|
14
|
+
- **Auto-scaling**: never leave fixed instances where traffic varies
|
|
15
15
|
|
|
16
16
|
### Storage
|
|
17
|
-
- **S3/Object Storage lifecycle policies**:
|
|
18
|
-
- **
|
|
19
|
-
- **Egress**:
|
|
17
|
+
- **S3/Object Storage lifecycle policies**: automatically move old files to cheaper tiers (Glacier, Nearline)
|
|
18
|
+
- **Unnecessary snapshots**: audit snapshots of disks that have already been deleted
|
|
19
|
+
- **Egress**: outbound traffic is expensive. A CDN solves most cases
|
|
20
20
|
|
|
21
|
-
###
|
|
22
|
-
- **
|
|
23
|
-
- **Connection pooling**: PgBouncer/RDS Proxy
|
|
24
|
-
- **
|
|
21
|
+
### Database
|
|
22
|
+
- **Read vs write**: separate read replicas. RDS Multi-AZ is only worth it for critical production
|
|
23
|
+
- **Connection pooling**: PgBouncer/RDS Proxy avoids the cost of bigger instances just to handle connections
|
|
24
|
+
- **Automatic backups**: set an appropriate retention period, don't leave it at the infinite default
|
|
25
25
|
|
|
26
26
|
### Kubernetes / Containers
|
|
27
|
-
- **Namespace resource limits**:
|
|
28
|
-
- **Idle pods**: use HPA (Horizontal Pod Autoscaler)
|
|
29
|
-
- **Container registry**:
|
|
27
|
+
- **Namespace resource limits**: without limits defined, pods consume everything
|
|
28
|
+
- **Idle pods**: use HPA (Horizontal Pod Autoscaler) to zero out replicas outside business hours
|
|
29
|
+
- **Container registry**: clean up old images, billed per GB stored
|
|
30
30
|
|
|
31
|
-
##
|
|
32
|
-
- [ ] CPU
|
|
33
|
-
- [ ]
|
|
34
|
-
- [ ] Snapshots/backups
|
|
35
|
-
- [ ] Egress
|
|
36
|
-
- [ ]
|
|
31
|
+
## Quick audit checklist
|
|
32
|
+
- [ ] Average CPU > 20% on the main instances?
|
|
33
|
+
- [ ] Any service without auto-scaling in production?
|
|
34
|
+
- [ ] Snapshots/backups with indefinite retention?
|
|
35
|
+
- [ ] Egress without a CDN on static assets?
|
|
36
|
+
- [ ] Database on a bigger instance than necessary?
|
|
@@ -1,81 +1,81 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: wizz-database-and-deps
|
|
3
3
|
description: >
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
query builder, RPC
|
|
4
|
+
Database and dependency security. Use when: reviewing database queries, checking for SQL injection,
|
|
5
|
+
auditing database permissions, encrypting PII, reviewing vulnerable packages, configuring Dependabot/Renovate,
|
|
6
|
+
auditing Supabase RPCs, verifying least privilege in the database. Use when the user mentions SQL,
|
|
7
|
+
query builder, Supabase RPC, npm/pnpm audit, Dependabot, vulnerable packages, PII in the database, or lock file.
|
|
8
8
|
---
|
|
9
9
|
|
|
10
10
|
# Database and Dependencies Security
|
|
11
11
|
|
|
12
|
-
##
|
|
12
|
+
## Database
|
|
13
13
|
|
|
14
14
|
### SQL Injection
|
|
15
|
-
-
|
|
16
|
-
-
|
|
17
|
-
-
|
|
18
|
-
-
|
|
15
|
+
- Always use parameterized queries or an ORM with correct binding
|
|
16
|
+
- Never concatenate user input into SQL
|
|
17
|
+
- Even with an ORM: raw queries need attention
|
|
18
|
+
- Test with payloads: `' OR '1'='1`, `'; DROP TABLE users;--`
|
|
19
19
|
|
|
20
|
-
###
|
|
21
|
-
|
|
20
|
+
### Supabase stack — how to prevent SQLi
|
|
21
|
+
The Supabase client is already parameterized by design:
|
|
22
22
|
```ts
|
|
23
|
-
//
|
|
23
|
+
// SAFE — query-builder: values passed as separate args
|
|
24
24
|
const { data } = await supabase
|
|
25
25
|
.from("captou_leads")
|
|
26
26
|
.select("*")
|
|
27
|
-
.eq("workspace_id", workspaceId) //
|
|
28
|
-
.ilike("name", `%${search}%`) //
|
|
27
|
+
.eq("workspace_id", workspaceId) // parameterized
|
|
28
|
+
.ilike("name", `%${search}%`) // parameterized (not concatenated into SQL)
|
|
29
29
|
|
|
30
|
-
//
|
|
30
|
+
// SAFE — RPC with named params
|
|
31
31
|
await supabase.rpc("find_captou_extraction_job_by_run_id", { run_id: runId })
|
|
32
32
|
|
|
33
|
-
//
|
|
33
|
+
// DANGEROUS — raw SQL with interpolation (avoid)
|
|
34
34
|
await supabase.rpc("exec_sql", { sql: `SELECT * WHERE id = '${id}'` })
|
|
35
35
|
```
|
|
36
36
|
|
|
37
|
-
**
|
|
37
|
+
**Important caveat:** RPC function bodies live in Postgres (outside the repo). Audit the Supabase dashboard for any RPC using `EXECUTE format('... %s', input)` with user input — that's server-side SQL injection.
|
|
38
38
|
|
|
39
|
-
###
|
|
40
|
-
-
|
|
41
|
-
-
|
|
42
|
-
-
|
|
43
|
-
- Read replicas:
|
|
44
|
-
- Supabase: `SUPABASE_SERVICE_ROLE_KEY`
|
|
39
|
+
### Principle of least privilege
|
|
40
|
+
- Application user: only SELECT/INSERT/UPDATE/DELETE on the necessary tables
|
|
41
|
+
- Never use a root/admin user for the application
|
|
42
|
+
- Create a separate user for migrations (with ALTER TABLE, CREATE, DROP)
|
|
43
|
+
- Read replicas: read-only user
|
|
44
|
+
- Supabase: `SUPABASE_SERVICE_ROLE_KEY` bypasses RLS — only use it server-side for admin operations; for user operations, use the `anon key` + RLS
|
|
45
45
|
|
|
46
|
-
###
|
|
47
|
-
-
|
|
48
|
-
-
|
|
49
|
-
- Logs
|
|
50
|
-
-
|
|
51
|
-
- `deleted_at timestamp`
|
|
46
|
+
### Sensitive data in the database
|
|
47
|
+
- Encrypt PII (national ID, card data) at rest with AES-256
|
|
48
|
+
- Don't store card data (use tokenization via the payment gateway)
|
|
49
|
+
- Logs and audit trail: keep a record of who accessed/modified sensitive data
|
|
50
|
+
- Encrypted backups: the database copy can't be weaker than the database itself
|
|
51
|
+
- `deleted_at timestamp` for soft delete — never delete real data; this is also an audit trail
|
|
52
52
|
|
|
53
|
-
###
|
|
54
|
-
- [ ]
|
|
55
|
-
- [ ] `grep -r "\.sql\|\.query(\|raw(" src/` →
|
|
56
|
-
- [ ] RPCs
|
|
57
|
-
- [ ] RLS
|
|
58
|
-
- [ ] `SUPABASE_SERVICE_ROLE_KEY`
|
|
53
|
+
### Database security checklist
|
|
54
|
+
- [ ] No query builds SQL via template literal/concatenation?
|
|
55
|
+
- [ ] `grep -r "\.sql\|\.query(\|raw(" src/` → reviewed manually?
|
|
56
|
+
- [ ] Supabase RPCs audited in the dashboard (no unsafe `EXECUTE format(...)`)?
|
|
57
|
+
- [ ] RLS enabled on domain tables? (`SELECT tablename, rowsecurity FROM pg_tables`)
|
|
58
|
+
- [ ] `SUPABASE_SERVICE_ROLE_KEY` used only server-side?
|
|
59
59
|
|
|
60
|
-
##
|
|
60
|
+
## Dependencies
|
|
61
61
|
|
|
62
|
-
###
|
|
63
|
-
- `npm audit` / `pnpm audit` / `pip audit`:
|
|
64
|
-
- Dependabot
|
|
65
|
-
- Lock files (`package-lock.json`, `pnpm-lock.yaml`):
|
|
62
|
+
### Package vulnerabilities
|
|
63
|
+
- `npm audit` / `pnpm audit` / `pip audit`: run in CI on every PR
|
|
64
|
+
- Dependabot or Renovate: automate security updates
|
|
65
|
+
- Lock files (`package-lock.json`, `pnpm-lock.yaml`): always commit them, they guarantee reproducibility
|
|
66
66
|
|
|
67
67
|
### Supply chain attacks
|
|
68
|
-
-
|
|
69
|
-
-
|
|
70
|
-
- SBOM (Software Bill of Materials):
|
|
68
|
+
- Prefer packages with many downloads and active maintenance
|
|
69
|
+
- Verify integrity: `npm install --ignore-scripts` for suspicious packages
|
|
70
|
+
- SBOM (Software Bill of Materials): document all dependencies in production
|
|
71
71
|
|
|
72
|
-
###
|
|
73
|
-
-
|
|
74
|
-
-
|
|
75
|
-
- Major versions:
|
|
72
|
+
### Updates
|
|
73
|
+
- Security dependencies: update immediately
|
|
74
|
+
- Minor dependencies: sprint by sprint
|
|
75
|
+
- Major versions: plan ahead, don't let them pile up
|
|
76
76
|
|
|
77
|
-
###
|
|
78
|
-
- [ ] `pnpm audit` (
|
|
79
|
-
- [ ] Lock file
|
|
80
|
-
- [ ] Dependabot
|
|
81
|
-
- [ ]
|
|
77
|
+
### Dependencies checklist
|
|
78
|
+
- [ ] `pnpm audit` (or `npm audit`) run with no open HIGH/CRITICAL findings?
|
|
79
|
+
- [ ] Lock file committed?
|
|
80
|
+
- [ ] Dependabot or Renovate configured in the repo?
|
|
81
|
+
- [ ] Dev packages don't go to production (`devDependencies` correct)?
|
|
@@ -1,44 +1,44 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: wizz-database-scaling
|
|
3
|
-
description:
|
|
3
|
+
description: Scaling databases — sharding, read replicas, connection pooling, indexes, N+1, partitioning. Use when the request involves a slow database, query performance, data scaling.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# Database Scaling
|
|
7
7
|
|
|
8
|
-
##
|
|
9
|
-
-
|
|
10
|
-
-
|
|
11
|
-
- CPU
|
|
12
|
-
- I/O
|
|
8
|
+
## Identifying the database bottleneck
|
|
9
|
+
- Slow queries: enable the slow query log (> 100ms is a warning sign)
|
|
10
|
+
- Exhausted connections: use connection pooling (PgBouncer, RDS Proxy)
|
|
11
|
+
- High CPU on the database: missing indexes or inefficient queries
|
|
12
|
+
- High I/O: data volume growing faster than the hardware
|
|
13
13
|
|
|
14
|
-
##
|
|
14
|
+
## Indexes
|
|
15
15
|
|
|
16
|
-
###
|
|
17
|
-
-
|
|
18
|
-
-
|
|
19
|
-
-
|
|
16
|
+
### When to create one
|
|
17
|
+
- Columns used in WHERE, ORDER BY, JOIN
|
|
18
|
+
- Foreign key columns that don't have an automatic index
|
|
19
|
+
- Combinations of columns used together in filters
|
|
20
20
|
|
|
21
|
-
###
|
|
22
|
-
-
|
|
23
|
-
-
|
|
24
|
-
-
|
|
21
|
+
### When not to create one
|
|
22
|
+
- Small tables (< 10k rows) rarely benefit
|
|
23
|
+
- Columns with few distinct values (e.g. a status with 3 options)
|
|
24
|
+
- Too many indexes degrade writes (every INSERT/UPDATE has to update the indexes)
|
|
25
25
|
|
|
26
26
|
## Read Replicas
|
|
27
|
-
-
|
|
28
|
-
-
|
|
29
|
-
-
|
|
27
|
+
- Route read queries (reports, listings) to a replica
|
|
28
|
+
- Always write to the primary
|
|
29
|
+
- Watch out for replication lag on critical data
|
|
30
30
|
|
|
31
31
|
## Sharding
|
|
32
|
-
-
|
|
33
|
-
-
|
|
34
|
-
-
|
|
35
|
-
|
|
36
|
-
##
|
|
37
|
-
-
|
|
38
|
-
-
|
|
39
|
-
-
|
|
40
|
-
|
|
41
|
-
##
|
|
42
|
-
-
|
|
43
|
-
- PgBouncer
|
|
44
|
-
-
|
|
32
|
+
- Last resort, after exhausting query and hardware optimizations
|
|
33
|
+
- Sharding by user ID or tenant is the most common pattern
|
|
34
|
+
- Greatly increases the complexity of queries that cross shards
|
|
35
|
+
|
|
36
|
+
## Partitioning (PostgreSQL)
|
|
37
|
+
- Partition large tables by date (logs, events, transactions)
|
|
38
|
+
- Makes deleting old data easier (drop partition instead of a bulk DELETE)
|
|
39
|
+
- Improves performance of queries with a date filter
|
|
40
|
+
|
|
41
|
+
## Connections and pooling
|
|
42
|
+
- Postgres connection limit: default 100, increase with care
|
|
43
|
+
- PgBouncer in transaction mode: hundreds of clients, dozens of real connections
|
|
44
|
+
- Never open a connection without closing it (a connection leak kills the database)
|
|
@@ -1,75 +1,75 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: wizz-desktop-security
|
|
3
3
|
description: >
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
preload script, safeStorage, code signing,
|
|
4
|
+
Security for desktop and Electron apps. Use when: developing an Electron app, configuring contextIsolation/IPC,
|
|
5
|
+
implementing code signing, storing tokens/credentials locally, configuring secure auto-update,
|
|
6
|
+
distributing an app for macOS/Windows. Use when the user mentions Electron, IPC, contextBridge,
|
|
7
|
+
preload script, safeStorage, code signing, notarization, or auto-update.
|
|
8
8
|
---
|
|
9
9
|
|
|
10
10
|
# Desktop Security
|
|
11
11
|
|
|
12
|
-
## Electron / Apps
|
|
12
|
+
## Electron / Desktop Apps
|
|
13
13
|
|
|
14
|
-
###
|
|
15
|
-
- nodeIntegration: false (
|
|
16
|
-
- contextIsolation: true (
|
|
17
|
-
- sandbox: true
|
|
18
|
-
- webSecurity: false
|
|
19
|
-
-
|
|
20
|
-
-
|
|
14
|
+
### Security context
|
|
15
|
+
- nodeIntegration: false (default since Electron 5, keep it that way)
|
|
16
|
+
- contextIsolation: true (mandatory)
|
|
17
|
+
- sandbox: true when possible
|
|
18
|
+
- webSecurity: false never in production
|
|
19
|
+
- Never load remote content in a window with access to privileged APIs; remote content = sandbox + no sensitive preload
|
|
20
|
+
- Keep Electron up to date (Chromium/Node patches arrive via Electron releases)
|
|
21
21
|
|
|
22
|
-
###
|
|
23
|
-
-
|
|
24
|
-
- `setWindowOpenHandler`:
|
|
25
|
-
- `shell.openExternal`
|
|
22
|
+
### Navigation and windows
|
|
23
|
+
- Block navigation outside the app: a `will-navigate` handler that cancels URLs outside the allowlist
|
|
24
|
+
- `setWindowOpenHandler`: deny by default (`{ action: "deny" }`), only open externally what's been approved
|
|
25
|
+
- `shell.openExternal` only with a validated URL (`https:` scheme and expected host), never with raw input from the renderer
|
|
26
26
|
|
|
27
|
-
### IPC (
|
|
28
|
-
-
|
|
29
|
-
-
|
|
30
|
-
-
|
|
31
|
-
-
|
|
27
|
+
### IPC (renderer <> main communication)
|
|
28
|
+
- Validate and sanitize all data coming from the renderer (the renderer is hostile territory: treat it as user input)
|
|
29
|
+
- Expose only the necessary functions via contextBridge, each with a fixed signature
|
|
30
|
+
- Never expose ipcRenderer directly to the renderer
|
|
31
|
+
- In `ipcMain.handle`, validate the type and size of the arguments; if there are multiple windows, check `event.senderFrame.url` against what's expected
|
|
32
32
|
|
|
33
33
|
```ts
|
|
34
|
-
// preload.ts:
|
|
34
|
+
// preload.ts: minimal surface, without passing through ipcRenderer
|
|
35
35
|
contextBridge.exposeInMainWorld("api", {
|
|
36
36
|
saveNote: (text: string) => ipcRenderer.invoke("notes:save", text),
|
|
37
37
|
})
|
|
38
38
|
|
|
39
|
-
// main.ts:
|
|
39
|
+
// main.ts: validate before acting
|
|
40
40
|
ipcMain.handle("notes:save", (event, text) => {
|
|
41
|
-
if (typeof text !== "string" || text.length > 10_000) throw new Error("input
|
|
41
|
+
if (typeof text !== "string" || text.length > 10_000) throw new Error("invalid input")
|
|
42
42
|
// ...
|
|
43
43
|
})
|
|
44
44
|
```
|
|
45
45
|
|
|
46
|
-
###
|
|
47
|
-
-
|
|
48
|
-
-
|
|
49
|
-
-
|
|
46
|
+
### Automatic updates
|
|
47
|
+
- Sign the update package with a code-signing certificate
|
|
48
|
+
- Validate the signature before installing an update
|
|
49
|
+
- Distribute over HTTPS with certificate pinning if possible
|
|
50
50
|
|
|
51
|
-
##
|
|
51
|
+
## Local storage
|
|
52
52
|
|
|
53
|
-
###
|
|
54
|
-
-
|
|
55
|
-
- `safeStorage.encryptString(token)`
|
|
56
|
-
-
|
|
53
|
+
### What to store locally
|
|
54
|
+
- Session tokens: Electron's `safeStorage` (uses Keychain on macOS, DPAPI on Windows, libsecret on Linux), never localStorage
|
|
55
|
+
- `safeStorage.encryptString(token)` before writing to disk; `keytar` is archived, don't use it in a new project
|
|
56
|
+
- Sensitive user data: encrypted via `safeStorage` or AES-256-GCM with the key kept in the OS keychain
|
|
57
57
|
|
|
58
|
-
###
|
|
59
|
-
-
|
|
60
|
-
-
|
|
61
|
-
-
|
|
58
|
+
### What to never store locally
|
|
59
|
+
- Plaintext passwords
|
|
60
|
+
- Unencrypted private keys
|
|
61
|
+
- Sensitive data in localStorage/sessionStorage without encryption
|
|
62
62
|
|
|
63
|
-
##
|
|
64
|
-
- Code signing
|
|
65
|
-
-
|
|
66
|
-
- Auto-update
|
|
63
|
+
## Distribution
|
|
64
|
+
- Code signing mandatory (Windows: Authenticode, macOS: Apple Developer ID)
|
|
65
|
+
- Notarization on macOS for distribution outside the App Store
|
|
66
|
+
- Auto-update with integrity verification before running
|
|
67
67
|
|
|
68
|
-
##
|
|
69
|
-
- [ ] `contextIsolation: true`, `nodeIntegration: false`, `sandbox: true`
|
|
70
|
-
- [ ]
|
|
71
|
-
- [ ] `will-navigate`
|
|
72
|
-
- [ ]
|
|
73
|
-
- [ ] Tokens
|
|
74
|
-
- [ ] Build
|
|
75
|
-
- [ ]
|
|
68
|
+
## Quick checklist (before packaging)
|
|
69
|
+
- [ ] `contextIsolation: true`, `nodeIntegration: false`, `sandbox: true` where possible?
|
|
70
|
+
- [ ] No privileged window loads a remote URL?
|
|
71
|
+
- [ ] `will-navigate` and `setWindowOpenHandler` restrict navigation?
|
|
72
|
+
- [ ] Every `ipcMain` handler validates its arguments?
|
|
73
|
+
- [ ] Tokens in `safeStorage`/keychain, nothing sensitive in localStorage?
|
|
74
|
+
- [ ] Build signed (and notarized on macOS)? Does auto-update validate the signature?
|
|
75
|
+
- [ ] Current Electron version (no open CVE)?
|