2020-06-26 17:22:19 +01:00
"use strict" ;
2021-07-27 17:59:59 +01:00
var _ _createBinding = ( this && this . _ _createBinding ) || ( Object . create ? ( function ( o , m , k , k2 ) {
if ( k2 === undefined ) k2 = k ;
Object . defineProperty ( o , k2 , { enumerable : true , get : function ( ) { return m [ k ] ; } } ) ;
} ) : ( function ( o , m , k , k2 ) {
if ( k2 === undefined ) k2 = k ;
o [ k2 ] = m [ k ] ;
} ) ) ;
var _ _setModuleDefault = ( this && this . _ _setModuleDefault ) || ( Object . create ? ( function ( o , v ) {
Object . defineProperty ( o , "default" , { enumerable : true , value : v } ) ;
} ) : function ( o , v ) {
o [ "default" ] = v ;
} ) ;
2020-06-26 17:22:19 +01:00
var _ _importStar = ( this && this . _ _importStar ) || function ( mod ) {
if ( mod && mod . _ _esModule ) return mod ;
var result = { } ;
2021-07-27 17:59:59 +01:00
if ( mod != null ) for ( var k in mod ) if ( k !== "default" && Object . prototype . hasOwnProperty . call ( mod , k ) ) _ _createBinding ( result , mod , k ) ;
_ _setModuleDefault ( result , mod ) ;
2020-06-26 17:22:19 +01:00
return result ;
} ;
2021-01-26 15:50:22 +00:00
var _ _importDefault = ( this && this . _ _importDefault ) || function ( mod ) {
return ( mod && mod . _ _esModule ) ? mod : { "default" : mod } ;
} ;
2020-06-26 17:22:19 +01:00
Object . defineProperty ( exports , "__esModule" , { value : true } ) ;
2022-01-06 11:55:03 +00:00
exports . getExtraOptions = exports . getCodeQLForTesting = exports . getCachedCodeQL = exports . setCodeQL = exports . getCodeQL = exports . convertToSemVer = exports . getCodeQLURLVersion = exports . setupCodeQL = exports . getCodeQLActionRepository = exports . CODEQL _VERSION _NEW _TRACING = exports . CODEQL _VERSION _ML _POWERED _QUERIES = exports . CODEQL _VERSION _COUNTS _LINES = exports . CommandInvocationError = void 0 ;
2020-06-26 17:22:19 +01:00
const fs = _ _importStar ( require ( "fs" ) ) ;
const path = _ _importStar ( require ( "path" ) ) ;
2020-11-20 11:35:59 +01:00
const toolrunner = _ _importStar ( require ( "@actions/exec/lib/toolrunner" ) ) ;
2021-01-26 15:50:22 +00:00
const fast _deep _equal _1 = _ _importDefault ( require ( "fast-deep-equal" ) ) ;
2022-03-01 14:33:00 +00:00
const yaml = _ _importStar ( require ( "js-yaml" ) ) ;
2021-02-11 15:13:22 +00:00
const query _string _1 = _ _importDefault ( require ( "query-string" ) ) ;
2020-10-01 11:03:30 +01:00
const semver = _ _importStar ( require ( "semver" ) ) ;
2020-09-29 14:43:37 +01:00
const actions _util _1 = require ( "./actions-util" ) ;
2020-10-01 11:03:30 +01:00
const api = _ _importStar ( require ( "./api-client" ) ) ;
const defaults = _ _importStar ( require ( "./defaults.json" ) ) ; // Referenced from codeql-action-sync-tool!
const error _matcher _1 = require ( "./error-matcher" ) ;
2021-09-15 14:49:20 +01:00
const languages _1 = require ( "./languages" ) ;
2021-04-22 15:04:59 +01:00
const toolcache = _ _importStar ( require ( "./toolcache" ) ) ;
2020-09-08 00:01:04 +01:00
const toolrunner _error _catcher _1 = require ( "./toolrunner-error-catcher" ) ;
2020-10-01 11:03:30 +01:00
const util = _ _importStar ( require ( "./util" ) ) ;
2021-12-09 13:43:57 +00:00
const util _1 = require ( "./util" ) ;
2021-06-24 17:30:42 +01:00
class CommandInvocationError extends Error {
constructor ( cmd , args , exitCode , error ) {
super ( ` Failure invoking ${ cmd } with arguments ${ args } . \n
Exit code ${ exitCode } and error was: \n
${ error } ` ) ;
}
}
exports . CommandInvocationError = CommandInvocationError ;
2020-06-26 15:33:59 +01:00
/**
2020-07-15 17:36:49 +01:00
* Stores the CodeQL object, and is populated by `setupCodeQL` or `getCodeQL`.
2020-06-26 15:33:59 +01:00
* Can be overridden in tests using `setCodeQL`.
*/
let cachedCodeQL = undefined ;
2020-08-10 12:34:11 +01:00
const CODEQL _BUNDLE _VERSION = defaults . bundleVersion ;
2020-07-10 11:54:26 +01:00
const CODEQL _DEFAULT _ACTION _REPOSITORY = "github/codeql-action" ;
2021-08-18 10:15:48 +01:00
/**
* The oldest version of CodeQL that the Action will run with. This should be
* at least three minor versions behind the current version. The version flags
* below can be used to conditionally enable certain features on versions newer
* than this. Please record the reason we cannot support an older version.
*
2022-02-16 12:31:32 +00:00
* Reason: First version containing fix for the "We still have not reached
* idleness" deadlock.
2021-08-18 10:15:48 +01:00
*/
2022-02-16 12:31:32 +00:00
const CODEQL _MINIMUM _VERSION = "2.4.5" ;
2021-08-18 09:44:49 +01:00
/**
* Versions of CodeQL that version-flag certain functionality in the Action.
2021-08-18 10:15:48 +01:00
* For convenience, please keep these in descending order. Once a version
* flag is older than the oldest supported version above, it may be removed.
2021-08-18 09:44:49 +01:00
*/
2021-08-12 16:02:19 +01:00
const CODEQL _VERSION _RAM _FINALIZE = "2.5.8" ;
2021-08-18 09:44:49 +01:00
const CODEQL _VERSION _DIAGNOSTICS = "2.5.6" ;
const CODEQL _VERSION _METRICS = "2.5.5" ;
2021-08-18 16:39:00 +01:00
const CODEQL _VERSION _GROUP _RULES = "2.5.5" ;
const CODEQL _VERSION _SARIF _GROUP = "2.5.3" ;
2021-09-28 09:25:35 +01:00
exports . CODEQL _VERSION _COUNTS _LINES = "2.6.2" ;
2021-11-03 13:19:01 -07:00
const CODEQL _VERSION _CUSTOM _QUERY _HELP = "2.7.1" ;
2022-03-01 14:34:33 +00:00
const CODEQL _VERSION _CONFIG _FILES = "2.8.2" ; // Versions before 2.8.2 weren't tolerant to unknown properties
2022-01-06 11:55:03 +00:00
exports . CODEQL _VERSION _ML _POWERED _QUERIES = "2.7.5" ;
2021-10-08 12:40:00 +01:00
/**
2021-10-12 13:41:36 +01:00
* This variable controls using the new style of tracing from the CodeQL
* CLI. In particular, with versions above this we will use both indirect
* tracing, and multi-language tracing together with database clusters.
2021-10-08 12:40:00 +01:00
*
2021-10-12 13:41:36 +01:00
* Note that there were bugs in both of these features that were fixed in
* release 2.7.0 of the CodeQL CLI, therefore this flag is only enabled for
* versions above that.
2021-10-08 12:40:00 +01:00
*/
2021-10-12 13:41:36 +01:00
exports . CODEQL _VERSION _NEW _TRACING = "2.7.0" ;
2020-09-30 16:17:07 +02:00
function getCodeQLBundleName ( ) {
let platform ;
if ( process . platform === "win32" ) {
platform = "win64" ;
}
else if ( process . platform === "linux" ) {
platform = "linux64" ;
}
else if ( process . platform === "darwin" ) {
platform = "osx64" ;
}
else {
return "codeql-bundle.tar.gz" ;
}
return ` codeql-bundle- ${ platform } .tar.gz ` ;
}
2021-05-20 15:20:32 -07:00
function getCodeQLActionRepository ( logger ) {
2021-06-24 17:51:49 +01:00
if ( ! util . isActions ( ) ) {
2020-08-27 16:34:09 +01:00
return CODEQL _DEFAULT _ACTION _REPOSITORY ;
2020-08-25 16:19:15 +01:00
}
2021-03-16 11:59:10 +00:00
else {
return getActionsCodeQLActionRepository ( logger ) ;
}
}
2021-05-20 15:20:32 -07:00
exports . getCodeQLActionRepository = getCodeQLActionRepository ;
2021-03-16 11:59:10 +00:00
function getActionsCodeQLActionRepository ( logger ) {
2020-11-10 12:35:14 +00:00
if ( process . env [ "GITHUB_ACTION_REPOSITORY" ] !== undefined ) {
return process . env [ "GITHUB_ACTION_REPOSITORY" ] ;
}
// The Actions Runner used with GitHub Enterprise Server 2.22 did not set the GITHUB_ACTION_REPOSITORY variable.
// This fallback logic can be removed after the end-of-support for 2.22 on 2021-09-23.
2021-09-10 13:53:13 -07:00
if ( ( 0 , actions _util _1 . isRunningLocalAction ) ( ) ) {
2020-11-12 14:18:58 +00:00
// This handles the case where the Action does not come from an Action repository,
// e.g. our integration tests which use the Action code from the current checkout.
2020-11-10 12:35:14 +00:00
logger . info ( "The CodeQL Action is checked out locally. Using the default CodeQL Action repository." ) ;
2020-07-10 11:54:26 +01:00
return CODEQL _DEFAULT _ACTION _REPOSITORY ;
}
2020-11-10 12:35:14 +00:00
logger . info ( "GITHUB_ACTION_REPOSITORY environment variable was not set. Falling back to legacy method of finding the GitHub Action." ) ;
2021-09-10 13:53:13 -07:00
const relativeScriptPathParts = ( 0 , actions _util _1 . getRelativeScriptPath ) ( ) . split ( path . sep ) ;
2020-09-14 10:44:43 +01:00
return ` ${ relativeScriptPathParts [ 0 ] } / ${ relativeScriptPathParts [ 1 ] } ` ;
2020-07-10 11:54:26 +01:00
}
2021-05-20 15:20:32 -07:00
async function getCodeQLBundleDownloadURL ( apiDetails , variant , logger ) {
const codeQLActionRepository = getCodeQLActionRepository ( logger ) ;
2020-07-10 11:54:26 +01:00
const potentialDownloadSources = [
// This GitHub instance, and this Action.
2020-11-23 14:18:05 +00:00
[ apiDetails . url , codeQLActionRepository ] ,
2020-07-10 11:54:26 +01:00
// This GitHub instance, and the canonical Action.
2020-11-23 14:18:05 +00:00
[ apiDetails . url , CODEQL _DEFAULT _ACTION _REPOSITORY ] ,
2020-07-10 11:54:26 +01:00
// GitHub.com, and the canonical Action.
2020-08-25 16:19:15 +01:00
[ util . GITHUB _DOTCOM _URL , CODEQL _DEFAULT _ACTION _REPOSITORY ] ,
2020-07-10 11:54:26 +01:00
] ;
// We now filter out any duplicates.
// Duplicates will happen either because the GitHub instance is GitHub.com, or because the Action is not a fork.
2021-01-26 15:50:22 +00:00
const uniqueDownloadSources = potentialDownloadSources . filter ( ( source , index , self ) => {
2021-09-10 13:53:13 -07:00
return ! self . slice ( 0 , index ) . some ( ( other ) => ( 0 , fast _deep _equal _1 . default ) ( source , other ) ) ;
2021-01-26 15:50:22 +00:00
} ) ;
2020-09-30 16:17:07 +02:00
const codeQLBundleName = getCodeQLBundleName ( ) ;
2021-03-07 09:27:19 +00:00
if ( variant === util . GitHubVariant . GHAE ) {
try {
const release = await api
. getApiClient ( apiDetails )
. request ( "GET /enterprise/code-scanning/codeql-bundle/find/{tag}" , {
tag : CODEQL _BUNDLE _VERSION ,
} ) ;
const assetID = release . data . assets [ codeQLBundleName ] ;
if ( assetID !== undefined ) {
const download = await api
. getApiClient ( apiDetails )
. request ( "GET /enterprise/code-scanning/codeql-bundle/download/{asset_id}" , { asset _id : assetID } ) ;
const downloadURL = download . data . url ;
logger . info ( ` Found CodeQL bundle at GitHub AE endpoint with URL ${ downloadURL } . ` ) ;
return downloadURL ;
}
else {
logger . info ( ` Attempted to fetch bundle from GitHub AE endpoint but the bundle ${ codeQLBundleName } was not found in the assets ${ JSON . stringify ( release . data . assets ) } . ` ) ;
}
}
catch ( e ) {
logger . info ( ` Attempted to fetch bundle from GitHub AE endpoint but got error ${ e } . ` ) ;
}
}
2020-09-14 10:44:43 +01:00
for ( const downloadSource of uniqueDownloadSources ) {
const [ apiURL , repository ] = downloadSource ;
2020-07-10 11:54:26 +01:00
// If we've reached the final case, short-circuit the API check since we know the bundle exists and is public.
2020-09-14 10:44:43 +01:00
if ( apiURL === util . GITHUB _DOTCOM _URL &&
repository === CODEQL _DEFAULT _ACTION _REPOSITORY ) {
2020-07-27 10:47:45 +01:00
break ;
2020-07-10 11:54:26 +01:00
}
2020-09-14 10:44:43 +01:00
const [ repositoryOwner , repositoryName ] = repository . split ( "/" ) ;
2020-07-10 11:54:26 +01:00
try {
2020-11-30 16:33:38 +00:00
const release = await api . getApiClient ( apiDetails ) . repos . getReleaseByTag ( {
2020-07-10 11:54:26 +01:00
owner : repositoryOwner ,
repo : repositoryName ,
2020-09-14 10:44:43 +01:00
tag : CODEQL _BUNDLE _VERSION ,
2020-07-10 11:54:26 +01:00
} ) ;
2020-09-14 10:44:43 +01:00
for ( const asset of release . data . assets ) {
2020-09-30 16:17:07 +02:00
if ( asset . name === codeQLBundleName ) {
2020-08-25 16:19:15 +01:00
logger . info ( ` Found CodeQL bundle in ${ downloadSource [ 1 ] } on ${ downloadSource [ 0 ] } with URL ${ asset . url } . ` ) ;
2020-07-10 11:54:26 +01:00
return asset . url ;
}
}
}
catch ( e ) {
2020-08-25 16:19:15 +01:00
logger . info ( ` Looked for CodeQL bundle in ${ downloadSource [ 1 ] } on ${ downloadSource [ 0 ] } but got error ${ e } . ` ) ;
2020-07-10 11:54:26 +01:00
}
}
2020-09-30 16:17:07 +02:00
return ` https://github.com/ ${ CODEQL _DEFAULT _ACTION _REPOSITORY } /releases/download/ ${ CODEQL _BUNDLE _VERSION } / ${ codeQLBundleName } ` ;
2020-07-10 11:54:26 +01:00
}
2021-08-18 10:15:48 +01:00
async function setupCodeQL ( codeqlURL , apiDetails , tempDir , toolCacheDir , variant , logger , checkVersion ) {
2020-06-26 17:22:19 +01:00
try {
2021-06-28 23:33:27 +01:00
// We use the special value of 'latest' to prioritize the version in the
// defaults over any pinned cached version.
const forceLatest = codeqlURL === "latest" ;
if ( forceLatest ) {
codeqlURL = undefined ;
}
2021-06-28 15:44:13 +01:00
let codeqlFolder ;
let codeqlURLVersion ;
2021-06-28 23:33:27 +01:00
if ( codeqlURL && ! codeqlURL . startsWith ( "http" ) ) {
codeqlFolder = await toolcache . extractTar ( codeqlURL , tempDir , logger ) ;
2021-06-28 15:44:13 +01:00
codeqlURLVersion = "local" ;
2020-06-26 17:22:19 +01:00
}
else {
2021-06-28 15:44:13 +01:00
codeqlURLVersion = getCodeQLURLVersion ( codeqlURL || ` / ${ CODEQL _BUNDLE _VERSION } / ` ) ;
const codeqlURLSemVer = convertToSemVer ( codeqlURLVersion , logger ) ;
// If we find the specified version, we always use that.
codeqlFolder = toolcache . find ( "CodeQL" , codeqlURLSemVer , toolCacheDir , logger ) ;
// If we don't find the requested version, in some cases we may allow a
// different version to save download time if the version hasn't been
// specified explicitly (in which case we always honor it).
if ( ! codeqlFolder && ! codeqlURL && ! forceLatest ) {
const codeqlVersions = toolcache . findAllVersions ( "CodeQL" , toolCacheDir , logger ) ;
2021-12-09 13:43:57 +00:00
if ( codeqlVersions . length === 1 && ( 0 , util _1 . isGoodVersion ) ( codeqlVersions [ 0 ] ) ) {
2021-06-28 15:44:13 +01:00
const tmpCodeqlFolder = toolcache . find ( "CodeQL" , codeqlVersions [ 0 ] , toolCacheDir , logger ) ;
if ( fs . existsSync ( path . join ( tmpCodeqlFolder , "pinned-version" ) ) ) {
logger . debug ( ` CodeQL in cache overriding the default ${ CODEQL _BUNDLE _VERSION } ` ) ;
codeqlFolder = tmpCodeqlFolder ;
}
}
}
if ( codeqlFolder ) {
logger . debug ( ` CodeQL found in cache ${ codeqlFolder } ` ) ;
2020-07-10 11:54:26 +01:00
}
else {
2021-06-28 15:44:13 +01:00
if ( ! codeqlURL ) {
codeqlURL = await getCodeQLBundleDownloadURL ( apiDetails , variant , logger ) ;
}
const parsedCodeQLURL = new URL ( codeqlURL ) ;
const parsedQueryString = query _string _1 . default . parse ( parsedCodeQLURL . search ) ;
const headers = { accept : "application/octet-stream" } ;
// We only want to provide an authorization header if we are downloading
// from the same GitHub instance the Action is running on.
// This avoids leaking Enterprise tokens to dotcom.
// We also don't want to send an authorization header if there's already a token provided in the URL.
if ( codeqlURL . startsWith ( ` ${ apiDetails . url } / ` ) &&
parsedQueryString [ "token" ] === undefined ) {
logger . debug ( "Downloading CodeQL bundle with token." ) ;
headers . authorization = ` token ${ apiDetails . auth } ` ;
}
else {
logger . debug ( "Downloading CodeQL bundle without token." ) ;
}
logger . info ( ` Downloading CodeQL tools from ${ codeqlURL } . This may take a while. ` ) ;
const codeqlPath = await toolcache . downloadTool ( codeqlURL , tempDir , headers ) ;
logger . debug ( ` CodeQL bundle download to ${ codeqlPath } complete. ` ) ;
const codeqlExtracted = await toolcache . extractTar ( codeqlPath , tempDir , logger ) ;
codeqlFolder = await toolcache . cacheDir ( codeqlExtracted , "CodeQL" , codeqlURLSemVer , toolCacheDir , logger ) ;
2020-07-10 11:54:26 +01:00
}
2020-06-26 17:22:19 +01:00
}
2020-09-14 10:44:43 +01:00
let codeqlCmd = path . join ( codeqlFolder , "codeql" , "codeql" ) ;
if ( process . platform === "win32" ) {
2020-06-26 17:22:19 +01:00
codeqlCmd += ".exe" ;
}
2020-09-14 10:44:43 +01:00
else if ( process . platform !== "linux" && process . platform !== "darwin" ) {
throw new Error ( ` Unsupported platform: ${ process . platform } ` ) ;
2020-06-26 17:22:19 +01:00
}
2021-08-18 10:15:48 +01:00
cachedCodeQL = await getCodeQLForCmd ( codeqlCmd , checkVersion ) ;
2020-11-11 18:22:12 +00:00
return { codeql : cachedCodeQL , toolsVersion : codeqlURLVersion } ;
2020-06-26 17:22:19 +01:00
}
catch ( e ) {
2021-09-10 13:53:13 -07:00
logger . error ( e instanceof Error ? e : new Error ( String ( e ) ) ) ;
2020-06-26 17:22:19 +01:00
throw new Error ( "Unable to download and extract CodeQL CLI" ) ;
}
}
exports . setupCodeQL = setupCodeQL ;
2020-11-11 18:22:12 +00:00
function getCodeQLURLVersion ( url ) {
2020-06-26 17:22:19 +01:00
const match = url . match ( /\/codeql-bundle-(.*)\// ) ;
if ( match === null || match . length < 2 ) {
throw new Error ( ` Malformed tools url: ${ url } . Version could not be inferred ` ) ;
}
2020-11-11 18:22:12 +00:00
return match [ 1 ] ;
}
exports . getCodeQLURLVersion = getCodeQLURLVersion ;
function convertToSemVer ( version , logger ) {
2020-06-26 17:22:19 +01:00
if ( ! semver . valid ( version ) ) {
2020-08-25 16:19:15 +01:00
logger . debug ( ` Bundle version ${ version } is not in SemVer format. Will treat it as pre-release 0.0.0- ${ version } . ` ) ;
2020-09-14 10:44:43 +01:00
version = ` 0.0.0- ${ version } ` ;
2020-06-26 17:22:19 +01:00
}
const s = semver . clean ( version ) ;
if ( ! s ) {
2020-11-11 18:22:12 +00:00
throw new Error ( ` Bundle version ${ version } is not in SemVer format. ` ) ;
2020-06-26 17:22:19 +01:00
}
return s ;
}
2020-11-11 18:22:12 +00:00
exports . convertToSemVer = convertToSemVer ;
2020-08-19 15:54:23 +01:00
/**
* Use the CodeQL executable located at the given path.
*/
2021-08-18 10:15:48 +01:00
async function getCodeQL ( cmd ) {
2020-06-26 15:33:59 +01:00
if ( cachedCodeQL === undefined ) {
2021-08-18 10:15:48 +01:00
cachedCodeQL = await getCodeQLForCmd ( cmd , true ) ;
2020-06-26 15:33:59 +01:00
}
return cachedCodeQL ;
2020-06-26 17:22:19 +01:00
}
exports . getCodeQL = getCodeQL ;
2020-08-19 15:54:23 +01:00
function resolveFunction ( partialCodeql , methodName , defaultImplementation ) {
2020-09-14 10:44:43 +01:00
if ( typeof partialCodeql [ methodName ] !== "function" ) {
2020-08-19 15:54:23 +01:00
if ( defaultImplementation !== undefined ) {
return defaultImplementation ;
}
2020-06-26 15:33:59 +01:00
const dummyMethod = ( ) => {
2020-09-14 10:44:43 +01:00
throw new Error ( ` CodeQL ${ methodName } method not correctly defined ` ) ;
2020-06-26 15:33:59 +01:00
} ;
return dummyMethod ;
}
return partialCodeql [ methodName ] ;
}
2020-07-15 17:36:49 +01:00
/**
* Set the functionality for CodeQL methods. Only for use in tests.
*
* Accepts a partial object and any undefined methods will be implemented
* to immediately throw an exception indicating which method is missing.
*/
2020-06-26 15:33:59 +01:00
function setCodeQL ( partialCodeql ) {
cachedCodeQL = {
2020-09-14 10:44:43 +01:00
getPath : resolveFunction ( partialCodeql , "getPath" , ( ) => "/tmp/dummy-path" ) ,
2021-08-12 16:02:19 +01:00
getVersion : resolveFunction ( partialCodeql , "getVersion" , ( ) => new Promise ( ( resolve ) => resolve ( "1.0.0" ) ) ) ,
2020-09-14 10:44:43 +01:00
printVersion : resolveFunction ( partialCodeql , "printVersion" ) ,
getTracerEnv : resolveFunction ( partialCodeql , "getTracerEnv" ) ,
databaseInit : resolveFunction ( partialCodeql , "databaseInit" ) ,
2021-09-15 14:49:20 +01:00
databaseInitCluster : resolveFunction ( partialCodeql , "databaseInitCluster" ) ,
2020-09-14 10:44:43 +01:00
runAutobuild : resolveFunction ( partialCodeql , "runAutobuild" ) ,
extractScannedLanguage : resolveFunction ( partialCodeql , "extractScannedLanguage" ) ,
finalizeDatabase : resolveFunction ( partialCodeql , "finalizeDatabase" ) ,
2021-05-23 16:27:46 +02:00
resolveLanguages : resolveFunction ( partialCodeql , "resolveLanguages" ) ,
2020-09-14 10:44:43 +01:00
resolveQueries : resolveFunction ( partialCodeql , "resolveQueries" ) ,
2021-06-03 09:32:44 -07:00
packDownload : resolveFunction ( partialCodeql , "packDownload" ) ,
2021-05-24 17:26:13 +01:00
databaseCleanup : resolveFunction ( partialCodeql , "databaseCleanup" ) ,
2021-06-22 13:05:12 +01:00
databaseBundle : resolveFunction ( partialCodeql , "databaseBundle" ) ,
2021-06-04 14:28:55 +01:00
databaseRunQueries : resolveFunction ( partialCodeql , "databaseRunQueries" ) ,
databaseInterpretResults : resolveFunction ( partialCodeql , "databaseInterpretResults" ) ,
2021-09-28 09:25:35 +01:00
databasePrintBaseline : resolveFunction ( partialCodeql , "databasePrintBaseline" ) ,
2020-06-26 15:33:59 +01:00
} ;
2020-08-19 15:54:23 +01:00
return cachedCodeQL ;
2020-06-26 15:33:59 +01:00
}
exports . setCodeQL = setCodeQL ;
2020-08-19 15:54:23 +01:00
/**
* Get the cached CodeQL object. Should only be used from tests.
*
* TODO: Work out a good way for tests to get this from the test context
* instead of having to have this method.
*/
function getCachedCodeQL ( ) {
if ( cachedCodeQL === undefined ) {
// Should never happen as setCodeQL is called by testing-utils.setupTests
2020-09-14 10:44:43 +01:00
throw new Error ( "cachedCodeQL undefined" ) ;
2020-08-19 15:54:23 +01:00
}
return cachedCodeQL ;
}
exports . getCachedCodeQL = getCachedCodeQL ;
2021-11-03 13:19:01 -07:00
/**
* Get a real, newly created CodeQL instance for testing. The instance refers to
* a non-existent placeholder codeql command, so tests that use this function
* should also stub the toolrunner.ToolRunner constructor.
*/
async function getCodeQLForTesting ( ) {
return getCodeQLForCmd ( "codeql-for-testing" , false ) ;
}
exports . getCodeQLForTesting = getCodeQLForTesting ;
2021-08-18 10:15:48 +01:00
async function getCodeQLForCmd ( cmd , checkVersion ) {
2021-08-18 09:25:16 +01:00
let cachedVersion = undefined ;
2021-08-18 10:15:48 +01:00
const codeql = {
2020-09-14 10:44:43 +01:00
getPath ( ) {
2020-08-19 15:54:23 +01:00
return cmd ;
2020-06-26 17:22:19 +01:00
} ,
2021-08-12 16:02:19 +01:00
async getVersion ( ) {
2021-08-18 09:25:16 +01:00
if ( cachedVersion === undefined )
cachedVersion = runTool ( cmd , [ "version" , "--format=terse" ] ) ;
return await cachedVersion ;
2021-08-12 16:02:19 +01:00
} ,
2020-09-14 10:44:43 +01:00
async printVersion ( ) {
2021-06-09 13:17:25 -07:00
await runTool ( cmd , [ "version" , "--format=json" ] ) ;
2020-06-26 17:22:19 +01:00
} ,
2020-09-14 10:44:43 +01:00
async getTracerEnv ( databasePath ) {
2020-08-27 16:34:09 +01:00
// Write tracer-env.js to a temp location.
2021-05-13 22:01:26 +02:00
// BEWARE: The name and location of this file is recognized by `codeql database
// trace-command` in order to enable special support for concatenable tracer
// configurations. Consequently the name must not be changed.
// (This warning can be removed once a different way to recognize the
// action/runner has been implemented in `codeql database trace-command`
// _and_ is present in the latest supported CLI release.)
2020-09-14 10:44:43 +01:00
const tracerEnvJs = path . resolve ( databasePath , "working" , "tracer-env.js" ) ;
2020-08-26 16:18:53 +01:00
fs . mkdirSync ( path . dirname ( tracerEnvJs ) , { recursive : true } ) ;
fs . writeFileSync ( tracerEnvJs , `
const fs = require('fs');
const env = {};
for (let entry of Object.entries(process.env)) {
const key = entry[0];
const value = entry[1];
if (typeof value !== 'undefined' && key !== '_' && !key.startsWith('JAVA_MAIN_CLASS_')) {
env[key] = value;
}
}
process.stdout.write(process.argv[2]);
fs.writeFileSync(process.argv[2], JSON.stringify(env), 'utf-8'); ` ) ;
2021-05-13 22:01:26 +02:00
// BEWARE: The name and location of this file is recognized by `codeql database
// trace-command` in order to enable special support for concatenable tracer
// configurations. Consequently the name must not be changed.
// (This warning can be removed once a different way to recognize the
// action/runner has been implemented in `codeql database trace-command`
// _and_ is present in the latest supported CLI release.)
2020-09-14 10:44:43 +01:00
const envFile = path . resolve ( databasePath , "working" , "env.tmp" ) ;
2021-06-09 13:17:25 -07:00
await runTool ( cmd , [
2020-09-14 10:44:43 +01:00
"database" ,
"trace-command" ,
2020-07-02 14:45:14 +01:00
databasePath ,
2020-09-14 10:44:43 +01:00
... getExtraOptionsFromEnv ( [ "database" , "trace-command" ] ) ,
2020-06-26 17:22:19 +01:00
process . execPath ,
2020-08-26 16:18:53 +01:00
tracerEnvJs ,
2020-09-14 10:44:43 +01:00
envFile ,
2021-06-09 13:17:25 -07:00
] ) ;
2020-09-14 10:44:43 +01:00
return JSON . parse ( fs . readFileSync ( envFile , "utf-8" ) ) ;
2020-06-26 17:22:19 +01:00
} ,
2020-09-14 10:44:43 +01:00
async databaseInit ( databasePath , language , sourceRoot ) {
2021-06-09 13:17:25 -07:00
await runTool ( cmd , [
2020-09-14 10:44:43 +01:00
"database" ,
"init" ,
2020-07-02 14:45:14 +01:00
databasePath ,
2020-09-14 10:44:43 +01:00
` --language= ${ language } ` ,
` --source-root= ${ sourceRoot } ` ,
... getExtraOptionsFromEnv ( [ "database" , "init" ] ) ,
2021-06-09 13:17:25 -07:00
] ) ;
2020-06-26 17:22:19 +01:00
} ,
2022-03-01 14:33:00 +00:00
async databaseInitCluster ( config , sourceRoot , processName , processLevel ) {
const extraArgs = config . languages . map ( ( language ) => ` --language= ${ language } ` ) ;
if ( config . languages . filter ( languages _1 . isTracedLanguage ) . length > 0 ) {
2021-09-15 14:49:20 +01:00
extraArgs . push ( "--begin-tracing" ) ;
if ( processName !== undefined ) {
extraArgs . push ( ` --trace-process-name= ${ processName } ` ) ;
}
else {
2022-03-01 14:33:00 +00:00
// We default to 3 if no other arguments are provided since this was the default
// behaviour of the Runner. Note this path never happens in the CodeQL Action
// because that always passes in a process name.
2021-09-15 14:49:20 +01:00
extraArgs . push ( ` --trace-process-level= ${ processLevel || 3 } ` ) ;
}
}
2022-03-01 14:33:00 +00:00
if ( await util . codeQlVersionAbove ( codeql , CODEQL _VERSION _CONFIG _FILES ) ) {
const configLocation = path . resolve ( config . tempDir , "user-config.yaml" ) ;
fs . writeFileSync ( configLocation , yaml . dump ( config . originalUserInput ) ) ;
extraArgs . push ( ` --codescanning-config= ${ configLocation } ` ) ;
}
2021-09-15 14:49:20 +01:00
await runTool ( cmd , [
"database" ,
"init" ,
"--db-cluster" ,
2022-03-01 14:33:00 +00:00
config . dbLocation ,
2021-09-15 14:49:20 +01:00
` --source-root= ${ sourceRoot } ` ,
... extraArgs ,
... getExtraOptionsFromEnv ( [ "database" , "init" ] ) ,
] ) ;
} ,
2020-09-14 10:44:43 +01:00
async runAutobuild ( language ) {
const cmdName = process . platform === "win32" ? "autobuild.cmd" : "autobuild.sh" ;
const autobuildCmd = path . join ( path . dirname ( cmd ) , language , "tools" , cmdName ) ;
2020-07-02 14:45:14 +01:00
// Update JAVA_TOOL_OPTIONS to contain '-Dhttp.keepAlive=false'
// This is because of an issue with Azure pipelines timing out connections after 4 minutes
// and Maven not properly handling closed connections
// Otherwise long build processes will timeout when pulling down Java packages
// https://developercommunity.visualstudio.com/content/problem/292284/maven-hosted-agent-connection-timeout.html
2020-09-14 10:44:43 +01:00
const javaToolOptions = process . env [ "JAVA_TOOL_OPTIONS" ] || "" ;
process . env [ "JAVA_TOOL_OPTIONS" ] = [
... javaToolOptions . split ( /\s+/ ) ,
"-Dhttp.keepAlive=false" ,
"-Dmaven.wagon.http.pool=false" ,
] . join ( " " ) ;
2021-12-08 10:07:10 -08:00
await runTool ( autobuildCmd ) ;
2020-07-02 14:45:14 +01:00
} ,
2020-09-14 10:44:43 +01:00
async extractScannedLanguage ( databasePath , language ) {
2020-06-26 17:22:19 +01:00
// Get extractor location
2020-09-14 10:44:43 +01:00
let extractorPath = "" ;
2020-11-20 11:35:59 +01:00
await new toolrunner . ToolRunner ( cmd , [
2020-09-14 10:44:43 +01:00
"resolve" ,
"extractor" ,
"--format=json" ,
` --language= ${ language } ` ,
... getExtraOptionsFromEnv ( [ "resolve" , "extractor" ] ) ,
2020-09-03 17:01:51 +01:00
] , {
2020-06-26 17:22:19 +01:00
silent : true ,
listeners : {
2020-09-14 10:44:43 +01:00
stdout : ( data ) => {
extractorPath += data . toString ( ) ;
} ,
stderr : ( data ) => {
process . stderr . write ( data ) ;
} ,
} ,
2020-08-28 16:37:14 +01:00
} ) . exec ( ) ;
2020-06-26 17:22:19 +01:00
// Set trace command
2020-09-14 10:44:43 +01:00
const ext = process . platform === "win32" ? ".cmd" : ".sh" ;
const traceCommand = path . resolve ( JSON . parse ( extractorPath ) , "tools" , ` autobuild ${ ext } ` ) ;
2020-06-26 17:22:19 +01:00
// Run trace command
2021-09-10 13:53:13 -07:00
await ( 0 , toolrunner _error _catcher _1 . toolrunnerErrorCatcher ) ( cmd , [
2020-09-14 10:44:43 +01:00
"database" ,
"trace-command" ,
... getExtraOptionsFromEnv ( [ "database" , "trace-command" ] ) ,
2020-07-02 14:45:14 +01:00
databasePath ,
2020-09-14 10:44:43 +01:00
"--" ,
traceCommand ,
2020-09-07 22:50:37 +01:00
] , error _matcher _1 . errorMatchers ) ;
2020-06-26 17:22:19 +01:00
} ,
2021-08-12 16:02:19 +01:00
async finalizeDatabase ( databasePath , threadsFlag , memoryFlag ) {
const args = [
2020-09-14 10:44:43 +01:00
"database" ,
"finalize" ,
2021-06-09 15:00:42 +01:00
"--finalize-dataset" ,
2020-11-03 08:25:40 -08:00
threadsFlag ,
2020-09-14 10:44:43 +01:00
... getExtraOptionsFromEnv ( [ "database" , "finalize" ] ) ,
databasePath ,
2021-08-12 16:02:19 +01:00
] ;
if ( await util . codeQlVersionAbove ( this , CODEQL _VERSION _RAM _FINALIZE ) )
args . push ( memoryFlag ) ;
2021-09-10 13:53:13 -07:00
await ( 0 , toolrunner _error _catcher _1 . toolrunnerErrorCatcher ) ( cmd , args , error _matcher _1 . errorMatchers ) ;
2020-06-26 17:22:19 +01:00
} ,
2021-05-23 16:27:46 +02:00
async resolveLanguages ( ) {
2022-01-21 13:44:52 +00:00
const codeqlArgs = [
"resolve" ,
"languages" ,
"--format=json" ,
... getExtraOptionsFromEnv ( [ "resolve" , "languages" ] ) ,
] ;
2021-06-09 13:17:25 -07:00
const output = await runTool ( cmd , codeqlArgs ) ;
2021-05-24 11:00:02 +02:00
try {
return JSON . parse ( output ) ;
}
catch ( e ) {
throw new Error ( ` Unexpected output from codeql resolve languages: ${ e } ` ) ;
}
2021-05-23 16:27:46 +02:00
} ,
2020-09-14 10:44:43 +01:00
async resolveQueries ( queries , extraSearchPath ) {
2020-06-26 15:33:59 +01:00
const codeqlArgs = [
2020-09-14 10:44:43 +01:00
"resolve" ,
"queries" ,
2020-06-26 17:22:19 +01:00
... queries ,
2020-09-14 10:44:43 +01:00
"--format=bylanguage" ,
... getExtraOptionsFromEnv ( [ "resolve" , "queries" ] ) ,
2020-06-26 15:33:59 +01:00
] ;
if ( extraSearchPath !== undefined ) {
2021-05-20 19:03:50 +00:00
codeqlArgs . push ( "--additional-packs" , extraSearchPath ) ;
2020-06-26 15:33:59 +01:00
}
2021-06-09 13:17:25 -07:00
const output = await runTool ( cmd , codeqlArgs ) ;
2021-05-24 11:00:02 +02:00
try {
return JSON . parse ( output ) ;
}
catch ( e ) {
throw new Error ( ` Unexpected output from codeql resolve queries: ${ e } ` ) ;
}
2020-06-26 17:22:19 +01:00
} ,
2021-06-04 14:28:55 +01:00
async databaseRunQueries ( databasePath , extraSearchPath , querySuitePath , memoryFlag , threadsFlag ) {
2021-06-09 13:17:25 -07:00
const codeqlArgs = [
2020-09-14 10:44:43 +01:00
"database" ,
2021-06-04 14:28:55 +01:00
"run-queries" ,
2020-09-01 14:13:10 +01:00
memoryFlag ,
threadsFlag ,
2020-07-02 14:45:14 +01:00
databasePath ,
2020-09-24 11:42:21 +02:00
"--min-disk-free=1024" ,
2021-05-05 18:09:10 +01:00
"-v" ,
2021-06-04 14:28:55 +01:00
... getExtraOptionsFromEnv ( [ "database" , "run-queries" ] ) ,
2021-04-01 12:38:13 +01:00
] ;
if ( extraSearchPath !== undefined ) {
2021-06-09 13:17:25 -07:00
codeqlArgs . push ( "--additional-packs" , extraSearchPath ) ;
2021-04-01 12:38:13 +01:00
}
2022-03-01 14:33:00 +00:00
if ( ! ( await util . codeQlVersionAbove ( this , CODEQL _VERSION _CONFIG _FILES ) ) ) {
codeqlArgs . push ( querySuitePath ) ;
}
2021-06-09 13:17:25 -07:00
await runTool ( cmd , codeqlArgs ) ;
2021-06-04 14:28:55 +01:00
} ,
async databaseInterpretResults ( databasePath , querySuitePaths , sarifFile , addSnippetsFlag , threadsFlag , automationDetailsId ) {
2021-06-09 13:17:25 -07:00
const codeqlArgs = [
2021-06-04 14:28:55 +01:00
"database" ,
"interpret-results" ,
threadsFlag ,
"--format=sarif-latest" ,
"-v" ,
` --output= ${ sarifFile } ` ,
addSnippetsFlag ,
... getExtraOptionsFromEnv ( [ "database" , "interpret-results" ] ) ,
] ;
2021-08-18 09:44:49 +01:00
if ( await util . codeQlVersionAbove ( this , CODEQL _VERSION _DIAGNOSTICS ) )
codeqlArgs . push ( "--print-diagnostics-summary" ) ;
if ( await util . codeQlVersionAbove ( this , CODEQL _VERSION _METRICS ) )
codeqlArgs . push ( "--print-metrics-summary" ) ;
if ( await util . codeQlVersionAbove ( this , CODEQL _VERSION _GROUP _RULES ) )
codeqlArgs . push ( "--sarif-group-rules-by-pack" ) ;
2021-11-03 13:19:01 -07:00
if ( await util . codeQlVersionAbove ( this , CODEQL _VERSION _CUSTOM _QUERY _HELP ) )
codeqlArgs . push ( "--sarif-add-query-help" ) ;
2021-08-18 16:39:00 +01:00
if ( automationDetailsId !== undefined &&
( await util . codeQlVersionAbove ( this , CODEQL _VERSION _SARIF _GROUP ) ) ) {
2021-06-09 13:17:25 -07:00
codeqlArgs . push ( "--sarif-category" , automationDetailsId ) ;
2021-05-03 19:41:53 +02:00
}
2022-03-01 14:33:00 +00:00
codeqlArgs . push ( databasePath ) ;
if ( ! ( await util . codeQlVersionAbove ( this , CODEQL _VERSION _CONFIG _FILES ) ) ) {
codeqlArgs . push ( ... querySuitePaths ) ;
}
2021-05-19 16:01:06 -07:00
// capture stdout, which contains analysis summaries
2021-06-09 13:17:25 -07:00
return await runTool ( cmd , codeqlArgs ) ;
2020-09-14 10:44:43 +01:00
} ,
2021-09-28 09:25:35 +01:00
async databasePrintBaseline ( databasePath ) {
const codeqlArgs = [
"database" ,
"print-baseline" ,
... getExtraOptionsFromEnv ( [ "database" , "print-baseline" ] ) ,
databasePath ,
] ;
return await runTool ( cmd , codeqlArgs ) ;
} ,
2021-06-04 10:18:24 -07:00
/**
* Download specified packs into the package cache. If the specified
* package and version already exists (e.g., from a previous analysis run),
* then it is not downloaded again (unless the extra option `--force` is
* specified).
*
* If no version is specified, then the latest version is
* downloaded. The check to determine what the latest version is is done
* each time this package is requested.
*/
2021-06-03 09:32:44 -07:00
async packDownload ( packs ) {
2021-06-09 13:17:25 -07:00
const codeqlArgs = [
2021-06-03 09:32:44 -07:00
"pack" ,
"download" ,
2021-06-04 13:44:24 -07:00
"--format=json" ,
2021-06-03 09:32:44 -07:00
... getExtraOptionsFromEnv ( [ "pack" , "download" ] ) ,
... packs . map ( packWithVersionToString ) ,
] ;
2021-06-09 13:17:25 -07:00
const output = await runTool ( cmd , codeqlArgs ) ;
2021-06-03 09:32:44 -07:00
try {
2021-06-07 16:05:32 -07:00
const parsedOutput = JSON . parse ( output ) ;
if ( Array . isArray ( parsedOutput . packs ) &&
2021-06-08 10:24:08 -07:00
// TODO PackDownloadOutput will not include the version if it is not specified
// in the input. The version is always the latest version available.
// It should be added to the output, but this requires a CLI change
parsedOutput . packs . every ( ( p ) => p . name /* && p.version */ ) ) {
2021-06-07 16:05:32 -07:00
return parsedOutput ;
}
else {
throw new Error ( "Unexpected output from pack download" ) ;
}
2021-06-03 09:32:44 -07:00
}
catch ( e ) {
2021-06-07 16:05:32 -07:00
throw new Error ( ` Attempted to download specified packs but got an error: \n ${ output } \n ${ e } ` ) ;
2021-06-03 09:32:44 -07:00
}
2020-09-14 10:44:43 +01:00
} ,
2021-05-24 17:26:13 +01:00
async databaseCleanup ( databasePath , cleanupLevel ) {
2021-06-09 13:17:25 -07:00
const codeqlArgs = [
2021-05-24 17:26:13 +01:00
"database" ,
"cleanup" ,
databasePath ,
` --mode= ${ cleanupLevel } ` ,
2022-01-21 13:44:52 +00:00
... getExtraOptionsFromEnv ( [ "database" , "cleanup" ] ) ,
2021-05-24 17:26:13 +01:00
] ;
2021-06-09 13:17:25 -07:00
await runTool ( cmd , codeqlArgs ) ;
2021-05-24 17:26:13 +01:00
} ,
2022-01-07 13:11:51 +00:00
async databaseBundle ( databasePath , outputFilePath , databaseName ) {
2021-06-22 13:05:12 +01:00
const args = [
"database" ,
"bundle" ,
databasePath ,
` --output= ${ outputFilePath } ` ,
2022-01-07 13:11:51 +00:00
` --name= ${ databaseName } ` ,
2022-01-21 13:44:52 +00:00
... getExtraOptionsFromEnv ( [ "database" , "bundle" ] ) ,
2021-06-22 13:05:12 +01:00
] ;
await new toolrunner . ToolRunner ( cmd , args ) . exec ( ) ;
} ,
2020-06-26 17:22:19 +01:00
} ;
2021-08-18 10:15:48 +01:00
if ( checkVersion &&
! ( await util . codeQlVersionAbove ( codeql , CODEQL _MINIMUM _VERSION ) ) ) {
throw new Error ( ` Expected a CodeQL CLI with version at least ${ CODEQL _MINIMUM _VERSION } but got version ${ await codeql . getVersion ( ) } ` ) ;
}
return codeql ;
2020-06-26 17:22:19 +01:00
}
2021-06-03 09:32:44 -07:00
function packWithVersionToString ( pack ) {
return pack . version ? ` ${ pack . packName } @ ${ pack . version } ` : pack . packName ;
}
2020-08-10 09:25:14 +02:00
/**
* Gets the options for `path` of `options` as an array of extra option strings.
*/
2020-11-19 23:03:45 +01:00
function getExtraOptionsFromEnv ( paths ) {
2020-09-14 10:44:43 +01:00
const options = util . getExtraOptionsEnvParam ( ) ;
2020-11-19 23:03:45 +01:00
return getExtraOptions ( options , paths , [ ] ) ;
}
/**
* Gets `options` as an array of extra option strings.
*
* - throws an exception mentioning `pathInfo` if this conversion is impossible.
*/
function asExtraOptions ( options , pathInfo ) {
if ( options === undefined ) {
return [ ] ;
}
if ( ! Array . isArray ( options ) ) {
const msg = ` The extra options for ' ${ pathInfo . join ( "." ) } ' (' ${ JSON . stringify ( options ) } ') are not in an array. ` ;
throw new Error ( msg ) ;
}
return options . map ( ( o ) => {
const t = typeof o ;
if ( t !== "string" && t !== "number" && t !== "boolean" ) {
const msg = ` The extra option for ' ${ pathInfo . join ( "." ) } ' (' ${ JSON . stringify ( o ) } ') is not a primitive value. ` ;
throw new Error ( msg ) ;
}
return ` ${ o } ` ;
} ) ;
2020-08-10 09:25:14 +02:00
}
/**
* Gets the options for `path` of `options` as an array of extra option strings.
*
* - the special terminal step name '*' in `options` matches all path steps
* - throws an exception if this conversion is impossible.
2020-09-23 20:25:45 +08:00
*
* Exported for testing.
2020-08-10 09:25:14 +02:00
*/
2020-11-19 23:03:45 +01:00
function getExtraOptions ( options , paths , pathInfo ) {
2021-07-27 17:59:59 +01:00
const all = asExtraOptions ( options === null || options === void 0 ? void 0 : options [ "*" ] , pathInfo . concat ( "*" ) ) ;
2020-11-19 23:03:45 +01:00
const specific = paths . length === 0
2020-09-14 10:44:43 +01:00
? asExtraOptions ( options , pathInfo )
2021-07-27 17:59:59 +01:00
: getExtraOptions ( options === null || options === void 0 ? void 0 : options [ paths [ 0 ] ] , paths === null || paths === void 0 ? void 0 : paths . slice ( 1 ) , pathInfo . concat ( paths [ 0 ] ) ) ;
2020-08-10 09:25:14 +02:00
return all . concat ( specific ) ;
}
exports . getExtraOptions = getExtraOptions ;
2021-06-24 17:30:42 +01:00
/*
* A constant defining the maximum number of characters we will keep from
* the programs stderr for logging. This serves two purposes:
* (1) It avoids an OOM if a program fails in a way that results it
* printing many log lines.
* (2) It avoids us hitting the limit of how much data we can send in our
* status reports on GitHub.com.
*/
const maxErrorSize = 20000 ;
2021-06-09 13:17:25 -07:00
async function runTool ( cmd , args = [ ] ) {
let output = "" ;
2021-06-24 17:30:42 +01:00
let error = "" ;
const exitCode = await new toolrunner . ToolRunner ( cmd , args , {
2021-06-09 13:17:25 -07:00
listeners : {
stdout : ( data ) => {
output += data . toString ( ) ;
} ,
2021-06-24 17:30:42 +01:00
stderr : ( data ) => {
const toRead = Math . min ( maxErrorSize - error . length , data . length ) ;
error += data . toString ( "utf8" , 0 , toRead ) ;
} ,
2021-06-09 13:17:25 -07:00
} ,
2021-06-24 17:30:42 +01:00
ignoreReturnCode : true ,
2021-06-09 13:17:25 -07:00
} ) . exec ( ) ;
2021-06-24 17:30:42 +01:00
if ( exitCode !== 0 )
throw new CommandInvocationError ( cmd , args , exitCode , error ) ;
2021-06-09 13:17:25 -07:00
return output ;
}
2020-06-26 17:22:19 +01:00
//# sourceMappingURL=codeql.js.map