Commit ac8b561
feat(e2e): guarded ephemeral test-account API for CI integration tests vs prod
POST/DELETE /internal/e2e/account — lets CI mint a real ephemeral test account
on prod per run, exercise integration flows, then reap. Security:
- X-E2E-Token constant-time guard; unset/wrong token → 404 (inert + no existence
leak). Ships INERT (no E2E_ACCOUNT_TOKEN config = off by default).
- Create makes an is_test_cohort=true team+user (live worker skip-guards neuter
billing/churn/email/quota), tier ≤ pro — team/growth rejected 400 (Team gated).
Returns a JWT_SECRET-signed session JWT (no Brevo dependency).
- Reap ONLY deletes is_test_cohort teams — a real team → 403 not_test_cohort
(the load-bearing safety test: TestE2EAccount_Reap_NonCohortTeam_Forbidden).
- Rate-limited (fail-open), audit-logged (e2e.account.created/reaped),
metric instant_e2e_account_total{op,result}.
Foundation for running the real-backend integration suite against production
in CI with on-the-fly accounts.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>1 parent 94cc58c commit ac8b561
14 files changed
Lines changed: 1519 additions & 0 deletions
Binary file not shown.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
263 | 263 | | |
264 | 264 | | |
265 | 265 | | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
266 | 289 | | |
267 | 290 | | |
268 | 291 | | |
| |||
427 | 450 | | |
428 | 451 | | |
429 | 452 | | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
430 | 456 | | |
431 | 457 | | |
432 | 458 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
68 | 68 | | |
69 | 69 | | |
70 | 70 | | |
| 71 | + | |
71 | 72 | | |
72 | 73 | | |
73 | 74 | | |
| |||
196 | 197 | | |
197 | 198 | | |
198 | 199 | | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
199 | 213 | | |
200 | 214 | | |
201 | 215 | | |
| |||
0 commit comments