Repository navigation
fix: split CORS policy across public, credentialed, and admin routes - #316
bamiebot-maker wants to merge 3 commits into
Conversation
Closes Divinity-Labs#268 - Implement dynamic CORS delegator classifying routes into public, credentialed, and admin tiers - Keep public reads open to any origin with explicit credentials: false - Restrict credentialed routes (/usage/me and requests carrying auth credentials) to CORS_ALLOWED_ORIGINS with credentials: true - Close operator admin endpoints (/admin/*) against cross-origin browser requests by default - Document route security matrix and CORS policies in docs/routes.md and README.md - Add unit and integration tests covering allowed and refused origins on each class
|
@bamiebot-maker Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
|
One line from green. The drift guard is the only thing failing: Add it to Splitting CORS across public, credentialed and admin surfaces is the right shape — a single permissive policy in front of |
|
Hi @Miracle656, thanks for the review! I have added \CORS_PUBLIC_BLOCKED_ORIGINS\ to .env.example\ with documentation describing its format (comma-separated origins) and behavior (empty/unset permits all public cross-origin requests). \envDrift.test.ts\ and all 20 CORS tests are now green. |
Summary
Splits the blanket \origin: true\ CORS configuration into three explicit security tiers:
Also documents the full route classification matrix in \docs/routes.md\ and adds comprehensive test coverage in \src/tests/cors.test.ts\ for allowed and refused origins across all classes.
Related issue
Closes #268
Type of change
Checklist
px tsc --noEmit\ passes
pm run build\ passes