feat(rules): Supabase and cloud-functions bodies become path rules, one always-on line each

This commit is contained in:
bchanot committed 2026-10-29 13:03:31 +01:00
1 parent 2fe5291a13
commit 664d1ea839
5 files changed
+36 -13

No files matched your search

+13
View File
@@ -0,0 +1,13 @@
---
paths: ["**/functions/**", "**/serverless.*", "**/firebase.json"]
---
# Cloud functions — secure by default, domain 6
Path-scoped body of `rules/secure-by-default.md` domain 6 (BDR-125 phase 1);
the always-on line there keeps the instance cap and the self-trigger ban.
- No function re-triggers itself: never write to the resource that fires it,
never invoke itself. If unavoidable, guard with an idempotency flag.
- Max instances (or reserved concurrency) and a timeout on every function.
- Budget alert wired to an automatic stop beyond the budget.
+4 -11
View File
@@ -39,13 +39,8 @@ never claimed done: write it as a manual step in the project's deploy notes.
comments carry no token, hash, key or secret.
## 4. Supabase
- RLS enabled on every table, in the migration that creates it.
- Policies limited to the owner: `(select auth.uid())` per operation, role
`authenticated`. No `using (true)` on writes, no anon write.
- No `service_role` or secret key client-side: not in a bundle, not in a
`NEXT_PUBLIC_`, `VITE_` or `PUBLIC_` variable.
- Views `security_invoker`. `security definer` functions pin `search_path`
and revoke execute from anon. Buckets private by default.
- RLS on every table, never a service_role or secret key client-side. Full
domain: rules/supabase.md (loads on Supabase files).
## 5. SMS and email
- Prior consent recorded per contact: who, when, channel, source, wording.
@@ -54,7 +49,5 @@ never claimed done: write it as a manual step in the project's deploy notes.
SMS says STOP, and a STOP reply is processed and stored automatically.
## 6. Cloud functions
- No function re-triggers itself: never write to the resource that fires it,
never invoke itself. If unavoidable, guard with an idempotency flag.
- Max instances (or reserved concurrency) and a timeout on every function.
- Budget alert wired to an automatic stop beyond the budget.
- Max instances and a timeout on every function, never a self-trigger. Full
domain: rules/cloud-functions.md (loads on function files).
+16
View File
@@ -0,0 +1,16 @@
---
paths: ["**/supabase/**", "**/*supabase*.*"]
---
# Supabase — secure by default, domain 4
Path-scoped body of `rules/secure-by-default.md` domain 4 (BDR-125 phase 1);
the always-on line there keeps RLS and the client-side key ban.
- RLS enabled on every table, in the migration that creates it.
- Policies limited to the owner: `(select auth.uid())` per operation, role
`authenticated`. No `using (true)` on writes, no anon write.
- No `service_role` or secret key client-side: not in a bundle, not in a
`NEXT_PUBLIC_`, `VITE_` or `PUBLIC_` variable.
- Views `security_invoker`. `security definer` functions pin `search_path`
and revoke execute from anon. Buckets private by default.