Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: github/codeql-action
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v1.1.11
Choose a base ref
...
head repository: github/codeql-action
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v1.1.12
Choose a head ref

Commits on May 16, 2022

  1. Introduce a feature-flag to enable/disable lua-based tracing.

    This allows us to gradually roll out (or even roll back)
    Lua-based tracing in case problems occur.
    criemen authored May 16, 2022
    Copy the full SHA
    9e9a842 View commit details
  2. Copy the full SHA
    db50ada View commit details
  3. Fix linter errors.

    criemen authored May 16, 2022
    Copy the full SHA
    970e087 View commit details

Commits on May 17, 2022

  1. Update changelog and version after v2.1.11

    github-actions[bot] committed May 17, 2022
    Copy the full SHA
    c88cf91 View commit details
  2. Update checked-in dependencies

    github-actions[bot] committed May 17, 2022
    Copy the full SHA
    6f285ad View commit details
  3. Merge pull request #1079 from github/mergeback/v2.1.11-to-main-a3a6c128

    Mergeback v2.1.11 refs/heads/releases/v2 into main
    edoardopirovano authored May 17, 2022
    Copy the full SHA
    aaff818 View commit details
  4. Remove outdated guidance on missing analysis

    As of December 2021, we do not return missing base analysis anymore.
    marcogario authored May 17, 2022
    Copy the full SHA
    2faa3e1 View commit details

Commits on May 19, 2022

  1. Merge pull request #1081 from github/clarify_missing_base

    Remove outdated guidance on missing analysis
    marcogario authored May 19, 2022
    Copy the full SHA
    f0705a6 View commit details

Commits on May 25, 2022

  1. Copy the full SHA
    4b77568 View commit details
  2. Copy the full SHA
    255ffd4 View commit details
  3. Merge pull request #1057 from github/criemen/lua-tracing-ff

    Introduce a feature-flag to enable/disable lua-based tracing.
    criemen authored May 25, 2022
    Copy the full SHA
    822fe5e View commit details

Commits on May 27, 2022

  1. Update default CodeQL to 2.9.3

    cklin committed May 27, 2022
    Copy the full SHA
    b36688d View commit details

Commits on May 31, 2022

  1. Merge pull request #1084 from github/cklin/codeql-bundle-2.9.3

    Update default CodeQL to 2.9.3
    cklin authored May 31, 2022
    Copy the full SHA
    dbe6f21 View commit details

Commits on Jun 1, 2022

  1. Update changelog for v2.1.12

    github-actions[bot] committed Jun 1, 2022
    Copy the full SHA
    3f00a12 View commit details
  2. Merge pull request #1088 from github/update-v2.1.12-dbe6f211

    Merge main into releases/v2
    cklin authored Jun 1, 2022
    Copy the full SHA
    27ea8f8 View commit details
  3. Revert "Update version and changelog for v1.1.11"

    This reverts commit acc7a4b.
    github-actions[bot] committed Jun 1, 2022
    Copy the full SHA
    4c3af19 View commit details
  4. Revert "Update checked-in dependencies"

    This reverts commit 459cf02.
    github-actions[bot] committed Jun 1, 2022
    Copy the full SHA
    af390c0 View commit details
  5. Merge remote-tracking branch 'origin/releases/v2' into update-v1.1.12…

    …-27ea8f8f
    github-actions[bot] committed Jun 1, 2022
    Copy the full SHA
    b6b48ce View commit details
  6. Update version and changelog for v1.1.12

    github-actions[bot] committed Jun 1, 2022
    Copy the full SHA
    24d91cb View commit details
  7. Update checked-in dependencies

    github-actions[bot] committed Jun 1, 2022
    Copy the full SHA
    6efabfe View commit details
  8. Merge pull request #1090 from github/update-v1.1.12-27ea8f8f

    Merge releases/v2 into releases/v1
    cklin authored Jun 1, 2022
    Copy the full SHA
    a6611b8 View commit details
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# CodeQL Action Changelog

## 1.1.12 - 01 Jun 2022

- Update default CodeQL bundle version to 2.9.3. [#1084](https://github.com/github/codeql-action/pull/1084)

## 1.1.11 - 17 May 2022

- Update default CodeQL bundle version to 2.9.2. [#1074](https://github.com/github/codeql-action/pull/1074)
7 changes: 0 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -139,10 +139,3 @@ By default, this will override any queries specified in a config file. If you wi

Read about [troubleshooting code scanning](https://help.github.com/en/github/finding-security-vulnerabilities-and-errors-in-your-code/troubleshooting-code-scanning).

### Note on "missing analysis" message

The very first time code scanning is run and if it is on a pull request, you will probably get a message mentioning a "missing analysis". This is expected.

After code scanning has analyzed the code in a pull request, it needs to compare the analysis of the topic branch (the merge commit of the branch you used to create the pull request) with the analysis of the base branch (the branch into which you want to merge the pull request). This allows code scanning to compute which alerts are newly introduced by the pull request, which alerts were already present in the base branch, and whether any existing alerts are fixed by the changes in the pull request. Initially, if you use a pull request to add code scanning to a repository, the base branch has not yet been analyzed, so it's not possible to compute these details. In this case, when you click through from the results check on the pull request you will see the "Missing analysis for base commit SHA-HASH" message.

For more information and other causes of this message, see [Reasons for the "Analysis not found" message](https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/setting-up-code-scanning-for-a-repository#reasons-for-the-analysis-not-found-message)
12 changes: 11 additions & 1 deletion lib/codeql.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/codeql.js.map

Large diffs are not rendered by default.

51 changes: 51 additions & 0 deletions lib/codeql.test.js
2 changes: 1 addition & 1 deletion lib/codeql.test.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion lib/defaults.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"bundleVersion": "codeql-bundle-20220512"
"bundleVersion": "codeql-bundle-20220527"
}
1 change: 1 addition & 0 deletions lib/feature-flags.js
2 changes: 1 addition & 1 deletion lib/feature-flags.js.map
6 changes: 5 additions & 1 deletion lib/feature-flags.test.js
2 changes: 1 addition & 1 deletion lib/feature-flags.test.js.map
2 changes: 1 addition & 1 deletion lib/init-action.js
2 changes: 1 addition & 1 deletion lib/init-action.js.map
4 changes: 2 additions & 2 deletions lib/init.js
2 changes: 1 addition & 1 deletion lib/init.js.map
2 changes: 1 addition & 1 deletion lib/runner.js
2 changes: 1 addition & 1 deletion lib/runner.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion node_modules/.package-lock.json
4 changes: 2 additions & 2 deletions package-lock.json
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "codeql",
"version": "1.1.11",
"version": "1.1.12",
"private": true,
"description": "CodeQL action",
"scripts": {
115 changes: 115 additions & 0 deletions src/codeql.test.ts
Original file line number Diff line number Diff line change
@@ -7,7 +7,10 @@ import nock from "nock";
import * as sinon from "sinon";

import * as codeql from "./codeql";
import { Config } from "./config-utils";
import * as defaults from "./defaults.json";
import { createFeatureFlags, FeatureFlag } from "./feature-flags";
import { Language } from "./languages";
import { getRunnerLogger } from "./logging";
import { setupTests, setupActionsVars } from "./testing-utils";
import * as util from "./util";
@@ -425,6 +428,118 @@ test("databaseInterpretResults() sets --sarif-add-query-help for 2.7.1", async (
);
});

const stubConfig: Config = {
languages: [Language.cpp],
queries: {},
pathsIgnore: [],
paths: [],
originalUserInput: {},
tempDir: "",
toolCacheDir: "",
codeQLCmd: "",
gitHubVersion: {
type: util.GitHubVariant.DOTCOM,
} as util.GitHubVersion,
dbLocation: "",
packs: {},
debugMode: false,
debugArtifactName: util.DEFAULT_DEBUG_ARTIFACT_NAME,
debugDatabaseName: util.DEFAULT_DEBUG_DATABASE_NAME,
injectedMlQueries: false,
};

test("databaseInitCluster() Lua feature flag enabled, but old CLI", async (t) => {
const runnerConstructorStub = stubToolRunnerConstructor();
const codeqlObject = await codeql.getCodeQLForTesting();
sinon.stub(codeqlObject, "getVersion").resolves("2.9.0");

await codeqlObject.databaseInitCluster(
stubConfig,
"",
undefined,
undefined,
createFeatureFlags([FeatureFlag.LuaTracerConfigEnabled])
);
t.false(
runnerConstructorStub.firstCall.args[1].includes(
"--internal-use-lua-tracing"
),
"--internal-use-lua-tracing should be absent, but it is present"
);
t.false(
runnerConstructorStub.firstCall.args[1].includes(
"--no-internal-use-lua-tracing"
),
"--no-internal-use-lua-tracing should be absent, but it is present"
);
});

test("databaseInitCluster() Lua feature flag disabled, with old CLI", async (t) => {
const runnerConstructorStub = stubToolRunnerConstructor();
const codeqlObject = await codeql.getCodeQLForTesting();
sinon.stub(codeqlObject, "getVersion").resolves("2.9.0");

await codeqlObject.databaseInitCluster(
stubConfig,
"",
undefined,
undefined,
createFeatureFlags([])
);
t.false(
runnerConstructorStub.firstCall.args[1].includes(
"--internal-use-lua-tracing"
),
"--internal-use-lua-tracing should be absent, but it is present"
);
t.false(
runnerConstructorStub.firstCall.args[1].includes(
"--no-internal-use-lua-tracing"
),
"--no-internal-use-lua-tracing should be absent, but it is present"
);
});

test("databaseInitCluster() Lua feature flag enabled, compatible CLI", async (t) => {
const runnerConstructorStub = stubToolRunnerConstructor();
const codeqlObject = await codeql.getCodeQLForTesting();
sinon.stub(codeqlObject, "getVersion").resolves("2.10.0");

await codeqlObject.databaseInitCluster(
stubConfig,
"",
undefined,
undefined,
createFeatureFlags([FeatureFlag.LuaTracerConfigEnabled])
);
t.true(
runnerConstructorStub.firstCall.args[1].includes(
"--internal-use-lua-tracing"
),
"--internal-use-lua-tracing should be present, but it is absent"
);
});

test("databaseInitCluster() Lua feature flag disabled, compatible CLI", async (t) => {
const runnerConstructorStub = stubToolRunnerConstructor();
const codeqlObject = await codeql.getCodeQLForTesting();
sinon.stub(codeqlObject, "getVersion").resolves("2.10.0");

await codeqlObject.databaseInitCluster(
stubConfig,
"",
undefined,
undefined,
createFeatureFlags([])
);
t.true(
runnerConstructorStub.firstCall.args[1].includes(
"--no-internal-use-lua-tracing"
),
"--no-internal-use-lua-tracing should be present, but it is absent"
);
});

function stubToolRunnerConstructor(): sinon.SinonStub<
any[],
toolrunner.ToolRunner
17 changes: 15 additions & 2 deletions src/codeql.ts
Original file line number Diff line number Diff line change
@@ -12,6 +12,7 @@ import * as api from "./api-client";
import { Config } from "./config-utils";
import * as defaults from "./defaults.json"; // Referenced from codeql-action-sync-tool!
import { errorMatchers } from "./error-matcher";
import { FeatureFlags, FeatureFlag } from "./feature-flags";
import { isTracedLanguage, Language } from "./languages";
import { Logger } from "./logging";
import * as toolcache from "./toolcache";
@@ -83,7 +84,8 @@ export interface CodeQL {
config: Config,
sourceRoot: string,
processName: string | undefined,
processLevel: number | undefined
processLevel: number | undefined,
featureFlags: FeatureFlags
): Promise<void>;
/**
* Runs the autobuilder for the given language.
@@ -220,6 +222,7 @@ const CODEQL_VERSION_SARIF_GROUP = "2.5.3";
export const CODEQL_VERSION_COUNTS_LINES = "2.6.2";
const CODEQL_VERSION_CUSTOM_QUERY_HELP = "2.7.1";
export const CODEQL_VERSION_ML_POWERED_QUERIES = "2.7.5";
const CODEQL_VERSION_LUA_TRACER_CONFIG = "2.9.3";

/**
* This variable controls using the new style of tracing from the CodeQL
@@ -726,7 +729,8 @@ async function getCodeQLForCmd(
config: Config,
sourceRoot: string,
processName: string | undefined,
processLevel: number | undefined
processLevel: number | undefined,
featureFlags: FeatureFlags
) {
const extraArgs = config.languages.map(
(language) => `--language=${language}`
@@ -741,6 +745,15 @@ async function getCodeQLForCmd(
// because that always passes in a process name.
extraArgs.push(`--trace-process-level=${processLevel || 3}`);
}
if (
await util.codeQlVersionAbove(this, CODEQL_VERSION_LUA_TRACER_CONFIG)
) {
if (await featureFlags.getValue(FeatureFlag.LuaTracerConfigEnabled)) {
extraArgs.push("--internal-use-lua-tracing");
} else {
extraArgs.push("--no-internal-use-lua-tracing");
}
}
}
await runTool(cmd, [
"database",
2 changes: 1 addition & 1 deletion src/defaults.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"bundleVersion": "codeql-bundle-20220512"
"bundleVersion": "codeql-bundle-20220527"
}
8 changes: 7 additions & 1 deletion src/feature-flags.test.ts
Original file line number Diff line number Diff line change
@@ -121,7 +121,10 @@ test("Feature flags exception is propagated if the API request errors", async (t
});
});

const FEATURE_FLAGS = ["ml_powered_queries_enabled"];
const FEATURE_FLAGS = [
"ml_powered_queries_enabled",
"lua_tracer_config_enabled",
];

for (const featureFlag of FEATURE_FLAGS) {
test(`Feature flag '${featureFlag}' is enabled if enabled in the API response`, async (t) => {
@@ -146,6 +149,9 @@ for (const featureFlag of FEATURE_FLAGS) {
ml_powered_queries_enabled: await featureFlags.getValue(
FeatureFlag.MlPoweredQueriesEnabled
),
lua_tracer_config_enabled: await featureFlags.getValue(
FeatureFlag.LuaTracerConfigEnabled
),
};

t.deepEqual(actualFeatureFlags, expectedFeatureFlags);
1 change: 1 addition & 0 deletions src/feature-flags.ts
Original file line number Diff line number Diff line change
@@ -9,6 +9,7 @@ export interface FeatureFlags {

export enum FeatureFlag {
MlPoweredQueriesEnabled = "ml_powered_queries_enabled",
LuaTracerConfigEnabled = "lua_tracer_config_enabled",
}

/**
3 changes: 2 additions & 1 deletion src/init-action.ts
Original file line number Diff line number Diff line change
@@ -257,7 +257,8 @@ async function run() {
config,
sourceRoot,
"Runner.Worker.exe",
undefined
undefined,
featureFlags
);
if (tracerConfig !== undefined) {
for (const [key, value] of Object.entries(tracerConfig.env)) {
6 changes: 4 additions & 2 deletions src/init.ts
Original file line number Diff line number Diff line change
@@ -87,7 +87,8 @@ export async function runInit(
config: configUtils.Config,
sourceRoot: string,
processName: string | undefined,
processLevel: number | undefined
processLevel: number | undefined,
featureFlags: FeatureFlags
): Promise<TracerConfig | undefined> {
fs.mkdirSync(config.dbLocation, { recursive: true });

@@ -98,7 +99,8 @@ export async function runInit(
config,
sourceRoot,
processName,
processLevel
processLevel,
featureFlags
);
} else {
for (const language of config.languages) {
3 changes: 2 additions & 1 deletion src/runner.ts
Original file line number Diff line number Diff line change
@@ -271,7 +271,8 @@ program
config,
sourceRoot,
parseTraceProcessName(),
parseTraceProcessLevel()
parseTraceProcessLevel(),
createFeatureFlags([])
);
if (tracerConfig === undefined) {
return;