Prevent leaking OpenAI organization-ids in error responses (khanon/oai-reverse-proxy!5)
This commit is contained in:
parent
432023f875
commit
e0529197cd
|
@ -293,6 +293,9 @@ const handleDownstreamErrors: ProxyResHandlerWithBody = async (
|
|||
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);
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue