🛡️ Sentinel: [HIGH] Fix overly permissive CORS origin reflection - #105
🛡️ Sentinel: [HIGH] Fix overly permissive CORS origin reflection#105google-labs-jules[bot] wants to merge 2 commits into
Conversation
Changed the default origin in `corsMiddleware` from `((origin) => origin)` to `*` to prevent reflecting arbitrary origins when no explicit origin list is provided. This fixes a vulnerability where credentialed requests could be made from any origin. Updated tests to expect the secure behavior.
|
👋 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. |
|
修复 ci |
I have fixed the CI errors by replacing the |
Changed the default origin in `corsMiddleware` from `((origin) => origin)` to `*` to prevent reflecting arbitrary origins when no explicit origin list is provided. This fixes a vulnerability where credentialed requests could be made from any origin. Updated tests to expect the secure behavior.
🚨 Severity: HIGH
💡 Vulnerability: Overly permissive CORS configuration reflected any
Originheader when no origins were explicitly configured, even withcredentials: true.🎯 Impact: An attacker could make cross-origin authenticated requests from their own site and read the responses containing sensitive user data (bypassing the Same-Origin Policy).
🔧 Fix: Changed the default fallback in
corsMiddlewareto use'*'instead of(origin) => origin. This forces developers to explicitly list allowed origins if they needcredentials: true, as browsers securely block*with credentials.✅ Verification: Verified by updating and running
test/integration/guards.test.tsto ensureaccess-control-allow-origin: *is returned instead of reflecting the origin.PR created automatically by Jules for task 6742476337604413345 started by @YoungSx