Revert "Move MRVA out of canary "
This commit is contained in:
@@ -15,7 +15,6 @@ To see what has changed in the last few versions of the extension, see the [Chan
|
|||||||
* Shows the flow of data through the results of path queries, which is essential for triaging security results.
|
* Shows the flow of data through the results of path queries, which is essential for triaging security results.
|
||||||
* Provides an easy way to run queries from the large, open source repository of [CodeQL security queries](https://github.com/github/codeql).
|
* Provides an easy way to run queries from the large, open source repository of [CodeQL security queries](https://github.com/github/codeql).
|
||||||
* Adds IntelliSense to support you writing and editing your own CodeQL query and library files.
|
* Adds IntelliSense to support you writing and editing your own CodeQL query and library files.
|
||||||
* Supports you running CodeQL queries against thousands of repositories on GitHub using multi-repository variant analysis.
|
|
||||||
|
|
||||||
## Project goals and scope
|
## Project goals and scope
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
## [UNRELEASED]
|
## [UNRELEASED]
|
||||||
|
|
||||||
- Enable multi-repository variant analysis. [#2121](https://github.com/github/vscode-codeql/pull/2121)
|
|
||||||
- Enable collection of telemetry concerning interactions with UI elements, including buttons, links, and other inputs. [#2114](https://github.com/github/vscode-codeql/pull/2114)
|
- Enable collection of telemetry concerning interactions with UI elements, including buttons, links, and other inputs. [#2114](https://github.com/github/vscode-codeql/pull/2114)
|
||||||
|
|
||||||
# 1.7.10 - 23 February 2023
|
# 1.7.10 - 23 February 2023
|
||||||
|
|||||||
@@ -16,6 +16,10 @@ choose to go through some of the Optional Test Cases.
|
|||||||
|
|
||||||
## Required Test Cases
|
## Required Test Cases
|
||||||
|
|
||||||
|
### Pre-requisites
|
||||||
|
|
||||||
|
- Flip the `codeQL.canary` flag. This will enable MRVA in the extension.
|
||||||
|
|
||||||
### Test Case 1: MRVA - Running a problem path query and viewing results
|
### Test Case 1: MRVA - Running a problem path query and viewing results
|
||||||
|
|
||||||
1. Open the [UnsafeJQueryPlugin query](https://github.com/github/codeql/blob/main/javascript/ql/src/Security/CWE-079/UnsafeJQueryPlugin.ql).
|
1. Open the [UnsafeJQueryPlugin query](https://github.com/github/codeql/blob/main/javascript/ql/src/Security/CWE-079/UnsafeJQueryPlugin.ql).
|
||||||
|
|||||||
@@ -978,10 +978,11 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"command": "codeQL.runVariantAnalysis",
|
"command": "codeQL.runVariantAnalysis",
|
||||||
"when": "editorLangId == ql && resourceExtname == .ql"
|
"when": "config.codeQL.canary && editorLangId == ql && resourceExtname == .ql"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"command": "codeQL.exportSelectedVariantAnalysisResults"
|
"command": "codeQL.exportSelectedVariantAnalysisResults",
|
||||||
|
"when": "config.codeQL.canary"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"command": "codeQL.runQueries",
|
"command": "codeQL.runQueries",
|
||||||
@@ -1235,7 +1236,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"command": "codeQL.runVariantAnalysis",
|
"command": "codeQL.runVariantAnalysis",
|
||||||
"when": "editorLangId == ql && resourceExtname == .ql"
|
"when": "config.codeQL.canary && editorLangId == ql && resourceExtname == .ql"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"command": "codeQL.viewAst",
|
"command": "codeQL.viewAst",
|
||||||
@@ -1280,7 +1281,8 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "codeQLVariantAnalysisRepositories",
|
"id": "codeQLVariantAnalysisRepositories",
|
||||||
"name": "Variant Analysis Repositories"
|
"name": "Variant Analysis Repositories",
|
||||||
|
"when": "config.codeQL.canary"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "codeQLQueryHistory",
|
"id": "codeQLQueryHistory",
|
||||||
|
|||||||
@@ -1,11 +1,12 @@
|
|||||||
import { window } from "vscode";
|
import { window } from "vscode";
|
||||||
import { App } from "../common/app";
|
import { App, AppMode } from "../common/app";
|
||||||
import { extLogger } from "../common";
|
import { extLogger } from "../common";
|
||||||
import { DisposableObject } from "../pure/disposable-object";
|
import { DisposableObject } from "../pure/disposable-object";
|
||||||
import { DbConfigStore } from "./config/db-config-store";
|
import { DbConfigStore } from "./config/db-config-store";
|
||||||
import { DbManager } from "./db-manager";
|
import { DbManager } from "./db-manager";
|
||||||
import { DbPanel } from "./ui/db-panel";
|
import { DbPanel } from "./ui/db-panel";
|
||||||
import { DbSelectionDecorationProvider } from "./ui/db-selection-decoration-provider";
|
import { DbSelectionDecorationProvider } from "./ui/db-selection-decoration-provider";
|
||||||
|
import { isCanary } from "../config";
|
||||||
|
|
||||||
export class DbModule extends DisposableObject {
|
export class DbModule extends DisposableObject {
|
||||||
public readonly dbManager: DbManager;
|
public readonly dbManager: DbManager;
|
||||||
@@ -18,12 +19,24 @@ export class DbModule extends DisposableObject {
|
|||||||
this.dbManager = new DbManager(app, this.dbConfigStore);
|
this.dbManager = new DbManager(app, this.dbConfigStore);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static async initialize(app: App): Promise<DbModule> {
|
public static async initialize(app: App): Promise<DbModule | undefined> {
|
||||||
const dbModule = new DbModule(app);
|
if (DbModule.shouldEnableModule(app.mode)) {
|
||||||
app.subscriptions.push(dbModule);
|
const dbModule = new DbModule(app);
|
||||||
|
app.subscriptions.push(dbModule);
|
||||||
|
|
||||||
await dbModule.initialize(app);
|
await dbModule.initialize(app);
|
||||||
return dbModule;
|
return dbModule;
|
||||||
|
}
|
||||||
|
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static shouldEnableModule(app: AppMode): boolean {
|
||||||
|
if (app === AppMode.Development || app === AppMode.Test) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return isCanary();
|
||||||
}
|
}
|
||||||
|
|
||||||
private async initialize(app: App): Promise<void> {
|
private async initialize(app: App): Promise<void> {
|
||||||
|
|||||||
@@ -637,7 +637,7 @@ async function activateWithInstalledDistribution(
|
|||||||
cliServer,
|
cliServer,
|
||||||
variantAnalysisStorageDir,
|
variantAnalysisStorageDir,
|
||||||
variantAnalysisResultsManager,
|
variantAnalysisResultsManager,
|
||||||
dbModule.dbManager,
|
dbModule?.dbManager,
|
||||||
);
|
);
|
||||||
ctx.subscriptions.push(variantAnalysisManager);
|
ctx.subscriptions.push(variantAnalysisManager);
|
||||||
ctx.subscriptions.push(variantAnalysisResultsManager);
|
ctx.subscriptions.push(variantAnalysisResultsManager);
|
||||||
@@ -1121,17 +1121,23 @@ async function activateWithInstalledDistribution(
|
|||||||
token: CancellationToken,
|
token: CancellationToken,
|
||||||
uri: Uri | undefined,
|
uri: Uri | undefined,
|
||||||
) => {
|
) => {
|
||||||
progress({
|
if (isCanary()) {
|
||||||
maxStep: 5,
|
progress({
|
||||||
step: 0,
|
maxStep: 5,
|
||||||
message: "Getting credentials",
|
step: 0,
|
||||||
});
|
message: "Getting credentials",
|
||||||
|
});
|
||||||
|
|
||||||
await variantAnalysisManager.runVariantAnalysis(
|
await variantAnalysisManager.runVariantAnalysis(
|
||||||
uri || window.activeTextEditor?.document.uri,
|
uri || window.activeTextEditor?.document.uri,
|
||||||
progress,
|
progress,
|
||||||
token,
|
token,
|
||||||
);
|
);
|
||||||
|
} else {
|
||||||
|
throw new Error(
|
||||||
|
"Variant analysis requires the CodeQL Canary version to run.",
|
||||||
|
);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: "Run Variant Analysis",
|
title: "Run Variant Analysis",
|
||||||
|
|||||||
@@ -13,9 +13,9 @@ export interface RepositorySelection {
|
|||||||
* @returns The user selection.
|
* @returns The user selection.
|
||||||
*/
|
*/
|
||||||
export async function getRepositorySelection(
|
export async function getRepositorySelection(
|
||||||
dbManager: DbManager,
|
dbManager?: DbManager,
|
||||||
): Promise<RepositorySelection> {
|
): Promise<RepositorySelection> {
|
||||||
const selectedDbItem = dbManager.getSelectedDbItem();
|
const selectedDbItem = dbManager?.getSelectedDbItem();
|
||||||
if (selectedDbItem) {
|
if (selectedDbItem) {
|
||||||
switch (selectedDbItem.kind) {
|
switch (selectedDbItem.kind) {
|
||||||
case DbItemKind.LocalDatabase || DbItemKind.LocalList:
|
case DbItemKind.LocalDatabase || DbItemKind.LocalList:
|
||||||
|
|||||||
@@ -223,7 +223,7 @@ export async function prepareRemoteQueryRun(
|
|||||||
uri: Uri | undefined,
|
uri: Uri | undefined,
|
||||||
progress: ProgressCallback,
|
progress: ProgressCallback,
|
||||||
token: CancellationToken,
|
token: CancellationToken,
|
||||||
dbManager: DbManager,
|
dbManager?: DbManager,
|
||||||
): Promise<PreparedRemoteQuery> {
|
): Promise<PreparedRemoteQuery> {
|
||||||
if (!uri?.fsPath.endsWith(".ql")) {
|
if (!uri?.fsPath.endsWith(".ql")) {
|
||||||
throw new UserCancellationException("Not a CodeQL query file.");
|
throw new UserCancellationException("Not a CodeQL query file.");
|
||||||
|
|||||||
@@ -105,7 +105,7 @@ export class VariantAnalysisManager
|
|||||||
private readonly cliServer: CodeQLCliServer,
|
private readonly cliServer: CodeQLCliServer,
|
||||||
private readonly storagePath: string,
|
private readonly storagePath: string,
|
||||||
private readonly variantAnalysisResultsManager: VariantAnalysisResultsManager,
|
private readonly variantAnalysisResultsManager: VariantAnalysisResultsManager,
|
||||||
private readonly dbManager: DbManager,
|
private readonly dbManager?: DbManager,
|
||||||
) {
|
) {
|
||||||
super();
|
super();
|
||||||
this.variantAnalysisMonitor = this.push(
|
this.variantAnalysisMonitor = this.push(
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import { resolve } from "path";
|
|||||||
import {
|
import {
|
||||||
authentication,
|
authentication,
|
||||||
commands,
|
commands,
|
||||||
|
ConfigurationTarget,
|
||||||
extensions,
|
extensions,
|
||||||
QuickPickItem,
|
QuickPickItem,
|
||||||
TextDocument,
|
TextDocument,
|
||||||
@@ -12,7 +13,10 @@ import {
|
|||||||
|
|
||||||
import { CodeQLExtensionInterface } from "../../../../src/extension";
|
import { CodeQLExtensionInterface } from "../../../../src/extension";
|
||||||
import { MockGitHubApiServer } from "../../../../src/mocks/mock-gh-api-server";
|
import { MockGitHubApiServer } from "../../../../src/mocks/mock-gh-api-server";
|
||||||
import { setRemoteControllerRepo } from "../../../../src/config";
|
import {
|
||||||
|
CANARY_FEATURES,
|
||||||
|
setRemoteControllerRepo,
|
||||||
|
} from "../../../../src/config";
|
||||||
|
|
||||||
jest.setTimeout(30_000);
|
jest.setTimeout(30_000);
|
||||||
|
|
||||||
@@ -35,6 +39,7 @@ describe("Variant Analysis Submission Integration", () => {
|
|||||||
let showErrorMessageSpy: jest.SpiedFunction<typeof window.showErrorMessage>;
|
let showErrorMessageSpy: jest.SpiedFunction<typeof window.showErrorMessage>;
|
||||||
|
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
|
await CANARY_FEATURES.updateValue(true, ConfigurationTarget.Global);
|
||||||
await setRemoteControllerRepo("github/vscode-codeql");
|
await setRemoteControllerRepo("github/vscode-codeql");
|
||||||
|
|
||||||
jest.spyOn(authentication, "getSession").mockResolvedValue({
|
jest.spyOn(authentication, "getSession").mockResolvedValue({
|
||||||
|
|||||||
Reference in New Issue
Block a user