Prevent leaking OpenAI organization-ids in error responses (khanon/oai-reverse-proxy!5)
This commit is contained in:
parent
432023f875
commit
e0529197cd
|
@ -292,6 +292,9 @@ const handleDownstreamErrors: ProxyResHandlerWithBody = async (
|
||||||
} else {
|
} else {
|
||||||
errorPayload.proxy_note = `Unrecognized error from OpenAI.`;
|
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);
|
res.status(statusCode).json(errorPayload);
|
||||||
throw new Error(errorPayload.error?.message);
|
throw new Error(errorPayload.error?.message);
|
||||||
|
|
Loading…
Reference in New Issue