Fix: some error URLs aren't sanitized (#3385)

This commit is contained in:
shamoon 2024-04-29 17:18:55 -07:00 committed by GitHub
parent daa51f9740
commit ea63716b61
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 8 additions and 2 deletions

View file

@ -5,6 +5,7 @@ import { createUnzip, constants as zlibConstants } from "node:zlib";
import { http, https } from "follow-redirects";
import { addCookieToJar, setCookieHeader } from "./cookie-jar";
import { sanitizeErrorURL } from "./api-helpers";
import createLogger from "utils/logger";
@ -113,6 +114,11 @@ export async function httpProxy(url, params = {}) {
constructedUrl.pathname,
);
if (err) logger.error(err);
return [500, "application/json", { error: { message: err?.message ?? "Unknown error", url, rawError: err } }, null];
return [
500,
"application/json",
{ error: { message: err?.message ?? "Unknown error", url: sanitizeErrorURL(url), rawError: err } },
null,
];
}
}