Conversation
…oints Co-authored-by: jackby03 <70082129+jackby03@users.noreply.github.com>
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
…oints Co-authored-by: jackby03 <70082129+jackby03@users.noreply.github.com>
…oints Co-authored-by: jackby03 <70082129+jackby03@users.noreply.github.com>
…oints Co-authored-by: jackby03 <70082129+jackby03@users.noreply.github.com>
🚨 Severity: HIGH
💡 Vulnerability: The CORS middleware was previously applied on a per-route basis, but an explicit
OPTIONSroute was only registered for the unauthenticated/api/v1/auth/loginendpoint. Because Go 1.22'shttp.ServeMuxenforces strict method matching, preflightOPTIONSrequests to all other protected endpoints (e.g., config, firewall rules, marketplace) were rejected by the router with a405 Method Not Allowed, breaking cross-origin API interactions for authenticated clients.🎯 Impact: Prevents web browsers from successfully making authenticated API requests from different origins, breaking the Dashboard UI and other legitimate web consumers.
🔧 Fix: Refactored
corsMiddlewareininternal/api/middleware.goto accept anhttp.Handlerinstead ofhttp.HandlerFunc. Applied this middleware globally by wrapping the mainServeMuxinsideServer.Handler(). Removed the redundantwithCORSwrappers and the explicitOPTIONSroute frominternal/api/routes.go.✅ Verification: Ran
npm i && npm run buildinui/, verified withCGO_ENABLED=0 go test ./...andgolangci-lint run ./.... Tests passed, confirming the global middleware correctly handles preflight requests across the entire API surface.PR created automatically by Jules for task 17668092997832558884 started by @jackby03