Allow HTTP connections to fetch database

Introduce a new config option to allow requests over HTTP when fetching
a database from a URL.
This commit is contained in:
Joe Rozner
2023-04-15 14:39:35 -07:00
parent 70b4aacf35
commit 99eb274029
3 changed files with 18 additions and 1 deletions

View File

@@ -293,6 +293,11 @@
"scope": "window",
"minimum": 0,
"description": "Report a warning for any join order whose metric exceeds this value."
},
"codeQL.allowHttp": {
"type": "boolean",
"default": false,
"description": "Allow databased to be downloaded via HTTP"
}
}
},

View File

@@ -608,3 +608,12 @@ export const CODESPACES_TEMPLATE = new Setting(
export function isCodespacesTemplate() {
return !!CODESPACES_TEMPLATE.getValue<boolean>();
}
export const ALLOW_HTTP = new Setting(
"allowHttp",
ROOT_SETTING,
);
export function allowHttp(): boolean {
return ALLOW_HTTP.getValue<boolean>() || false;
}

View File

@@ -27,6 +27,7 @@ import {
} from "./common/github-url-identifier-helper";
import { Credentials } from "./common/authentication";
import { AppCommandManager } from "./common/commands";
import { ALLOW_HTTP } from "./config";
/**
* Prompts a user to fetch a database from a remote location. Database is assumed to be an archive file.
@@ -49,7 +50,9 @@ export async function promptImportInternetDatabase(
return;
}
validateHttpsUrl(databaseUrl);
if (!ALLOW_HTTP.getValue()) {
validateHttpsUrl(databaseUrl);
}
const item = await databaseArchiveFetcher(
databaseUrl,