fix: enforce URL validation to disallow local file URIs in curl requests (#8957)

This commit is contained in:
Jack Kavanagh
2026-06-23 19:17:10 +02:00
committed by GitHub
parent 72ef5cf563
commit aef7619b84
2 changed files with 5 additions and 4 deletions

View File

@@ -150,9 +150,9 @@ const openCurlConnection = async (
const caCertificate = caCertficatePath && (await insecureReadFile(caCertficatePath));
try {
if (!options.url) {
throw new Error('URL is required');
}
invariant(options.url, 'URL must be defined');
invariant(!options.url.startsWith('file://'), 'Local file URIs are not supported');
const readyStateChannel = `${protocolName}.${request._id}.${REALTIME_EVENTS_CHANNELS.READY_STATE}`;
const settings = await services.settings.get();

View File

@@ -119,7 +119,8 @@ export const curlRequest = (options: CurlRequestOptions) =>
authHeader,
noDecompress = false,
} = options;
// allow reading the file as the caCert is chosen by user
invariant(!finalUrl.startsWith('file://'), 'Local file URIs are not supported');
const caCert = caCertficatePath && (await insecureReadFile(caCertficatePath));
const { curl, debugTimeline } = createConfiguredCurlInstance({