| getCompletions computes the allowed origin through CORSUtils.matchOrigin (allow-list of the chat origin configuration, null when the origin is not listed) and sets it on the success responses (about line 77). The RequestError branch (about line 105) sets Access-Control-Allow-Origin to the raw request origin instead, so any site gets a readable cross-origin answer for the error case. No Access-Control-Allow-Credentials header is set, so a browser does not send the wiki cookies on such a request and the readable content is the OpenAI-style error body (provider or model error text) only. Still an allow-list bypass and a disclosure of error details to arbitrary origins. |