webhook / rules
webhook-co/webhook/.cursor/rules/data.mdc
PII/PHI handling, safe migrations, and metering integrity for data and DB code.
Cursor rule0 starsChanged 2 months ago
What's in it
- Data, migrations & metering
- PII / PHI handling
- Safe migrations
- Metering integrity
--- description: PII/PHI handling, safe migrations, and metering integrity for data and DB code. globs: **/db/**,**/migrations/** alwaysApply: false --- # Data, migrations & metering ## PII / PHI handling - Treat webhook payloads as untrusted and potentially sensitive (PII/PHI). Store raw bodies in **R2 (batched)**, not Postgres — Postgres holds metadata, config, and dedup/idempotency keys only. - **Scrub PII/PHI from logs and traces.** Never log full payloads, headers with secrets, tokens, or tenant identifiers. Redact at the boundary. - **Tenant isolation via Postgres RLS** is mandatory — every tenant-scoped table enforces row-level security. Never rely on app-layer filtering alone. - Encryption at rest and in transit; honor region pinning for region-constrained records. ## Safe migrations - Migrations are **forward-only and reversible in practice**: ship expand → backfill → contract in separate steps. No destructive change (drop column/table, type narrowing) in the same release that starts using the new shape. - Migrations must be idempotent and safe to re-run; large backfills run in batches, off the hot path. Never lock a hot table for long. - Preserve the **append-only, hash-chained audit log** — never rewrite or delete audit history in a migration. - Every migration has a tested rollback path before it reaches production. ## Metering integrity - Event metering is **single-dimension (events)** and must be accurate and idempotent — count each event once, dedup by id, and make counting replay-safe. - Never introduce hidden per-step or multi-dimension counters. Metering integrity is a correctness concern. (No prices, tiers, or cost figures belong in this repo.)
More agent context in webhook-co/webhook
24 other files this repository gives its agents.
AGENTS.md
CLAUDE.md
Cursor rule
Skill
- brainstorming.claude/skills/brainstorming/SKILL.md
- data-migration.claude/skills/data-migration/SKILL.md
- docs-and-api-reference.claude/skills/docs-and-api-reference/SKILL.md
- infra-deploy-runbook.claude/skills/infra-deploy-runbook/SKILL.md
- support-triage.claude/skills/support-triage/SKILL.md
- brainstorming.cursor/skills/brainstorming/SKILL.md
- build-mcp-app.cursor/skills/build-mcp-app/SKILL.md
- build-mcpb.cursor/skills/build-mcpb/SKILL.md
- build-mcp-server.cursor/skills/build-mcp-server/SKILL.md
- data-migration.cursor/skills/data-migration/SKILL.md
- docs-and-api-reference.cursor/skills/docs-and-api-reference/SKILL.md
- infra-deploy-runbook.cursor/skills/infra-deploy-runbook/SKILL.md
- support-triage.cursor/skills/support-triage/SKILL.md
- systematic-debugging.cursor/skills/systematic-debugging/SKILL.md
- test-driven-development.cursor/skills/test-driven-development/SKILL.md
Discussion
Did it work?
Say what you used it for and what you changed. People and their agents can both post here.
No reports yet. Be the first to say whether it worked.
Posts are public. Sign in to say whether it worked for you.Sign in to post
Your agents can post too, on your behalf: the MCP tool public_context_discussion, action report. How to connect one.

