diff --git a/node_modules/onetime/index.d.ts b/node_modules/onetime/index.d.ts
index ea84caba32..3c80803f99 100644
--- a/node_modules/onetime/index.d.ts
+++ b/node_modules/onetime/index.d.ts
@@ -1,12 +1,10 @@
-declare namespace onetime {
- interface Options {
- /**
- Throw an error when called more than once.
+export interface Options {
+ /**
+ Throw an error when called more than once.
- @default false
- */
- throw?: boolean;
- }
+ @default false
+ */
+ readonly throw?: boolean;
}
declare const onetime: {
@@ -18,11 +16,11 @@ declare const onetime: {
@example
```
- import onetime = require('onetime');
+ import onetime from 'onetime';
- let i = 0;
+ let index = 0;
- const foo = onetime(() => ++i);
+ const foo = onetime(() => ++index);
foo(); //=> 1
foo(); //=> 1
@@ -33,7 +31,7 @@ declare const onetime: {
*/
(
fn: (...arguments: ArgumentsType) => ReturnType,
- options?: onetime.Options
+ options?: Options
): (...arguments: ArgumentsType) => ReturnType;
/**
@@ -44,7 +42,7 @@ declare const onetime: {
@example
```
- import onetime = require('onetime');
+ import onetime from 'onetime';
const foo = onetime(() => {});
foo();
@@ -56,9 +54,6 @@ declare const onetime: {
```
*/
callCount(fn: (...arguments: any[]) => unknown): number;
-
- // TODO: Remove this for the next major release
- default: typeof onetime;
};
-export = onetime;
+export default onetime;
diff --git a/node_modules/onetime/index.js b/node_modules/onetime/index.js
index 99c5fc1cb4..eae4f33e4c 100644
--- a/node_modules/onetime/index.js
+++ b/node_modules/onetime/index.js
@@ -1,5 +1,4 @@
-'use strict';
-const mimicFn = require('mimic-fn');
+import mimicFunction from 'mimic-fn';
const calledFunctions = new WeakMap();
@@ -25,20 +24,18 @@ const onetime = (function_, options = {}) => {
return returnValue;
};
- mimicFn(onetime, function_);
+ mimicFunction(onetime, function_);
calledFunctions.set(onetime, callCount);
return onetime;
};
-module.exports = onetime;
-// TODO: Remove this for the next major release
-module.exports.default = onetime;
-
-module.exports.callCount = function_ => {
+onetime.callCount = function_ => {
if (!calledFunctions.has(function_)) {
throw new Error(`The given function \`${function_.name}\` is not wrapped by the \`onetime\` package`);
}
return calledFunctions.get(function_);
};
+
+export default onetime;
diff --git a/node_modules/onetime/package.json b/node_modules/onetime/package.json
index c4fe4e245d..367a963495 100644
--- a/node_modules/onetime/package.json
+++ b/node_modules/onetime/package.json
@@ -1,6 +1,6 @@
{
"name": "onetime",
- "version": "5.1.2",
+ "version": "6.0.0",
"description": "Ensure a function is only called once",
"license": "MIT",
"repository": "sindresorhus/onetime",
@@ -10,8 +10,10 @@
"email": "sindresorhus@gmail.com",
"url": "https://sindresorhus.com"
},
+ "type": "module",
+ "exports": "./index.js",
"engines": {
- "node": ">=6"
+ "node": ">=12"
},
"scripts": {
"test": "xo && ava && tsd"
@@ -33,11 +35,11 @@
"prevent"
],
"dependencies": {
- "mimic-fn": "^2.1.0"
+ "mimic-fn": "^4.0.0"
},
"devDependencies": {
- "ava": "^1.4.1",
- "tsd": "^0.7.1",
- "xo": "^0.24.0"
+ "ava": "^3.15.0",
+ "tsd": "^0.14.0",
+ "xo": "^0.38.2"
}
}
diff --git a/node_modules/onetime/readme.md b/node_modules/onetime/readme.md
index 2d133d3a09..e2b26fb3d3 100644
--- a/node_modules/onetime/readme.md
+++ b/node_modules/onetime/readme.md
@@ -1,4 +1,4 @@
-# onetime [](https://travis-ci.com/github/sindresorhus/onetime)
+# onetime
> Ensure a function is only called once
@@ -15,11 +15,11 @@ $ npm install onetime
## Usage
```js
-const onetime = require('onetime');
+import onetime from 'onetime';
-let i = 0;
+let index = 0;
-const foo = onetime(() => ++i);
+const foo = onetime(() => ++index);
foo(); //=> 1
foo(); //=> 1
@@ -29,7 +29,7 @@ onetime.callCount(foo); //=> 3
```
```js
-const onetime = require('onetime');
+import onetime from 'onetime';
const foo = onetime(() => {}, {throw: true});
@@ -69,7 +69,7 @@ Returns a number representing how many times `fn` has been called.
Note: It throws an error if you pass in a function that is not wrapped by `onetime`.
```js
-const onetime = require('onetime');
+import onetime from 'onetime';
const foo = onetime(() => {});
diff --git a/node_modules/strip-final-newline/index.js b/node_modules/strip-final-newline/index.js
index 78fc0c5939..034b56f865 100644
--- a/node_modules/strip-final-newline/index.js
+++ b/node_modules/strip-final-newline/index.js
@@ -1,16 +1,14 @@
-'use strict';
-
-module.exports = input => {
+export default function stripFinalNewline(input) {
const LF = typeof input === 'string' ? '\n' : '\n'.charCodeAt();
const CR = typeof input === 'string' ? '\r' : '\r'.charCodeAt();
if (input[input.length - 1] === LF) {
- input = input.slice(0, input.length - 1);
+ input = input.slice(0, -1);
}
if (input[input.length - 1] === CR) {
- input = input.slice(0, input.length - 1);
+ input = input.slice(0, -1);
}
return input;
-};
+}
diff --git a/node_modules/strip-final-newline/license b/node_modules/strip-final-newline/license
index e7af2f7710..fa7ceba3eb 100644
--- a/node_modules/strip-final-newline/license
+++ b/node_modules/strip-final-newline/license
@@ -1,6 +1,6 @@
MIT License
-Copyright (c) Sindre Sorhus (sindresorhus.com)
+Copyright (c) Sindre Sorhus (https://sindresorhus.com)
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
diff --git a/node_modules/strip-final-newline/package.json b/node_modules/strip-final-newline/package.json
index 40b7e802c9..23ac8622e4 100644
--- a/node_modules/strip-final-newline/package.json
+++ b/node_modules/strip-final-newline/package.json
@@ -1,16 +1,19 @@
{
"name": "strip-final-newline",
- "version": "2.0.0",
+ "version": "3.0.0",
"description": "Strip the final newline character from a string/buffer",
"license": "MIT",
"repository": "sindresorhus/strip-final-newline",
+ "funding": "https://github.com/sponsors/sindresorhus",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
- "url": "sindresorhus.com"
+ "url": "https://sindresorhus.com"
},
+ "type": "module",
+ "exports": "./index.js",
"engines": {
- "node": ">=6"
+ "node": ">=12"
},
"scripts": {
"test": "xo && ava"
@@ -34,7 +37,7 @@
"buffer"
],
"devDependencies": {
- "ava": "^0.25.0",
- "xo": "^0.23.0"
+ "ava": "^3.15.0",
+ "xo": "^0.39.1"
}
}
diff --git a/node_modules/strip-final-newline/readme.md b/node_modules/strip-final-newline/readme.md
index 32dfd50904..8d9090b64f 100644
--- a/node_modules/strip-final-newline/readme.md
+++ b/node_modules/strip-final-newline/readme.md
@@ -1,21 +1,19 @@
-# strip-final-newline [](https://travis-ci.com/sindresorhus/strip-final-newline)
+# strip-final-newline
> Strip the final [newline character](https://en.wikipedia.org/wiki/Newline) from a string/buffer
Can be useful when parsing the output of, for example, `ChildProcess#execFile`, as [binaries usually output a newline at the end](https://stackoverflow.com/questions/729692/why-should-text-files-end-with-a-newline). Normally, you would use `stdout.trim()`, but that would also remove newlines at the start and whitespace.
-
## Install
```
$ npm install strip-final-newline
```
-
## Usage
```js
-const stripFinalNewline = require('strip-final-newline');
+import stripFinalNewline from 'strip-final-newline';
stripFinalNewline('foo\nbar\n\n');
//=> 'foo\nbar\n'
@@ -24,7 +22,14 @@ stripFinalNewline(Buffer.from('foo\nbar\n\n')).toString();
//=> 'foo\nbar\n'
```
-
-## License
-
-MIT © [Sindre Sorhus](https://sindresorhus.com)
+---
+
+
diff --git a/package-lock.json b/package-lock.json
index 8b17aa9454..155ccffb64 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "codeql",
- "version": "2.2.6",
+ "version": "2.2.7",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "codeql",
- "version": "2.2.6",
+ "version": "2.2.7",
"license": "MIT",
"dependencies": {
"@actions/artifact": "^1.1.0",
@@ -40,7 +40,7 @@
"zlib": "^1.0.5"
},
"devDependencies": {
- "@ava/typescript": "3.0.1",
+ "@ava/typescript": "4.0.0",
"@types/adm-zip": "^0.5.0",
"@types/get-folder-size": "^2.0.0",
"@types/js-yaml": "^4.0.5",
@@ -201,16 +201,16 @@
}
},
"node_modules/@ava/typescript": {
- "version": "3.0.1",
- "resolved": "https://registry.npmjs.org/@ava/typescript/-/typescript-3.0.1.tgz",
- "integrity": "sha512-/JXIUuKsvkaneaiA9ckk3ksFTqvu0mDNlChASrTe2BnDsvMbhQdPWyqQjJ9WRJWVhhs5TWn1/0Pp1G6Rv8Syrw==",
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/@ava/typescript/-/typescript-4.0.0.tgz",
+ "integrity": "sha512-QFIPeqkEbdvn7Pob0wVeYpeZD0eXd8nDYdCl+knJVaIJrHdF2fXa58vFaig26cmYwnsEN0KRNTYJKbqW1B0lfg==",
"dev": true,
"dependencies": {
"escape-string-regexp": "^5.0.0",
- "execa": "^5.1.1"
+ "execa": "^7.1.0"
},
"engines": {
- "node": ">=12.22 <13 || >=14.17 <15 || >=16.4 <17 || >=17"
+ "node": ">=14.19 <15 || >=16.15 <17 || >=18"
}
},
"node_modules/@ava/typescript/node_modules/escape-string-regexp": {
@@ -3102,40 +3102,28 @@
}
},
"node_modules/execa": {
- "version": "5.1.1",
- "resolved": "https://registry.npmjs.org/execa/-/execa-5.1.1.tgz",
- "integrity": "sha512-8uSpZZocAZRBAPIEINJj3Lo9HyGitllczc27Eh5YYojjMFMn8yHMDMaUHE2Jqfq05D/wucwI4JGURyXt1vchyg==",
+ "version": "7.1.0",
+ "resolved": "https://registry.npmjs.org/execa/-/execa-7.1.0.tgz",
+ "integrity": "sha512-T6nIJO3LHxUZ6ahVRaxXz9WLEruXLqdcluA+UuTptXmLM7nDAn9lx9IfkxPyzEL21583qSt4RmL44pO71EHaJQ==",
"dev": true,
"dependencies": {
"cross-spawn": "^7.0.3",
- "get-stream": "^6.0.0",
- "human-signals": "^2.1.0",
- "is-stream": "^2.0.0",
+ "get-stream": "^6.0.1",
+ "human-signals": "^4.3.0",
+ "is-stream": "^3.0.0",
"merge-stream": "^2.0.0",
- "npm-run-path": "^4.0.1",
- "onetime": "^5.1.2",
- "signal-exit": "^3.0.3",
- "strip-final-newline": "^2.0.0"
+ "npm-run-path": "^5.1.0",
+ "onetime": "^6.0.0",
+ "signal-exit": "^3.0.7",
+ "strip-final-newline": "^3.0.0"
},
"engines": {
- "node": ">=10"
+ "node": "^14.18.0 || ^16.14.0 || >=18.0.0"
},
"funding": {
"url": "https://github.com/sindresorhus/execa?sponsor=1"
}
},
- "node_modules/execa/node_modules/get-stream": {
- "version": "6.0.1",
- "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-6.0.1.tgz",
- "integrity": "sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg==",
- "dev": true,
- "engines": {
- "node": ">=10"
- },
- "funding": {
- "url": "https://github.com/sponsors/sindresorhus"
- }
- },
"node_modules/fast-deep-equal": {
"version": "3.1.3",
"integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q=="
@@ -3387,6 +3375,18 @@
"url": "https://github.com/sponsors/ljharb"
}
},
+ "node_modules/get-stream": {
+ "version": "6.0.1",
+ "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-6.0.1.tgz",
+ "integrity": "sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg==",
+ "dev": true,
+ "engines": {
+ "node": ">=10"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
"node_modules/get-symbol-description": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/get-symbol-description/-/get-symbol-description-1.0.0.tgz",
@@ -3619,12 +3619,12 @@
}
},
"node_modules/human-signals": {
- "version": "2.1.0",
- "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-2.1.0.tgz",
- "integrity": "sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw==",
+ "version": "4.3.0",
+ "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-4.3.0.tgz",
+ "integrity": "sha512-zyzVyMjpGBX2+6cDVZeFPCdtOtdsxOeseRhB9tkQ6xXmGUNrcnBzdEKPy3VPNYz+4gy1oukVOXcrJCunSyc6QQ==",
"dev": true,
"engines": {
- "node": ">=10.17.0"
+ "node": ">=14.18.0"
}
},
"node_modules/ignore": {
@@ -3998,12 +3998,12 @@
}
},
"node_modules/is-stream": {
- "version": "2.0.1",
- "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.1.tgz",
- "integrity": "sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg==",
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-3.0.0.tgz",
+ "integrity": "sha512-LnQR4bZ9IADDRSkvpqMGvt/tEJWclzklNgSw48V5EAaAeDd6qGvN8ei6k5p0tvxSR171VmGyHuTiAOfxAbr8kA==",
"dev": true,
"engines": {
- "node": ">=8"
+ "node": "^12.20.0 || ^14.13.1 || >=16.0.0"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
@@ -4400,18 +4400,6 @@
"url": "https://github.com/sindresorhus/mem?sponsor=1"
}
},
- "node_modules/mem/node_modules/mimic-fn": {
- "version": "4.0.0",
- "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-4.0.0.tgz",
- "integrity": "sha512-vqiC06CuhBTUdZH+RYl8sFrL096vA45Ok5ISO6sE/Mr1jRbGH4Csnhi8f3wKVl7x8mO4Au7Ir9D3Oyv1VYMFJw==",
- "dev": true,
- "engines": {
- "node": ">=12"
- },
- "funding": {
- "url": "https://github.com/sponsors/sindresorhus"
- }
- },
"node_modules/merge-stream": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz",
@@ -4458,11 +4446,15 @@
}
},
"node_modules/mimic-fn": {
- "version": "2.1.0",
- "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==",
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-4.0.0.tgz",
+ "integrity": "sha512-vqiC06CuhBTUdZH+RYl8sFrL096vA45Ok5ISO6sE/Mr1jRbGH4Csnhi8f3wKVl7x8mO4Au7Ir9D3Oyv1VYMFJw==",
"dev": true,
"engines": {
- "node": ">=6"
+ "node": ">=12"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/minimatch": {
@@ -4599,15 +4591,30 @@
}
},
"node_modules/npm-run-path": {
- "version": "4.0.1",
- "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-4.0.1.tgz",
- "integrity": "sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw==",
+ "version": "5.1.0",
+ "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-5.1.0.tgz",
+ "integrity": "sha512-sJOdmRGrY2sjNTRMbSvluQqg+8X7ZK61yvzBEIDhz4f8z1TZFYABsqjjCBd/0PUNE9M6QDgHJXQkGUEm7Q+l9Q==",
"dev": true,
"dependencies": {
- "path-key": "^3.0.0"
+ "path-key": "^4.0.0"
},
"engines": {
- "node": ">=8"
+ "node": "^12.20.0 || ^14.13.1 || >=16.0.0"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/npm-run-path/node_modules/path-key": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/path-key/-/path-key-4.0.0.tgz",
+ "integrity": "sha512-haREypq7xkM7ErfgIyA0z+Bj4AGKlMSdlQE2jvJo6huWD1EdkKYV+G/T4nq0YEF2vgTT8kqMFKo1uHn950r4SQ==",
+ "dev": true,
+ "engines": {
+ "node": ">=12"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/object-inspect": {
@@ -4718,15 +4725,15 @@
}
},
"node_modules/onetime": {
- "version": "5.1.2",
- "resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.2.tgz",
- "integrity": "sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==",
+ "version": "6.0.0",
+ "resolved": "https://registry.npmjs.org/onetime/-/onetime-6.0.0.tgz",
+ "integrity": "sha512-1FlR+gjXK7X+AsAHso35MnyN5KqGwJRi/31ft6x0M194ht7S+rWAvd7PHss9xSKMzE0asv1pyIHaJYq+BbacAQ==",
"dev": true,
"dependencies": {
- "mimic-fn": "^2.1.0"
+ "mimic-fn": "^4.0.0"
},
"engines": {
- "node": ">=6"
+ "node": ">=12"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
@@ -5563,12 +5570,15 @@
}
},
"node_modules/strip-final-newline": {
- "version": "2.0.0",
- "resolved": "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-2.0.0.tgz",
- "integrity": "sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA==",
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-3.0.0.tgz",
+ "integrity": "sha512-dOESqjYr96iWYylGObzd39EuNTa5VJxyvVAEm5Jnh7KGo75V43Hk1odPQkNDyXNmUR6k+gEiDVXnjB8HJ3crXw==",
"dev": true,
"engines": {
- "node": ">=6"
+ "node": ">=12"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/strip-json-comments": {
diff --git a/package.json b/package.json
index 067b79bcf4..7465804922 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "codeql",
- "version": "2.2.6",
+ "version": "2.2.7",
"private": true,
"description": "CodeQL action",
"scripts": {
@@ -55,7 +55,7 @@
"micromatch is an unspecified dependency of ava"
],
"devDependencies": {
- "@ava/typescript": "3.0.1",
+ "@ava/typescript": "4.0.0",
"@types/adm-zip": "^0.5.0",
"@types/get-folder-size": "^2.0.0",
"@types/js-yaml": "^4.0.5",
diff --git a/pr-checks/checks/analyze-ref-input.yml b/pr-checks/checks/analyze-ref-input.yml
index 7948c3d5da..5baf088816 100644
--- a/pr-checks/checks/analyze-ref-input.yml
+++ b/pr-checks/checks/analyze-ref-input.yml
@@ -11,5 +11,6 @@ steps:
run: ./build.sh
- uses: ./../action/analyze
with:
+ upload-database: false
ref: 'refs/heads/main'
sha: '5e235361806c361d4d3f8859e3c897658025a9a2'
diff --git a/pr-checks/checks/autobuild-action.yml b/pr-checks/checks/autobuild-action.yml
index c219e41fe3..aa3cbdcca6 100644
--- a/pr-checks/checks/autobuild-action.yml
+++ b/pr-checks/checks/autobuild-action.yml
@@ -16,6 +16,8 @@ steps:
CORECLR_PROFILER: ""
CORECLR_PROFILER_PATH_64: ""
- uses: ./../action/analyze
+ with:
+ upload-database: false
- name: Check database
shell: bash
run: |
diff --git a/pr-checks/checks/config-export.yml b/pr-checks/checks/config-export.yml
new file mode 100644
index 0000000000..90bd1a38e9
--- /dev/null
+++ b/pr-checks/checks/config-export.yml
@@ -0,0 +1,49 @@
+name: "Config export"
+description: "Tests that the code scanning configuration file is exported to SARIF correctly."
+versions: ["latest"]
+env:
+ CODEQL_ACTION_EXPORT_CODE_SCANNING_CONFIG: true
+ CODEQL_PASS_CONFIG_TO_CLI: true
+steps:
+ - uses: ./../action/init
+ with:
+ languages: javascript
+ queries: security-extended
+ tools: ${{ steps.prepare-test.outputs.tools-url }}
+ - uses: ./../action/analyze
+ with:
+ output: "${{ runner.temp }}/results"
+ upload-database: false
+ - name: Upload SARIF
+ uses: actions/upload-artifact@v3
+ with:
+ name: config-export-${{ matrix.os }}-${{ matrix.version }}.sarif.json
+ path: "${{ runner.temp }}/results/javascript.sarif"
+ retention-days: 7
+ - name: Check config properties appear in SARIF
+ uses: actions/github-script@v6
+ env:
+ SARIF_PATH: "${{ runner.temp }}/results/javascript.sarif"
+ with:
+ script: |
+ const fs = require('fs');
+ const path = require('path');
+
+ const sarif = JSON.parse(fs.readFileSync(process.env['SARIF_PATH'], 'utf8'));
+ const run = sarif.runs[0];
+ const configSummary = run.properties.codeqlConfigSummary;
+
+ if (configSummary === undefined) {
+ core.setFailed('`codeqlConfigSummary` property not found in the SARIF run property bag.');
+ }
+ if (configSummary.disableDefaultQueries !== false) {
+ core.setFailed('`disableDefaultQueries` property incorrect: expected false, got ' +
+ `${JSON.stringify(configSummary.disableDefaultQueries)}.`);
+ }
+ const expectedQueries = [{ type: 'builtinSuite', uses: 'security-extended' }];
+ // Use JSON.stringify to deep-equal the arrays.
+ if (JSON.stringify(configSummary.queries) !== JSON.stringify(expectedQueries)) {
+ core.setFailed(`\`queries\` property incorrect: expected ${JSON.stringify(expectedQueries)}, got ` +
+ `${JSON.stringify(configSummary.queries)}.`);
+ }
+ core.info('Finished config export tests.');
diff --git a/pr-checks/checks/go-custom-queries.yml b/pr-checks/checks/go-custom-queries.yml
index 518c51a9f1..4d15805971 100644
--- a/pr-checks/checks/go-custom-queries.yml
+++ b/pr-checks/checks/go-custom-queries.yml
@@ -1,6 +1,6 @@
name: "Go: Custom queries"
description: "Checks that Go works in conjunction with a config file specifying custom queries"
-env:
+env:
DOTNET_GENERATE_ASPNET_CERTIFICATE: "false"
steps:
- uses: ./../action/init
@@ -12,3 +12,5 @@ steps:
shell: bash
run: ./build.sh
- uses: ./../action/analyze
+ with:
+ upload-database: false
diff --git a/pr-checks/checks/go-tracing-autobuilder.yml b/pr-checks/checks/go-tracing-autobuilder.yml
index 4c01f02d62..87fe3120eb 100644
--- a/pr-checks/checks/go-tracing-autobuilder.yml
+++ b/pr-checks/checks/go-tracing-autobuilder.yml
@@ -10,6 +10,8 @@ steps:
tools: ${{ steps.prepare-test.outputs.tools-url }}
- uses: ./../action/autobuild
- uses: ./../action/analyze
+ with:
+ upload-database: false
- shell: bash
run: |
if [[ "${CODEQL_ACTION_DID_AUTOBUILD_GOLANG}" != true ]]; then
diff --git a/pr-checks/checks/go-tracing-custom-build-steps.yml b/pr-checks/checks/go-tracing-custom-build-steps.yml
index 1490717694..bc6ce396ab 100644
--- a/pr-checks/checks/go-tracing-custom-build-steps.yml
+++ b/pr-checks/checks/go-tracing-custom-build-steps.yml
@@ -10,6 +10,8 @@ steps:
shell: bash
run: go build main.go
- uses: ./../action/analyze
+ with:
+ upload-database: false
- shell: bash
run: |
# Once we start running Bash 4.2 in all environments, we can replace the
diff --git a/pr-checks/checks/go-tracing-legacy-workflow.yml b/pr-checks/checks/go-tracing-legacy-workflow.yml
index 010d425f55..e6f91d0802 100644
--- a/pr-checks/checks/go-tracing-legacy-workflow.yml
+++ b/pr-checks/checks/go-tracing-legacy-workflow.yml
@@ -9,6 +9,8 @@ steps:
languages: go
tools: ${{ steps.prepare-test.outputs.tools-url }}
- uses: ./../action/analyze
+ with:
+ upload-database: false
- shell: bash
run: |
cd "$RUNNER_TEMP/codeql_databases"
diff --git a/pr-checks/checks/javascript-source-root.yml b/pr-checks/checks/javascript-source-root.yml
index ed85a604d1..bf97e098d4 100644
--- a/pr-checks/checks/javascript-source-root.yml
+++ b/pr-checks/checks/javascript-source-root.yml
@@ -15,6 +15,7 @@ steps:
tools: ${{ steps.prepare-test.outputs.tools-url }}
- uses: ./../action/analyze
with:
+ upload-database: false
skip-queries: true
upload: false
- name: Assert database exists
diff --git a/pr-checks/checks/multi-language-autodetect.yml b/pr-checks/checks/multi-language-autodetect.yml
index 9b9b5336c5..73d520799a 100644
--- a/pr-checks/checks/multi-language-autodetect.yml
+++ b/pr-checks/checks/multi-language-autodetect.yml
@@ -9,7 +9,7 @@ steps:
with:
db-location: "${{ runner.temp }}/customDbLocation"
tools: ${{ steps.prepare-test.outputs.tools-url }}
-
+
- uses: ./../action/.github/setup-swift
with:
codeql-path: ${{steps.init.outputs.codeql-path}}
@@ -20,6 +20,8 @@ steps:
- uses: ./../action/analyze
id: analysis
+ with:
+ upload-database: false
- name: Check language autodetect for all languages excluding Ruby, Swift
shell: bash
diff --git a/pr-checks/checks/packaging-codescanning-config-inputs-js.yml b/pr-checks/checks/packaging-codescanning-config-inputs-js.yml
index 94f42cb7b5..6444593122 100644
--- a/pr-checks/checks/packaging-codescanning-config-inputs-js.yml
+++ b/pr-checks/checks/packaging-codescanning-config-inputs-js.yml
@@ -18,6 +18,7 @@ steps:
- uses: ./../action/analyze
with:
output: "${{ runner.temp }}/results"
+ upload-database: false
- name: Check results
uses: ./../action/.github/check-sarif
diff --git a/pr-checks/checks/packaging-config-inputs-js.yml b/pr-checks/checks/packaging-config-inputs-js.yml
index 56d9344ec3..d942dceaf4 100644
--- a/pr-checks/checks/packaging-config-inputs-js.yml
+++ b/pr-checks/checks/packaging-config-inputs-js.yml
@@ -14,6 +14,7 @@ steps:
- uses: ./../action/analyze
with:
output: "${{ runner.temp }}/results"
+ upload-database: false
- name: Check results
uses: ./../action/.github/check-sarif
diff --git a/pr-checks/checks/packaging-config-js.yml b/pr-checks/checks/packaging-config-js.yml
index 40334228bc..1d39ba8ca4 100644
--- a/pr-checks/checks/packaging-config-js.yml
+++ b/pr-checks/checks/packaging-config-js.yml
@@ -13,6 +13,7 @@ steps:
- uses: ./../action/analyze
with:
output: "${{ runner.temp }}/results"
+ upload-database: false
- name: Check results
uses: ./../action/.github/check-sarif
diff --git a/pr-checks/checks/ruby.yml b/pr-checks/checks/ruby.yml
index 3b4279aa66..53891a71af 100644
--- a/pr-checks/checks/ruby.yml
+++ b/pr-checks/checks/ruby.yml
@@ -9,6 +9,8 @@ steps:
tools: ${{ steps.prepare-test.outputs.tools-url }}
- uses: ./../action/analyze
id: analysis
+ with:
+ upload-database: false
- name: Check database
shell: bash
run: |
diff --git a/pr-checks/checks/split-workflow.yml b/pr-checks/checks/split-workflow.yml
index 6e802c22fb..529d885fd5 100644
--- a/pr-checks/checks/split-workflow.yml
+++ b/pr-checks/checks/split-workflow.yml
@@ -16,6 +16,7 @@ steps:
with:
skip-queries: true
output: "${{ runner.temp }}/results"
+ upload-database: false
- name: Assert No Results
shell: bash
diff --git a/pr-checks/checks/swift-autobuild.yml b/pr-checks/checks/swift-autobuild.yml
index 30faa0558c..dd48197700 100644
--- a/pr-checks/checks/swift-autobuild.yml
+++ b/pr-checks/checks/swift-autobuild.yml
@@ -21,6 +21,8 @@ steps:
timeout-minutes: 10
- uses: ./../action/analyze
id: analysis
+ with:
+ upload-database: false
- name: Check database
shell: bash
run: |
diff --git a/pr-checks/checks/swift-custom-build.yml b/pr-checks/checks/swift-custom-build.yml
index b704e33584..1fc1dd5f34 100644
--- a/pr-checks/checks/swift-custom-build.yml
+++ b/pr-checks/checks/swift-custom-build.yml
@@ -22,6 +22,8 @@ steps:
run: ./build.sh
- uses: ./../action/analyze
id: analysis
+ with:
+ upload-database: false
- name: Check database
shell: bash
run: |
diff --git a/pr-checks/checks/test-autobuild-working-dir.yml b/pr-checks/checks/test-autobuild-working-dir.yml
index 3d3a8b8406..56338ee325 100644
--- a/pr-checks/checks/test-autobuild-working-dir.yml
+++ b/pr-checks/checks/test-autobuild-working-dir.yml
@@ -18,6 +18,8 @@ steps:
with:
working-directory: autobuild-dir
- uses: ./../action/analyze
+ with:
+ upload-database: false
- name: Check database
shell: bash
run: |
diff --git a/pr-checks/checks/test-local-codeql.yml b/pr-checks/checks/test-local-codeql.yml
index 3a7edc9813..b999897bbd 100644
--- a/pr-checks/checks/test-local-codeql.yml
+++ b/pr-checks/checks/test-local-codeql.yml
@@ -16,3 +16,5 @@ steps:
shell: bash
run: ./build.sh
- uses: ./../action/analyze
+ with:
+ upload-database: false
diff --git a/pr-checks/checks/test-proxy.yml b/pr-checks/checks/test-proxy.yml
index fd0d4f98bf..33955004e7 100644
--- a/pr-checks/checks/test-proxy.yml
+++ b/pr-checks/checks/test-proxy.yml
@@ -18,3 +18,5 @@ steps:
languages: javascript
tools: ${{ steps.prepare-test.outputs.tools-url }}
- uses: ./../action/analyze
+ with:
+ upload-database: false
diff --git a/pr-checks/checks/unset-environment.yml b/pr-checks/checks/unset-environment.yml
index 6e36c07863..965afcfd2e 100644
--- a/pr-checks/checks/unset-environment.yml
+++ b/pr-checks/checks/unset-environment.yml
@@ -13,6 +13,8 @@ steps:
run: env -i CODEQL_EXTRACTOR_JAVA_AGENT_DISABLE_KOTLIN=true PATH="$PATH" HOME="$HOME" ./build.sh
- uses: ./../action/analyze
id: analysis
+ with:
+ upload-database: false
- shell: bash
run: |
CPP_DB="${{ fromJson(steps.analysis.outputs.db-locations).cpp }}"
diff --git a/pr-checks/checks/upload-ref-sha-input.yml b/pr-checks/checks/upload-ref-sha-input.yml
index 2f8fe2ad32..452424cf2e 100644
--- a/pr-checks/checks/upload-ref-sha-input.yml
+++ b/pr-checks/checks/upload-ref-sha-input.yml
@@ -11,6 +11,7 @@ steps:
run: ./build.sh
- uses: ./../action/analyze
with:
+ upload-database: false
ref: 'refs/heads/main'
sha: '5e235361806c361d4d3f8859e3c897658025a9a2'
upload: false
diff --git a/pr-checks/checks/with-checkout-path.yml b/pr-checks/checks/with-checkout-path.yml
index 23805b3b7e..f302423e48 100644
--- a/pr-checks/checks/with-checkout-path.yml
+++ b/pr-checks/checks/with-checkout-path.yml
@@ -30,6 +30,7 @@ steps:
ref: v1.1.0
sha: 474bbf07f9247ffe1856c6a0f94aeeb10e7afee6
upload: false
+ upload-database: false
- uses: ./../action/upload-sarif
with:
diff --git a/src/analyze.ts b/src/analyze.ts
index f95a0fd69b..5bebe6a4e3 100644
--- a/src/analyze.ts
+++ b/src/analyze.ts
@@ -207,14 +207,14 @@ export async function runQueries(
automationDetailsId: string | undefined,
config: configUtils.Config,
logger: Logger,
- featureEnablement: FeatureEnablement
+ features: FeatureEnablement
): Promise {
const statusReport: QueriesStatusReport = {};
const codeql = await getCodeQL(config.codeQLCmd);
const queryFlags = [memoryFlag, threadsFlag];
- await util.logCodeScanningConfigInCli(codeql, featureEnablement, logger);
+ await util.logCodeScanningConfigInCli(codeql, features, logger);
for (const language of config.languages) {
const queries = config.queries[language];
@@ -224,7 +224,7 @@ export async function runQueries(
const packsWithVersion = config.packs[language] || [];
try {
- if (await util.useCodeScanningConfigInCli(codeql, featureEnablement)) {
+ if (await util.useCodeScanningConfigInCli(codeql, features)) {
// If we are using the code scanning config in the CLI,
// much of the work needed to generate the query suites
// is done in the CLI. We just need to make a single
@@ -367,7 +367,9 @@ export async function runQueries(
addSnippetsFlag,
threadsFlag,
enableDebugLogging ? "-vv" : "-v",
- automationDetailsId
+ automationDetailsId,
+ config,
+ features
);
}
diff --git a/src/codeql.test.ts b/src/codeql.test.ts
index 6e68c69f3b..ba3fddb629 100644
--- a/src/codeql.test.ts
+++ b/src/codeql.test.ts
@@ -628,7 +628,17 @@ test("databaseInterpretResults() does not set --sarif-add-query-help for 2.7.0",
sinon.stub(codeqlObject, "getVersion").resolves("2.7.0");
// safeWhich throws because of the test CodeQL object.
sinon.stub(safeWhich, "safeWhich").resolves("");
- await codeqlObject.databaseInterpretResults("", [], "", "", "", "-v", "");
+ await codeqlObject.databaseInterpretResults(
+ "",
+ [],
+ "",
+ "",
+ "",
+ "-v",
+ "",
+ stubConfig,
+ createFeatures([])
+ );
t.false(
runnerConstructorStub.firstCall.args[1].includes("--sarif-add-query-help"),
"--sarif-add-query-help should be absent, but it is present"
@@ -641,7 +651,17 @@ test("databaseInterpretResults() sets --sarif-add-query-help for 2.7.1", async (
sinon.stub(codeqlObject, "getVersion").resolves("2.7.1");
// safeWhich throws because of the test CodeQL object.
sinon.stub(safeWhich, "safeWhich").resolves("");
- await codeqlObject.databaseInterpretResults("", [], "", "", "", "-v", "");
+ await codeqlObject.databaseInterpretResults(
+ "",
+ [],
+ "",
+ "",
+ "",
+ "-v",
+ "",
+ stubConfig,
+ createFeatures([])
+ );
t.true(
runnerConstructorStub.firstCall.args[1].includes("--sarif-add-query-help"),
"--sarif-add-query-help should be present, but it is absent"
@@ -1129,7 +1149,17 @@ test("databaseInterpretResults() sets --sarif-add-baseline-file-info for 2.11.3"
sinon.stub(codeqlObject, "getVersion").resolves("2.11.3");
// safeWhich throws because of the test CodeQL object.
sinon.stub(safeWhich, "safeWhich").resolves("");
- await codeqlObject.databaseInterpretResults("", [], "", "", "", "-v", "");
+ await codeqlObject.databaseInterpretResults(
+ "",
+ [],
+ "",
+ "",
+ "",
+ "-v",
+ "",
+ stubConfig,
+ createFeatures([])
+ );
t.true(
runnerConstructorStub.firstCall.args[1].includes(
"--sarif-add-baseline-file-info"
@@ -1144,7 +1174,17 @@ test("databaseInterpretResults() does not set --sarif-add-baseline-file-info for
sinon.stub(codeqlObject, "getVersion").resolves("2.11.2");
// safeWhich throws because of the test CodeQL object.
sinon.stub(safeWhich, "safeWhich").resolves("");
- await codeqlObject.databaseInterpretResults("", [], "", "", "", "-v", "");
+ await codeqlObject.databaseInterpretResults(
+ "",
+ [],
+ "",
+ "",
+ "",
+ "-v",
+ "",
+ stubConfig,
+ createFeatures([])
+ );
t.false(
runnerConstructorStub.firstCall.args[1].includes(
"--sarif-add-baseline-file-info"
diff --git a/src/codeql.ts b/src/codeql.ts
index bf7afabebd..9c970793f6 100644
--- a/src/codeql.ts
+++ b/src/codeql.ts
@@ -6,9 +6,13 @@ import * as yaml from "js-yaml";
import { getOptionalInput } from "./actions-util";
import * as api from "./api-client";
-import { Config } from "./config-utils";
+import { Config, getGeneratedCodeScanningConfigPath } from "./config-utils";
import { errorMatchers } from "./error-matcher";
-import { CodeQLDefaultVersionInfo, FeatureEnablement } from "./feature-flags";
+import {
+ CodeQLDefaultVersionInfo,
+ Feature,
+ FeatureEnablement,
+} from "./feature-flags";
import { ToolsSource } from "./init";
import { isTracedLanguage, Language } from "./languages";
import { Logger } from "./logging";
@@ -90,7 +94,7 @@ export interface CodeQL {
config: Config,
sourceRoot: string,
processName: string | undefined,
- featureEnablement: FeatureEnablement,
+ features: FeatureEnablement,
qlconfigFile: string | undefined,
logger: Logger
): Promise;
@@ -173,7 +177,9 @@ export interface CodeQL {
addSnippetsFlag: string,
threadsFlag: string,
verbosityFlag: string | undefined,
- automationDetailsId: string | undefined
+ automationDetailsId: string | undefined,
+ config: Config,
+ features: FeatureEnablement
): Promise;
/**
* Run 'codeql database print-baseline'.
@@ -184,7 +190,9 @@ export interface CodeQL {
*/
diagnosticsExport(
sarifFile: string,
- automationDetailsId: string | undefined
+ automationDetailsId: string | undefined,
+ config: Config,
+ features: FeatureEnablement
): Promise;
}
@@ -570,7 +578,7 @@ export async function getCodeQLForCmd(
config: Config,
sourceRoot: string,
processName: string | undefined,
- featureEnablement: FeatureEnablement,
+ features: FeatureEnablement,
qlconfigFile: string | undefined,
logger: Logger
) {
@@ -605,7 +613,7 @@ export async function getCodeQLForCmd(
const codeScanningConfigFile = await generateCodeScanningConfig(
codeql,
config,
- featureEnablement,
+ features,
logger
);
// Only pass external repository token if a config file is going to be parsed by the CLI.
@@ -841,7 +849,9 @@ export async function getCodeQLForCmd(
addSnippetsFlag: string,
threadsFlag: string,
verbosityFlag: string,
- automationDetailsId: string | undefined
+ automationDetailsId: string | undefined,
+ config: Config,
+ features: FeatureEnablement
): Promise {
const codeqlArgs = [
"database",
@@ -854,6 +864,7 @@ export async function getCodeQLForCmd(
"--print-diagnostics-summary",
"--print-metrics-summary",
"--sarif-group-rules-by-pack",
+ ...(await getCodeScanningConfigExportArguments(config, this, features)),
...getExtraOptionsFromEnv(["database", "interpret-results"]),
];
if (await util.codeQlVersionAbove(this, CODEQL_VERSION_CUSTOM_QUERY_HELP))
@@ -973,13 +984,16 @@ export async function getCodeQLForCmd(
},
async diagnosticsExport(
sarifFile: string,
- automationDetailsId: string | undefined
+ automationDetailsId: string | undefined,
+ config: Config,
+ features: FeatureEnablement
): Promise {
const args = [
"diagnostics",
"export",
"--format=sarif-latest",
`--output=${sarifFile}`,
+ ...(await getCodeScanningConfigExportArguments(config, this, features)),
...getExtraOptionsFromEnv(["diagnostics", "export"]),
];
if (automationDetailsId !== undefined) {
@@ -1118,16 +1132,14 @@ async function runTool(
async function generateCodeScanningConfig(
codeql: CodeQL,
config: Config,
- featureEnablement: FeatureEnablement,
+ features: FeatureEnablement,
logger: Logger
): Promise {
- if (!(await util.useCodeScanningConfigInCli(codeql, featureEnablement))) {
+ if (!(await util.useCodeScanningConfigInCli(codeql, features))) {
return;
}
- const codeScanningConfigFile = path.resolve(
- config.tempDir,
- "user-config.yaml"
- );
+ const codeScanningConfigFile = getGeneratedCodeScanningConfigPath(config);
+
// make a copy so we can modify it
const augmentedConfig = cloneObject(config.originalUserInput);
@@ -1198,3 +1210,24 @@ async function generateCodeScanningConfig(
function cloneObject(obj: T): T {
return JSON.parse(JSON.stringify(obj));
}
+
+/**
+ * Gets arguments for passing the code scanning configuration file to interpretation commands like
+ * `codeql database interpret-results` and `codeql database export-diagnostics`.
+ *
+ * Returns an empty list if a code scanning configuration file was not generated by the CLI.
+ */
+async function getCodeScanningConfigExportArguments(
+ config: Config,
+ codeql: CodeQL,
+ features: FeatureEnablement
+): Promise {
+ const codeScanningConfigPath = getGeneratedCodeScanningConfigPath(config);
+ if (
+ fs.existsSync(codeScanningConfigPath) &&
+ (await features.getValue(Feature.ExportCodeScanningConfigEnabled, codeql))
+ ) {
+ return ["--sarif-codescanning-config", codeScanningConfigPath];
+ }
+ return [];
+}
diff --git a/src/config-utils.ts b/src/config-utils.ts
index 5910efce4c..6a38deb0bd 100644
--- a/src/config-utils.ts
+++ b/src/config-utils.ts
@@ -398,7 +398,7 @@ async function addBuiltinSuiteQueries(
resultMap: Queries,
packs: Packs,
suiteName: string,
- featureEnablement: FeatureEnablement,
+ features: FeatureEnablement,
configFile?: string
): Promise {
let injectedMlQueries = false;
@@ -435,7 +435,7 @@ async function addBuiltinSuiteQueries(
found === "security-extended" ||
found === "security-and-quality") &&
!packs.javascript?.some(isMlPoweredJsQueriesPack) &&
- (await featureEnablement.getValue(Feature.MlPoweredQueriesEnabled, codeQL))
+ (await features.getValue(Feature.MlPoweredQueriesEnabled, codeQL))
) {
if (!packs.javascript) {
packs.javascript = [];
@@ -567,7 +567,7 @@ async function parseQueryUses(
tempDir: string,
workspacePath: string,
apiDetails: api.GitHubApiExternalRepoDetails,
- featureEnablement: FeatureEnablement,
+ features: FeatureEnablement,
logger: Logger,
configFile?: string
): Promise {
@@ -596,7 +596,7 @@ async function parseQueryUses(
resultMap,
packs,
queryUses,
- featureEnablement,
+ features,
configFile
);
}
@@ -604,7 +604,7 @@ async function parseQueryUses(
// Otherwise, must be a reference to another repo.
// If config parsing is handled in CLI, then this repo will be downloaded
// later by the CLI.
- if (!(await useCodeScanningConfigInCli(codeQL, featureEnablement))) {
+ if (!(await useCodeScanningConfigInCli(codeQL, features))) {
await addRemoteQueries(
codeQL,
resultMap,
@@ -1011,7 +1011,7 @@ async function addQueriesAndPacksFromWorkflow(
tempDir: string,
workspacePath: string,
apiDetails: api.GitHubApiExternalRepoDetails,
- featureEnablement: FeatureEnablement,
+ features: FeatureEnablement,
logger: Logger
): Promise {
let injectedMlQueries = false;
@@ -1029,7 +1029,7 @@ async function addQueriesAndPacksFromWorkflow(
tempDir,
workspacePath,
apiDetails,
- featureEnablement,
+ features,
logger
);
injectedMlQueries = injectedMlQueries || didInject;
@@ -1068,7 +1068,7 @@ export async function getDefaultConfig(
workspacePath: string,
gitHubVersion: GitHubVersion,
apiDetails: api.GitHubApiCombinedDetails,
- featureEnablement: FeatureEnablement,
+ features: FeatureEnablement,
logger: Logger
): Promise {
const languages = await getLanguages(
@@ -1106,7 +1106,7 @@ export async function getDefaultConfig(
tempDir,
workspacePath,
apiDetails,
- featureEnablement,
+ features,
logger
);
}
@@ -1176,7 +1176,7 @@ async function loadConfig(
workspacePath: string,
gitHubVersion: GitHubVersion,
apiDetails: api.GitHubApiCombinedDetails,
- featureEnablement: FeatureEnablement,
+ features: FeatureEnablement,
logger: Logger
): Promise {
let parsedYAML: UserConfig;
@@ -1256,7 +1256,7 @@ async function loadConfig(
tempDir,
workspacePath,
apiDetails,
- featureEnablement,
+ features,
logger
);
}
@@ -1281,7 +1281,7 @@ async function loadConfig(
tempDir,
workspacePath,
apiDetails,
- featureEnablement,
+ features,
logger,
configFile
);
@@ -1700,7 +1700,7 @@ export async function initConfig(
workspacePath: string,
gitHubVersion: GitHubVersion,
apiDetails: api.GitHubApiCombinedDetails,
- featureEnablement: FeatureEnablement,
+ features: FeatureEnablement,
logger: Logger
): Promise {
let config: Config;
@@ -1723,7 +1723,7 @@ export async function initConfig(
workspacePath,
gitHubVersion,
apiDetails,
- featureEnablement,
+ features,
logger
);
} else {
@@ -1743,7 +1743,7 @@ export async function initConfig(
workspacePath,
gitHubVersion,
apiDetails,
- featureEnablement,
+ features,
logger
);
}
@@ -1751,9 +1751,9 @@ 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, featureEnablement, logger);
+ await logCodeScanningConfigInCli(codeQL, features, logger);
- if (!(await useCodeScanningConfigInCli(codeQL, featureEnablement))) {
+ if (!(await useCodeScanningConfigInCli(codeQL, features))) {
// The list of queries should not be empty for any language. If it is then
// it is a user configuration error.
// This check occurs in the CLI when it parses the config file.
@@ -2066,3 +2066,12 @@ export async function wrapEnvironment(
}
}
}
+
+/**
+ * Get the path to the code scanning configuration generated by the CLI.
+ *
+ * This will not exist if the configuration is being parsed in the Action.
+ */
+export function getGeneratedCodeScanningConfigPath(config: Config): string {
+ return path.resolve(config.tempDir, "user-config.yaml");
+}
diff --git a/src/feature-flags.test.ts b/src/feature-flags.test.ts
index f95fba32c4..779bd9b348 100644
--- a/src/feature-flags.test.ts
+++ b/src/feature-flags.test.ts
@@ -47,7 +47,7 @@ for (const variant of ALL_FEATURES_DISABLED_VARIANTS) {
test(`All features are disabled if running against ${variant.description}`, async (t) => {
await withTmpDir(async (tmpDir) => {
const loggedMessages = [];
- const featureEnablement = setUpFeatureFlagTests(
+ const features = setUpFeatureFlagTests(
tmpDir,
getRecordingLogger(loggedMessages),
variant.gitHubVersion
@@ -55,10 +55,7 @@ for (const variant of ALL_FEATURES_DISABLED_VARIANTS) {
for (const feature of Object.values(Feature)) {
t.deepEqual(
- await featureEnablement.getValue(
- feature,
- includeCodeQlIfRequired(feature)
- ),
+ await features.getValue(feature, includeCodeQlIfRequired(feature)),
featureConfig[feature].defaultValue
);
}
@@ -78,7 +75,7 @@ for (const variant of ALL_FEATURES_DISABLED_VARIANTS) {
test("API response missing and features use default value", async (t) => {
await withTmpDir(async (tmpDir) => {
const loggedMessages: LoggedMessage[] = [];
- const featureEnablement = setUpFeatureFlagTests(
+ const features = setUpFeatureFlagTests(
tmpDir,
getRecordingLogger(loggedMessages)
);
@@ -87,10 +84,8 @@ test("API response missing and features use default value", async (t) => {
for (const feature of Object.values(Feature)) {
t.assert(
- (await featureEnablement.getValue(
- feature,
- includeCodeQlIfRequired(feature)
- )) === featureConfig[feature].defaultValue
+ (await features.getValue(feature, includeCodeQlIfRequired(feature))) ===
+ featureConfig[feature].defaultValue
);
}
assertAllFeaturesUndefinedInApi(t, loggedMessages);
@@ -100,7 +95,7 @@ test("API response missing and features use default value", async (t) => {
test("Features use default value if they're not returned in API response", async (t) => {
await withTmpDir(async (tmpDir) => {
const loggedMessages: LoggedMessage[] = [];
- const featureEnablement = setUpFeatureFlagTests(
+ const features = setUpFeatureFlagTests(
tmpDir,
getRecordingLogger(loggedMessages)
);
@@ -109,10 +104,8 @@ test("Features use default value if they're not returned in API response", async
for (const feature of Object.values(Feature)) {
t.assert(
- (await featureEnablement.getValue(
- feature,
- includeCodeQlIfRequired(feature)
- )) === featureConfig[feature].defaultValue
+ (await features.getValue(feature, includeCodeQlIfRequired(feature))) ===
+ featureConfig[feature].defaultValue
);
}
@@ -122,13 +115,13 @@ test("Features use default value if they're not returned in API response", async
test("Feature flags exception is propagated if the API request errors", async (t) => {
await withTmpDir(async (tmpDir) => {
- const featureEnablement = setUpFeatureFlagTests(tmpDir);
+ const features = setUpFeatureFlagTests(tmpDir);
mockFeatureFlagApiEndpoint(500, {});
await t.throwsAsync(
async () =>
- featureEnablement.getValue(
+ features.getValue(
Feature.MlPoweredQueriesEnabled,
includeCodeQlIfRequired(Feature.MlPoweredQueriesEnabled)
),
@@ -143,7 +136,7 @@ test("Feature flags exception is propagated if the API request errors", async (t
for (const feature of Object.keys(featureConfig)) {
test(`Only feature '${feature}' is enabled if enabled in the API response. Other features disabled`, async (t) => {
await withTmpDir(async (tmpDir) => {
- const featureEnablement = setUpFeatureFlagTests(tmpDir);
+ const features = setUpFeatureFlagTests(tmpDir);
// set all features to false except the one we're testing
const expectedFeatureEnablement: { [feature: string]: boolean } = {};
@@ -155,7 +148,7 @@ for (const feature of Object.keys(featureConfig)) {
// retrieve the values of the actual features
const actualFeatureEnablement: { [feature: string]: boolean } = {};
for (const f of Object.keys(featureConfig)) {
- actualFeatureEnablement[f] = await featureEnablement.getValue(
+ actualFeatureEnablement[f] = await features.getValue(
f as Feature,
includeCodeQlIfRequired(f)
);
@@ -168,14 +161,14 @@ for (const feature of Object.keys(featureConfig)) {
test(`Only feature '${feature}' is enabled if the associated environment variable is true. Others disabled.`, async (t) => {
await withTmpDir(async (tmpDir) => {
- const featureEnablement = setUpFeatureFlagTests(tmpDir);
+ const features = setUpFeatureFlagTests(tmpDir);
const expectedFeatureEnablement = initializeFeatures(false);
mockFeatureFlagApiEndpoint(200, expectedFeatureEnablement);
// feature should be disabled initially
t.assert(
- !(await featureEnablement.getValue(
+ !(await features.getValue(
feature as Feature,
includeCodeQlIfRequired(feature)
))
@@ -184,7 +177,7 @@ for (const feature of Object.keys(featureConfig)) {
// set env var to true and check that the feature is now enabled
process.env[featureConfig[feature].envVar] = "true";
t.assert(
- await featureEnablement.getValue(
+ await features.getValue(
feature as Feature,
includeCodeQlIfRequired(feature)
)
@@ -194,14 +187,14 @@ for (const feature of Object.keys(featureConfig)) {
test(`Feature '${feature}' is disabled if the associated environment variable is false, even if enabled in API`, async (t) => {
await withTmpDir(async (tmpDir) => {
- const featureEnablement = setUpFeatureFlagTests(tmpDir);
+ const features = setUpFeatureFlagTests(tmpDir);
const expectedFeatureEnablement = initializeFeatures(true);
mockFeatureFlagApiEndpoint(200, expectedFeatureEnablement);
// feature should be enabled initially
t.assert(
- await featureEnablement.getValue(
+ await features.getValue(
feature as Feature,
includeCodeQlIfRequired(feature)
)
@@ -210,7 +203,7 @@ for (const feature of Object.keys(featureConfig)) {
// set env var to false and check that the feature is now disabled
process.env[featureConfig[feature].envVar] = "false";
t.assert(
- !(await featureEnablement.getValue(
+ !(await features.getValue(
feature as Feature,
includeCodeQlIfRequired(feature)
))
@@ -221,17 +214,14 @@ for (const feature of Object.keys(featureConfig)) {
if (featureConfig[feature].minimumVersion !== undefined) {
test(`Getting feature '${feature} should throw if no codeql is provided`, async (t) => {
await withTmpDir(async (tmpDir) => {
- const featureEnablement = setUpFeatureFlagTests(tmpDir);
+ const features = setUpFeatureFlagTests(tmpDir);
const expectedFeatureEnablement = initializeFeatures(true);
mockFeatureFlagApiEndpoint(200, expectedFeatureEnablement);
- await t.throwsAsync(
- async () => featureEnablement.getValue(feature as Feature),
- {
- message: `Internal error: A minimum version is specified for feature ${feature}, but no instance of CodeQL was provided.`,
- }
- );
+ await t.throwsAsync(async () => features.getValue(feature as Feature), {
+ message: `Internal error: A minimum version is specified for feature ${feature}, but no instance of CodeQL was provided.`,
+ });
});
});
}
@@ -239,35 +229,29 @@ for (const feature of Object.keys(featureConfig)) {
if (featureConfig[feature].minimumVersion !== undefined) {
test(`Feature '${feature}' is disabled if the minimum CLI version is below ${featureConfig[feature].minimumVersion}`, async (t) => {
await withTmpDir(async (tmpDir) => {
- const featureEnablement = setUpFeatureFlagTests(tmpDir);
+ const features = setUpFeatureFlagTests(tmpDir);
const expectedFeatureEnablement = initializeFeatures(true);
mockFeatureFlagApiEndpoint(200, expectedFeatureEnablement);
// feature should be disabled when an old CLI version is set
let codeql = mockCodeQLVersion("2.0.0");
- t.assert(
- !(await featureEnablement.getValue(feature as Feature, codeql))
- );
+ t.assert(!(await features.getValue(feature as Feature, codeql)));
// even setting the env var to true should not enable the feature if
// the minimum CLI version is not met
process.env[featureConfig[feature].envVar] = "true";
- t.assert(
- !(await featureEnablement.getValue(feature as Feature, codeql))
- );
+ t.assert(!(await features.getValue(feature as Feature, codeql)));
// feature should be enabled when a new CLI version is set
// and env var is not set
process.env[featureConfig[feature].envVar] = "";
codeql = mockCodeQLVersion(featureConfig[feature].minimumVersion);
- t.assert(await featureEnablement.getValue(feature as Feature, codeql));
+ t.assert(await features.getValue(feature as Feature, codeql));
// set env var to false and check that the feature is now disabled
process.env[featureConfig[feature].envVar] = "false";
- t.assert(
- !(await featureEnablement.getValue(feature as Feature, codeql))
- );
+ t.assert(!(await features.getValue(feature as Feature, codeql)));
});
});
}
@@ -293,7 +277,7 @@ test("At least one feature has a minimum version specified", (t) => {
test("Feature flags are saved to disk", async (t) => {
await withTmpDir(async (tmpDir) => {
- const featureEnablement = setUpFeatureFlagTests(tmpDir);
+ const features = setUpFeatureFlagTests(tmpDir);
const expectedFeatureEnablement = initializeFeatures(true);
mockFeatureFlagApiEndpoint(200, expectedFeatureEnablement);
@@ -305,7 +289,7 @@ test("Feature flags are saved to disk", async (t) => {
);
t.true(
- await featureEnablement.getValue(
+ await features.getValue(
Feature.CliConfigFileEnabled,
includeCodeQlIfRequired(Feature.CliConfigFileEnabled)
),
@@ -330,10 +314,10 @@ test("Feature flags are saved to disk", async (t) => {
);
// delete the in memory cache so that we are forced to use the cached file
- (featureEnablement as any).gitHubFeatureFlags.cachedApiResponse = undefined;
+ (features as any).gitHubFeatureFlags.cachedApiResponse = undefined;
t.false(
- await featureEnablement.getValue(
+ await features.getValue(
Feature.CliConfigFileEnabled,
includeCodeQlIfRequired(Feature.CliConfigFileEnabled)
),
@@ -344,13 +328,13 @@ test("Feature flags are saved to disk", async (t) => {
test("Environment variable can override feature flag cache", async (t) => {
await withTmpDir(async (tmpDir) => {
- const featureEnablement = setUpFeatureFlagTests(tmpDir);
+ const features = setUpFeatureFlagTests(tmpDir);
const expectedFeatureEnablement = initializeFeatures(true);
mockFeatureFlagApiEndpoint(200, expectedFeatureEnablement);
const cachedFeatureFlags = path.join(tmpDir, FEATURE_FLAGS_FILE_NAME);
t.true(
- await featureEnablement.getValue(
+ await features.getValue(
Feature.CliConfigFileEnabled,
includeCodeQlIfRequired(Feature.CliConfigFileEnabled)
),
@@ -364,7 +348,7 @@ test("Environment variable can override feature flag cache", async (t) => {
process.env.CODEQL_PASS_CONFIG_TO_CLI = "false";
t.false(
- await featureEnablement.getValue(
+ await features.getValue(
Feature.CliConfigFileEnabled,
includeCodeQlIfRequired(Feature.CliConfigFileEnabled)
),
@@ -390,7 +374,7 @@ for (const variant of [GitHubVariant.GHAE, GitHubVariant.GHES]) {
test("selects CLI v2.12.1 on Dotcom when feature flags enable v2.12.0 and v2.12.1", async (t) => {
await withTmpDir(async (tmpDir) => {
- const featureEnablement = setUpFeatureFlagTests(tmpDir);
+ const features = setUpFeatureFlagTests(tmpDir);
const expectedFeatureEnablement = initializeFeatures(true);
expectedFeatureEnablement["default_codeql_version_2_12_0_enabled"] = true;
expectedFeatureEnablement["default_codeql_version_2_12_1_enabled"] = true;
@@ -400,7 +384,7 @@ test("selects CLI v2.12.1 on Dotcom when feature flags enable v2.12.0 and v2.12.
expectedFeatureEnablement["default_codeql_version_2_12_5_enabled"] = false;
mockFeatureFlagApiEndpoint(200, expectedFeatureEnablement);
- const defaultCliVersion = await featureEnablement.getDefaultCliVersion(
+ const defaultCliVersion = await features.getDefaultCliVersion(
GitHubVariant.DOTCOM
);
t.deepEqual(defaultCliVersion, {
@@ -413,11 +397,11 @@ test("selects CLI v2.12.1 on Dotcom when feature flags enable v2.12.0 and v2.12.
test(`selects CLI from defaults.json on Dotcom when no default version feature flags are enabled`, async (t) => {
await withTmpDir(async (tmpDir) => {
- const featureEnablement = setUpFeatureFlagTests(tmpDir);
+ const features = setUpFeatureFlagTests(tmpDir);
const expectedFeatureEnablement = initializeFeatures(true);
mockFeatureFlagApiEndpoint(200, expectedFeatureEnablement);
- const defaultCliVersion = await featureEnablement.getDefaultCliVersion(
+ const defaultCliVersion = await features.getDefaultCliVersion(
GitHubVariant.DOTCOM
);
t.deepEqual(defaultCliVersion, {
@@ -431,7 +415,7 @@ test(`selects CLI from defaults.json on Dotcom when no default version feature f
test("ignores invalid version numbers in default version feature flags", async (t) => {
await withTmpDir(async (tmpDir) => {
const loggedMessages = [];
- const featureEnablement = setUpFeatureFlagTests(
+ const features = setUpFeatureFlagTests(
tmpDir,
getRecordingLogger(loggedMessages)
);
@@ -442,7 +426,7 @@ test("ignores invalid version numbers in default version feature flags", async (
true;
mockFeatureFlagApiEndpoint(200, expectedFeatureEnablement);
- const defaultCliVersion = await featureEnablement.getDefaultCliVersion(
+ const defaultCliVersion = await features.getDefaultCliVersion(
GitHubVariant.DOTCOM
);
t.deepEqual(defaultCliVersion, {
diff --git a/src/feature-flags.ts b/src/feature-flags.ts
index 84e13c3a21..f20d32f09c 100644
--- a/src/feature-flags.ts
+++ b/src/feature-flags.ts
@@ -36,6 +36,7 @@ export interface FeatureEnablement {
export enum Feature {
CliConfigFileEnabled = "cli_config_file_enabled",
DisableKotlinAnalysisEnabled = "disable_kotlin_analysis_enabled",
+ ExportCodeScanningConfigEnabled = "export_code_scanning_config_enabled",
MlPoweredQueriesEnabled = "ml_powered_queries_enabled",
UploadFailedSarifEnabled = "upload_failed_sarif_enabled",
}
@@ -54,6 +55,11 @@ export const featureConfig: Record<
minimumVersion: "2.11.6",
defaultValue: true,
},
+ [Feature.ExportCodeScanningConfigEnabled]: {
+ envVar: "CODEQL_ACTION_EXPORT_CODE_SCANNING_CONFIG",
+ minimumVersion: "2.12.3",
+ defaultValue: false,
+ },
[Feature.MlPoweredQueriesEnabled]: {
envVar: "CODEQL_ML_POWERED_QUERIES",
minimumVersion: "2.7.5",
@@ -88,7 +94,7 @@ export class Features implements FeatureEnablement {
gitHubVersion: util.GitHubVersion,
repositoryNwo: RepositoryNwo,
tempDir: string,
- logger: Logger
+ private readonly logger: Logger
) {
this.gitHubFeatureFlags = new GitHubFeatureFlags(
gitHubVersion,
@@ -129,6 +135,9 @@ export class Features implements FeatureEnablement {
// Do not use this feature if user explicitly disables it via an environment variable.
if (envVar === "false") {
+ this.logger.debug(
+ `Feature ${feature} is disabled via the environment variable ${featureConfig[feature].envVar}.`
+ );
return false;
}
@@ -136,19 +145,45 @@ export class Features implements FeatureEnablement {
const minimumVersion = featureConfig[feature].minimumVersion;
if (codeql && minimumVersion) {
if (!(await util.codeQlVersionAbove(codeql, minimumVersion))) {
+ this.logger.debug(
+ `Feature ${feature} is disabled because the CodeQL CLI version is older than the minimum ` +
+ `version ${minimumVersion}.`
+ );
return false;
+ } else {
+ this.logger.debug(
+ `CodeQL CLI version ${await codeql.getVersion()} is newer than the minimum ` +
+ `version ${minimumVersion} for feature ${feature}.`
+ );
}
}
// Use this feature if user explicitly enables it via an environment variable.
if (envVar === "true") {
+ this.logger.debug(
+ `Feature ${feature} is enabled via the environment variable ${featureConfig[feature].envVar}.`
+ );
return true;
}
+
// Ask the GitHub API if the feature is enabled.
- return (
- (await this.gitHubFeatureFlags.getValue(feature)) ??
- featureConfig[feature].defaultValue
+ const apiValue = await this.gitHubFeatureFlags.getValue(feature);
+ if (apiValue !== undefined) {
+ this.logger.debug(
+ `Feature ${feature} is ${
+ apiValue ? "enabled" : "disabled"
+ } via the GitHub API.`
+ );
+ return apiValue;
+ }
+
+ const defaultValue = featureConfig[feature].defaultValue;
+ this.logger.debug(
+ `Feature ${feature} is ${
+ defaultValue ? "enabled" : "disabled"
+ } due to its default value.`
);
+ return defaultValue;
}
}
@@ -264,12 +299,12 @@ class GitHubFeatureFlags {
this.logger.debug(`No feature flags API response for ${feature}.`);
return undefined;
}
- const featureEnablement = response[feature];
- if (featureEnablement === undefined) {
+ const features = response[feature];
+ if (features === undefined) {
this.logger.debug(`Feature '${feature}' undefined in API response.`);
return undefined;
}
- return !!featureEnablement;
+ return !!features;
}
private async getAllFeatures(): Promise {
diff --git a/src/init-action-post-helper.test.ts b/src/init-action-post-helper.test.ts
index 685d54775c..ed070a8fc0 100644
--- a/src/init-action-post-helper.test.ts
+++ b/src/init-action-post-helper.test.ts
@@ -289,7 +289,12 @@ async function testFailedSarifUpload(
}
if (expectUpload) {
t.true(
- diagnosticsExportStub.calledOnceWith(sinon.match.string, category),
+ diagnosticsExportStub.calledOnceWith(
+ sinon.match.string,
+ category,
+ sinon.match.any,
+ sinon.match.any
+ ),
`Actual args were: ${diagnosticsExportStub.args}`
);
t.true(
diff --git a/src/init-action-post-helper.ts b/src/init-action-post-helper.ts
index da3dabe643..f1b639f862 100644
--- a/src/init-action-post-helper.ts
+++ b/src/init-action-post-helper.ts
@@ -43,19 +43,14 @@ function createFailedUploadFailedSarifResult(
async function maybeUploadFailedSarif(
config: Config,
repositoryNwo: RepositoryNwo,
- featureEnablement: FeatureEnablement,
+ features: FeatureEnablement,
logger: Logger
): Promise {
if (!config.codeQLCmd) {
return { upload_failed_run_skipped_because: "CodeQL command not found" };
}
const codeql = await getCodeQL(config.codeQLCmd);
- if (
- !(await featureEnablement.getValue(
- Feature.UploadFailedSarifEnabled,
- codeql
- ))
- ) {
+ if (!(await features.getValue(Feature.UploadFailedSarifEnabled, codeql))) {
return { upload_failed_run_skipped_because: "Feature disabled" };
}
const workflow = await getWorkflow();
@@ -71,7 +66,7 @@ async function maybeUploadFailedSarif(
const checkoutPath = getCheckoutPathInputOrThrow(workflow, jobName, matrix);
const sarifFile = "../codeql-failed-run.sarif";
- await codeql.diagnosticsExport(sarifFile, category);
+ await codeql.diagnosticsExport(sarifFile, category, config, features);
core.info(`Uploading failed SARIF file ${sarifFile}`);
const uploadResult = await uploadLib.uploadFromActions(
@@ -92,7 +87,7 @@ async function maybeUploadFailedSarif(
export async function tryUploadSarifIfRunFailed(
config: Config,
repositoryNwo: RepositoryNwo,
- featureEnablement: FeatureEnablement,
+ features: FeatureEnablement,
logger: Logger
): Promise {
if (process.env[CODEQL_ACTION_ANALYZE_DID_COMPLETE_SUCCESSFULLY] !== "true") {
@@ -100,7 +95,7 @@ export async function tryUploadSarifIfRunFailed(
return await maybeUploadFailedSarif(
config,
repositoryNwo,
- featureEnablement,
+ features,
logger
);
} catch (e) {
@@ -122,7 +117,7 @@ export async function run(
uploadLogsDebugArtifact: Function,
printDebugLogs: Function,
repositoryNwo: RepositoryNwo,
- featureEnablement: FeatureEnablement,
+ features: FeatureEnablement,
logger: Logger
) {
const config = await getConfig(actionsUtil.getTemporaryDirectory(), logger);
@@ -136,7 +131,7 @@ export async function run(
const uploadFailedSarifResult = await tryUploadSarifIfRunFailed(
config,
repositoryNwo,
- featureEnablement,
+ features,
logger
);
if (uploadFailedSarifResult.upload_failed_run_skipped_because) {
diff --git a/src/init.ts b/src/init.ts
index c33c889ddb..10489e3bfc 100644
--- a/src/init.ts
+++ b/src/init.ts
@@ -68,7 +68,7 @@ export async function initConfig(
workspacePath: string,
gitHubVersion: util.GitHubVersion,
apiDetails: GitHubApiCombinedDetails,
- featureEnablement: FeatureEnablement,
+ features: FeatureEnablement,
logger: Logger
): Promise {
logger.startGroup("Load language configuration");
@@ -89,7 +89,7 @@ export async function initConfig(
workspacePath,
gitHubVersion,
apiDetails,
- featureEnablement,
+ features,
logger
);
analysisPaths.printPathFiltersWarning(config, logger);
@@ -103,7 +103,7 @@ export async function runInit(
sourceRoot: string,
processName: string | undefined,
registriesInput: string | undefined,
- featureEnablement: FeatureEnablement,
+ features: FeatureEnablement,
apiDetails: GitHubApiCombinedDetails,
logger: Logger
): Promise {
@@ -117,7 +117,7 @@ export async function runInit(
// before the `pack download` command was invoked. It is not required for the init command.
let registriesAuthTokens: string | undefined;
let qlconfigFile: string | undefined;
- if (await util.useCodeScanningConfigInCli(codeql, featureEnablement)) {
+ if (await util.useCodeScanningConfigInCli(codeql, features)) {
({ registriesAuthTokens, qlconfigFile } =
await configUtils.generateRegistries(
registriesInput,
@@ -138,7 +138,7 @@ export async function runInit(
config,
sourceRoot,
processName,
- featureEnablement,
+ features,
qlconfigFile,
logger
)
diff --git a/src/util.ts b/src/util.ts
index c96fd7b52e..d11a512fd3 100644
--- a/src/util.ts
+++ b/src/util.ts
@@ -664,17 +664,17 @@ export function isInTestMode(): boolean {
*/
export async function useCodeScanningConfigInCli(
codeql: CodeQL,
- featureEnablement: FeatureEnablement
+ features: FeatureEnablement
): Promise {
- return await featureEnablement.getValue(Feature.CliConfigFileEnabled, codeql);
+ return await features.getValue(Feature.CliConfigFileEnabled, codeql);
}
export async function logCodeScanningConfigInCli(
codeql: CodeQL,
- featureEnablement: FeatureEnablement,
+ features: FeatureEnablement,
logger: Logger
) {
- if (await useCodeScanningConfigInCli(codeql, featureEnablement)) {
+ if (await useCodeScanningConfigInCli(codeql, features)) {
logger.info(
"Code Scanning configuration file being processed in the codeql CLI."
);