fix(api): open the public no-credential routes to any CORS origin - #6401
Conversation
/health, /v1/public/stats, and /v1/public/github/repos/:owner/:repo/stats are unauthenticated, cookie-free, aggregate-only endpoints, but sat behind the same strict exact-match CORS allowlist as every authenticated route. Confirmed live: browserless's visual-review capture of PR previews was hitting real CORS errors calling these from a fresh <alias>-loopover-ui.<sub>.workers.dev preview build -- Cloudflare assigns a random hostname per deploy (ui-preview-deploy.yml), so a static allowlist can never enumerate them. Adds a separate, credential-free CORS branch (mirrors the existing handleStats "*" pattern) for exactly these 3 routes, gated by a new isPublicNoCredentialRoute() path check. Deliberately does NOT touch the global allowedCorsOrigin()/Access-Control-Allow-Credentials path for anything else -- this app has real HttpOnly session cookies, so widening the credentialed-CORS allowlist itself to any *.workers.dev/ *.pages.dev origin would let any third party hosted on that same shared platform ride an authenticated user's session cross-origin. Every other route's CORS behavior is unchanged (see the REGRESSION tests in routes-cors.test.ts confirming this).
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #6401 +/- ##
=======================================
Coverage 95.60% 95.60%
=======================================
Files 601 601
Lines 47310 47320 +10
Branches 15050 15054 +4
=======================================
+ Hits 45232 45242 +10
Misses 1291 1291
Partials 787 787
Flags with carried forward coverage won't be shown. Click here to find out more.
|
|
Warning ⏸️ LoopOver review result - manual review recommendedReview updated: 2026-07-16 07:03:55 UTC
Review summary Nits — 5 non-blocking
Concerns raised — review before merging
📋 Copy for AI agents — paste into your coding agentDecision drivers
Context & advisory signals — never blocks the verdict
Review context
Contributor next steps
Signal definitions
🧪 Chat with LoopOverAsk LoopOver a question about this PR directly in a comment — grounded only in the same cached, public-safe facts shown above, never a new claim.
Full command reference: https://loopover.ai/docs/loopover-commands 🧪 Experimental — new and may change. 🟩 Safe / merged · 🟦 Advisory · 🟨 Held for review · 🟥 Blocked / closed 💰 Earn for open-source contributions like this. Gittensor lets GitHub contributors earn for the work they already do — register to start earning →. Checked by LoopOver, a quiet PR intelligence layer for OSS maintainers.
|
Summary
Test plan