forked from wangziqi/gongxue-base
feat: add rls readiness gates
This commit is contained in:
@@ -83,6 +83,8 @@ Supabase 官方允许前端用 Data API 访问数据,但前提是 RLS、最小
|
||||
- 数据库 RLS 要按 `tenant_id` 拦截。
|
||||
- API SQL 必须显式带 `tenant_id`。
|
||||
- 测试必须覆盖跨租户读取、写入、下载、后台权限越权。
|
||||
- `npm run readiness:production:db` 会阻断带 `tenant_id` 但未启用 RLS、没有 policy、或 public policy 未包含 `app.current_tenant_id()` 的表。
|
||||
- 新增租户表时必须同时提交 migration、RLS policy、API 权限测试或明确说明只允许平台级访问的原因。
|
||||
|
||||
## 前端必须遵守
|
||||
|
||||
@@ -174,7 +176,7 @@ provider event id 幂等
|
||||
- `npm run audit:runtime` 为 0 high/critical 漏洞;Taro 构建工具链 audit 单独跟踪,不能用破坏性降级绕过。
|
||||
- `npm run check:refactor` 通过。
|
||||
- `npm run readiness:production` 没有 blocker。
|
||||
- `npm run readiness:production:db` 没有 blocker。
|
||||
- `npm run readiness:production:db` 没有 blocker,尤其是 `db.rls.tenant_tables_enabled`、`db.rls.tenant_tables_policy`、`db.rls.public_tenant_context` 必须通过。
|
||||
- 生产环境启动时默认密钥 fail-fast 生效。
|
||||
- 跨租户学生读取题目/订单/资料返回拒绝。
|
||||
- 销售只能查看自己权限范围内客资。
|
||||
|
||||
Reference in New Issue
Block a user