mirror of
https://github.com/Kong/insomnia.git
synced 2026-08-04 03:42:20 -04:00
fix: enforce URL validation to disallow local file URIs in curl requests (#8957)
This commit is contained in:
@@ -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();
|
||||
|
||||
@@ -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({
|
||||
|
||||
Reference in New Issue
Block a user