test: add remote auth jwt smoke

This commit is contained in:
Codex
2026-06-30 02:10:34 +08:00
parent 1b6006f8e6
commit 7eaf26fa40
9 changed files with 446 additions and 7 deletions

View File

@@ -48,7 +48,8 @@ Supabase 官方允许前端用 Data API 访问数据,但前提是 RLS、最小
AUTH_JWT_ISSUER=https://<project-ref>.supabase.co/auth/v1
AUTH_JWT_AUDIENCE=authenticated
```
- `npm run test:api` 已覆盖本地 HS256 JWT 和本地 JWKS/RS256 验签路径;真实云端仍需用线上 Supabase access token `GET /api/auth/me`、`GET /api/profile/me`、租户后台平台后台各一条接口
- `npm run test:api` 已覆盖本地 HS256 JWT 和本地 JWKS/RS256 验签路径;`npm run smoke:auth:remote` 用于真实云端 access token 回归 `GET /api/auth/me`、`GET /api/profile/me`、租户后台平台后台、坏 token 和错租户上下文
- 远程 Auth smoke 的真实 access token 只能在验收命令行临时注入,不能写入仓库、前端 `runtime-config.json`、CI 日志或长期 `.env`。
- 前端禁止通过 query/body/header 指定 userId。
- `GET /api/auth/me` 已支持 Supabase JWT后续要补租户成员、角色、权限返回。
@@ -185,6 +186,7 @@ provider event id 幂等
- `npm run audit:runtime` 为 0 high/critical 漏洞Taro 构建工具链 audit 单独跟踪,不能用破坏性降级绕过。
- `npm run check:refactor` 通过。
- `npm run smoke:auth:remote` 在预生产/生产 API 上通过,并使用真实 Supabase Auth access token 覆盖学生、租户管理员、平台管理员、坏 token 和错租户上下文。
- `npm run test:rls` 通过;必须确认主租户、合作商租户、无租户 claim、平台管理员旁路和跨租户写入拒绝都有运行时证据。
- `npm run readiness:production` 没有 blocker。
- `npm run readiness:production:db` 没有 blocker尤其是 `db.rls.tenant_tables_enabled`、`db.rls.tenant_tables_policy`、`db.rls.public_tenant_context` 必须通过。