Prevent leaking OpenAI organization-ids in error responses (khanon/oai-reverse-proxy!5)
This commit is contained in:
@@ -292,6 +292,9 @@ const handleDownstreamErrors: ProxyResHandlerWithBody = async (
|
||||
} else {
|
||||
errorPayload.proxy_note = `Unrecognized error from OpenAI.`;
|
||||
}
|
||||
|
||||
// Don't leak the org id outside the proxy
|
||||
errorPayload.message.replace(/org-.{24}/gm, "org-xxxxxxxxxxxxxxxxxxx");
|
||||
|
||||
res.status(statusCode).json(errorPayload);
|
||||
throw new Error(errorPayload.error?.message);
|
||||
|
||||
Reference in New Issue
Block a user