Code RoomOverpermissive CORS with credentials
MediumPrep Room Coding #3988

Overpermissive CORS with credentials

Vibe & agenticSecurityMid–Senior~16 min

An AI assistant set up CORS for a Node API that serves authenticated user data via cookies. The frontend stopped getting CORS errors, so it 'works.' Review the config before it ships.

Implement
cors_response_headers(request_origin: str, allowed_origins: list[str], with_credentials: bool) → list[str]
Examples
in["https://app.example.com",["https://app.example.com"],true]out["Access-Control-Allow-Origin: https://app.example.com","Access-Control-Allow-Credentials: true","Vary: Origin"]
in["https://evil.example",["https://app.example.com"],true]out[]
in["https://anything.test",["*"],false]out["Access-Control-Allow-Origin: *"]
What a strong answer looks like

Treat the AI’s output as a draft to verify, not an answer to trust. Name the specific flaw and the input that triggers it, say how you’d catch it (tests, edge cases, reading critically), and how you’d re-prompt or decompose to get it right.

0:00 of about 16 min

Vibe & agentic: describe the solution in plain language (or narrate it) and the coach grades your approach.

Which questions mattered is sealed until you submit. Telling you now would just be handing over the edge cases.