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:
@@ -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"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user