Merge pull request #1281 from github/aeisenberg/cli-config-processing
Add logging statements declaring state of the cli_config_file_enabled
This commit is contained in:
commit
f359ba7af1
12 changed files with 55 additions and 13 deletions
1
lib/analyze.js
generated
1
lib/analyze.js
generated
|
|
@ -136,6 +136,7 @@ async function runQueries(sarifFolder, memoryFlag, addSnippetsFlag, threadsFlag,
|
|||
config.paths, config.pathsIgnore, config.languages, logger);
|
||||
}
|
||||
const codeql = await (0, codeql_1.getCodeQL)(config.codeQLCmd);
|
||||
await util.logCodeScanningConfigInCli(codeql, featureFlags, logger);
|
||||
for (const language of config.languages) {
|
||||
const queries = config.queries[language];
|
||||
const queryFilters = validateQueryFilters(config.originalUserInput["query-filters"]);
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
1
lib/config-utils.js
generated
1
lib/config-utils.js
generated
|
|
@ -908,6 +908,7 @@ async function initConfig(languagesInput, queriesInput, packsInput, registriesIn
|
|||
// When using the codescanning config in the CLI, pack downloads
|
||||
// happen in the CLI during the `database init` command, so no need
|
||||
// to download them here.
|
||||
await (0, util_1.logCodeScanningConfigInCli)(codeQL, featureFlags, logger);
|
||||
if (!(await (0, util_1.useCodeScanningConfigInCli)(codeQL, featureFlags))) {
|
||||
const registries = parseRegistries(registriesInput);
|
||||
await downloadPacks(codeQL, config.languages, config.packs, registries, apiDetails, config.tempDir, logger);
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
11
lib/util.js
generated
11
lib/util.js
generated
|
|
@ -22,7 +22,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.withTimeout = exports.tryGetFolderBytes = exports.isGoExtractionReconciliationEnabled = exports.listFolder = exports.doesDirectoryExist = exports.useCodeScanningConfigInCli = exports.isInTestMode = exports.checkActionVersion = exports.getMlPoweredJsQueriesStatus = exports.getMlPoweredJsQueriesPack = exports.ML_POWERED_JS_QUERIES_PACK_NAME = exports.isGoodVersion = exports.delay = exports.bundleDb = exports.codeQlVersionAbove = exports.getCachedCodeQlVersion = exports.cacheCodeQlVersion = exports.isGitHubGhesVersionBelow = exports.isHTTPError = exports.UserError = exports.HTTPError = exports.getRequiredEnvParam = exports.isActions = exports.getMode = exports.enrichEnvironment = exports.initializeEnvironment = exports.EnvVar = exports.Mode = exports.assertNever = exports.getGitHubAuth = exports.apiVersionInRange = exports.DisallowedAPIVersionReason = exports.checkGitHubVersionInRange = exports.getGitHubVersion = exports.GitHubVariant = exports.parseGitHubUrl = exports.getCodeQLDatabasePath = exports.getThreadsFlag = exports.getThreadsFlagValue = exports.getAddSnippetsFlag = exports.getMemoryFlag = exports.getMemoryFlagValue = exports.withTmpDir = exports.getToolNames = exports.getExtraOptionsEnvParam = exports.DID_AUTOBUILD_GO_ENV_VAR_NAME = exports.DEFAULT_DEBUG_DATABASE_NAME = exports.DEFAULT_DEBUG_ARTIFACT_NAME = exports.GITHUB_DOTCOM_URL = void 0;
|
||||
exports.withTimeout = exports.tryGetFolderBytes = exports.isGoExtractionReconciliationEnabled = exports.listFolder = exports.doesDirectoryExist = exports.logCodeScanningConfigInCli = exports.useCodeScanningConfigInCli = exports.isInTestMode = exports.checkActionVersion = exports.getMlPoweredJsQueriesStatus = exports.getMlPoweredJsQueriesPack = exports.ML_POWERED_JS_QUERIES_PACK_NAME = exports.isGoodVersion = exports.delay = exports.bundleDb = exports.codeQlVersionAbove = exports.getCachedCodeQlVersion = exports.cacheCodeQlVersion = exports.isGitHubGhesVersionBelow = exports.isHTTPError = exports.UserError = exports.HTTPError = exports.getRequiredEnvParam = exports.isActions = exports.getMode = exports.enrichEnvironment = exports.initializeEnvironment = exports.EnvVar = exports.Mode = exports.assertNever = exports.getGitHubAuth = exports.apiVersionInRange = exports.DisallowedAPIVersionReason = exports.checkGitHubVersionInRange = exports.getGitHubVersion = exports.GitHubVariant = exports.parseGitHubUrl = exports.getCodeQLDatabasePath = exports.getThreadsFlag = exports.getThreadsFlagValue = exports.getAddSnippetsFlag = exports.getMemoryFlag = exports.getMemoryFlagValue = exports.withTmpDir = exports.getToolNames = exports.getExtraOptionsEnvParam = exports.DID_AUTOBUILD_GO_ENV_VAR_NAME = exports.DEFAULT_DEBUG_DATABASE_NAME = exports.DEFAULT_DEBUG_ARTIFACT_NAME = exports.GITHUB_DOTCOM_URL = void 0;
|
||||
const fs = __importStar(require("fs"));
|
||||
const os = __importStar(require("os"));
|
||||
const path = __importStar(require("path"));
|
||||
|
|
@ -679,6 +679,15 @@ async function useCodeScanningConfigInCli(codeql, featureFlags) {
|
|||
return await codeQlVersionAbove(codeql, codeql_1.CODEQL_VERSION_CONFIG_FILES);
|
||||
}
|
||||
exports.useCodeScanningConfigInCli = useCodeScanningConfigInCli;
|
||||
async function logCodeScanningConfigInCli(codeql, featureFlags, logger) {
|
||||
if (await useCodeScanningConfigInCli(codeql, featureFlags)) {
|
||||
logger.info("Code Scanning configuration file being processed in the codeql CLI.");
|
||||
}
|
||||
else {
|
||||
logger.info("Code Scanning configuration file being processed in the codeql-action.");
|
||||
}
|
||||
}
|
||||
exports.logCodeScanningConfigInCli = logCodeScanningConfigInCli;
|
||||
/*
|
||||
* Returns whether the path in the argument represents an existing directory.
|
||||
*/
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -239,6 +239,9 @@ export async function runQueries(
|
|||
}
|
||||
|
||||
const codeql = await getCodeQL(config.codeQLCmd);
|
||||
|
||||
await util.logCodeScanningConfigInCli(codeql, featureFlags, logger);
|
||||
|
||||
for (const language of config.languages) {
|
||||
const queries = config.queries[language];
|
||||
const queryFilters = validateQueryFilters(
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ import {
|
|||
codeQlVersionAbove,
|
||||
getMlPoweredJsQueriesPack,
|
||||
GitHubVersion,
|
||||
logCodeScanningConfigInCli,
|
||||
ML_POWERED_JS_QUERIES_PACK_NAME,
|
||||
useCodeScanningConfigInCli,
|
||||
} from "./util";
|
||||
|
|
@ -1704,6 +1705,8 @@ export async function initConfig(
|
|||
// When using the codescanning config in the CLI, pack downloads
|
||||
// happen in the CLI during the `database init` command, so no need
|
||||
// to download them here.
|
||||
await logCodeScanningConfigInCli(codeQL, featureFlags, logger);
|
||||
|
||||
if (!(await useCodeScanningConfigInCli(codeQL, featureFlags))) {
|
||||
const registries = parseRegistries(registriesInput);
|
||||
await downloadPacks(
|
||||
|
|
|
|||
16
src/util.ts
16
src/util.ts
|
|
@ -817,6 +817,22 @@ export async function useCodeScanningConfigInCli(
|
|||
return await codeQlVersionAbove(codeql, CODEQL_VERSION_CONFIG_FILES);
|
||||
}
|
||||
|
||||
export async function logCodeScanningConfigInCli(
|
||||
codeql: CodeQL,
|
||||
featureFlags: FeatureFlags,
|
||||
logger: Logger
|
||||
) {
|
||||
if (await useCodeScanningConfigInCli(codeql, featureFlags)) {
|
||||
logger.info(
|
||||
"Code Scanning configuration file being processed in the codeql CLI."
|
||||
);
|
||||
} else {
|
||||
logger.info(
|
||||
"Code Scanning configuration file being processed in the codeql-action."
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Returns whether the path in the argument represents an existing directory.
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -3,8 +3,10 @@ name: "Check SARIF for default queries with Single include, Single exclude"
|
|||
query-filters:
|
||||
# This should run js/path-injection and js/zipslip
|
||||
- include:
|
||||
tags contain: external/cwe/cwe-022
|
||||
tags contain:
|
||||
- external/cwe/cwe-022
|
||||
|
||||
# Removes js/path-injection
|
||||
- exclude:
|
||||
id: js/path-injection
|
||||
id:
|
||||
- js/path-injection
|
||||
|
|
|
|||
|
|
@ -10,12 +10,15 @@ packs:
|
|||
query-filters:
|
||||
# This should run js/path-injection and js/zipslip
|
||||
- include:
|
||||
tags contain: external/cwe/cwe-022
|
||||
tags contain:
|
||||
- external/cwe/cwe-022
|
||||
|
||||
# Removes js/path-injection
|
||||
- exclude:
|
||||
id: js/path-injection
|
||||
id:
|
||||
- js/path-injection
|
||||
|
||||
# Query from extra pack
|
||||
- include:
|
||||
id: javascript/example/empty-or-one-block
|
||||
id:
|
||||
- javascript/example/empty-or-one-block
|
||||
|
|
|
|||
|
|
@ -20,16 +20,20 @@ packs:
|
|||
query-filters:
|
||||
# This should run js/path-injection and js/zipslip
|
||||
- include:
|
||||
tags contain: external/cwe/cwe-022
|
||||
tags contain:
|
||||
- external/cwe/cwe-022
|
||||
|
||||
# Removes js/path-injection
|
||||
- exclude:
|
||||
id: js/path-injection
|
||||
id:
|
||||
- js/path-injection
|
||||
|
||||
# Query from extra pack
|
||||
- include:
|
||||
id: javascript/example/empty-or-one-block
|
||||
id:
|
||||
- javascript/example/empty-or-one-block
|
||||
|
||||
# Local query
|
||||
- include:
|
||||
id: inrepo-javascript-querypack/show-ifs
|
||||
id:
|
||||
- inrepo-javascript-querypack/show-ifs
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue