Skip to content

Commit 99eb274

Browse files
committed
Allow HTTP connections to fetch database
Introduce a new config option to allow requests over HTTP when fetching a database from a URL.
1 parent 70b4aac commit 99eb274

File tree

3 files changed

+18
-1
lines changed

3 files changed

+18
-1
lines changed

extensions/ql-vscode/package.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -293,6 +293,11 @@
293293
"scope": "window",
294294
"minimum": 0,
295295
"description": "Report a warning for any join order whose metric exceeds this value."
296+
},
297+
"codeQL.allowHttp": {
298+
"type": "boolean",
299+
"default": false,
300+
"description": "Allow databased to be downloaded via HTTP"
296301
}
297302
}
298303
},

extensions/ql-vscode/src/config.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -608,3 +608,12 @@ export const CODESPACES_TEMPLATE = new Setting(
608608
export function isCodespacesTemplate() {
609609
return !!CODESPACES_TEMPLATE.getValue<boolean>();
610610
}
611+
612+
export const ALLOW_HTTP = new Setting(
613+
"allowHttp",
614+
ROOT_SETTING,
615+
);
616+
617+
export function allowHttp(): boolean {
618+
return ALLOW_HTTP.getValue<boolean>() || false;
619+
}

extensions/ql-vscode/src/databaseFetcher.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ import {
2727
} from "./common/github-url-identifier-helper";
2828
import { Credentials } from "./common/authentication";
2929
import { AppCommandManager } from "./common/commands";
30+
import { ALLOW_HTTP } from "./config";
3031

3132
/**
3233
* 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(
4950
return;
5051
}
5152

52-
validateHttpsUrl(databaseUrl);
53+
if (!ALLOW_HTTP.getValue()) {
54+
validateHttpsUrl(databaseUrl);
55+
}
5356

5457
const item = await databaseArchiveFetcher(
5558
databaseUrl,

0 commit comments

Comments
 (0)