Compare commits

..

32 Commits

Author SHA1 Message Date
Kasper Svendsen
4eb247591f Move conversion of PR diff-range paths to absolute paths 2025-11-12 08:10:40 +01:00
Kasper Svendsen
df4e1992c0 Add unit test for diffRangeExtensionPackContents 2025-11-12 08:10:40 +01:00
Kasper Svendsen
d18f3acf74 Move diff-range extension pack generation into testable function 2025-11-12 08:10:39 +01:00
Kasper Svendsen
035c1179af upload-lib: Unit test filterAlertsByDiffRange 2025-11-12 08:10:39 +01:00
Henry Mercer
1d9f357d01 Merge pull request #3281 from github/dependabot/npm_and_yarn/npm-minor-9dd9c1a8e4
Bump the npm-minor group with 4 updates
2025-11-11 10:21:24 +00:00
github-actions[bot]
3d7be7bf78 Rebuild 2025-11-10 17:49:58 +00:00
dependabot[bot]
63bb415fff Bump the npm-minor group with 4 updates
Bumps the npm-minor group with 4 updates: [@eslint/js](https://github.com/eslint/eslint/tree/HEAD/packages/js), [@typescript-eslint/eslint-plugin](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/eslint-plugin), [@typescript-eslint/parser](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/parser) and [esbuild](https://github.com/evanw/esbuild).


Updates `@eslint/js` from 9.39.0 to 9.39.1
- [Release notes](https://github.com/eslint/eslint/releases)
- [Commits](https://github.com/eslint/eslint/commits/v9.39.1/packages/js)

Updates `@typescript-eslint/eslint-plugin` from 8.46.3 to 8.46.4
- [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
- [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/CHANGELOG.md)
- [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v8.46.4/packages/eslint-plugin)

Updates `@typescript-eslint/parser` from 8.46.3 to 8.46.4
- [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
- [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/parser/CHANGELOG.md)
- [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v8.46.4/packages/parser)

Updates `esbuild` from 0.25.12 to 0.27.0
- [Release notes](https://github.com/evanw/esbuild/releases)
- [Changelog](https://github.com/evanw/esbuild/blob/main/CHANGELOG.md)
- [Commits](https://github.com/evanw/esbuild/compare/v0.25.12...v0.27.0)

---
updated-dependencies:
- dependency-name: "@eslint/js"
  dependency-version: 9.39.1
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: npm-minor
- dependency-name: "@typescript-eslint/eslint-plugin"
  dependency-version: 8.46.4
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: npm-minor
- dependency-name: "@typescript-eslint/parser"
  dependency-version: 8.46.4
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: npm-minor
- dependency-name: esbuild
  dependency-version: 0.27.0
  dependency-type: direct:development
  update-type: version-update:semver-minor
  dependency-group: npm-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-11-10 17:48:25 +00:00
Michael B. Gale
04bd5c6aab Merge pull request #3279 from github/mbg/lint/jsdoc-param-names
Linter: check JSDoc parameter names exist
2025-11-10 11:36:02 +00:00
Michael B. Gale
5b58b8f9c5 Linter: check JSDoc parameter names exist 2025-11-09 10:26:36 +00:00
Henry Mercer
71d0a56d44 Merge pull request #3278 from github/henrymercer/type-fun
Use generic types for durations in status report
2025-11-06 10:47:44 +00:00
Henry Mercer
04285cbe85 Use generic types for durations in status report
This means we don't need to update this interface for every new language.
2025-11-05 18:54:44 +00:00
Mario Campos
320a6b661b Merge pull request #3272 from github/mario-campos/v4-warning
Update deprecation warnings for CodeQL Action to v4
2025-11-05 10:01:33 -06:00
Mario Campos
b5e5a258e6 Merge branch 'main' into mario-campos/v4-warning 2025-11-05 09:39:54 -06:00
Mario Campos
74f662193b Reformat with eslint 2025-11-05 09:37:42 -06:00
Mario Campos
ecee3ea8f5 Update CHANGELOG.md. 2025-11-05 09:18:30 -06:00
Mario Campos
6a63bc6af3 Change warning message to just v3 (exclude v1, v2). 2025-11-05 09:15:53 -06:00
Henry Mercer
e2ef519c75 Merge pull request #3224 from github/henrymercer/clean-up-resolve-languages-ff
Clean up `resolve_supported_languages_using_cli` FF
2025-11-05 11:57:35 +00:00
Michael B. Gale
423d14e583 Merge pull request #3277 from github/mbg/ci/update-bundle-python
Install Python in `update-bundle` workflow
2025-11-05 11:53:17 +00:00
Michael B. Gale
6dd11f73d3 Update .github/workflows/script/bundle_changelog.py
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-11-05 11:34:26 +00:00
Michael B. Gale
c9f82f2adf Move python script to file 2025-11-05 11:22:38 +00:00
Michael B. Gale
33684ef869 Add setup-python step to update-bundle workflow 2025-11-05 11:20:06 +00:00
Michael B. Gale
5aa2d63d5b Merge branch 'main' into mario-campos/v4-warning 2025-11-05 11:03:25 +00:00
Mario Campos
a570795dfc Clarify the CHANGELOG.md entry to reflect the whole action, and not just init. 2025-11-04 12:02:15 -06:00
Mario Campos
9366f80399 Reference GHES 3.20 in the comment, not 3.19.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-11-04 12:00:11 -06:00
Mario Campos
c443dff433 Simplify warning language to not enumerate deprecated versions. 2025-11-04 11:57:44 -06:00
Mario Campos
b32a1e0627 Update test cases for GitHub Enterprise Server versions 3.11 and 3.12 to reflect correct deprecation status 2025-11-04 11:51:23 -06:00
Mario Campos
08dc635f27 Restore use of sinon.match(). 2025-11-04 11:11:08 -06:00
Mario Campos
f1ca6a4f47 Update tests to reflect deprecation status of CodeQL Action v3 2025-11-04 11:07:15 -06:00
Mario Campos
ba82f9bd34 Fix deprecation warning to reflect that v3 is not actually deprecated yet. 2025-11-04 10:13:07 -06:00
Mario Campos
5a9b49de7e Update CHANGELOG to reflect warning for v3 users migrating to v4 of CodeQL Action 2025-11-04 10:09:47 -06:00
Mario Campos
1aade295bc Update deprecation warnings for CodeQL Action to v4 2025-11-04 09:59:16 -06:00
Henry Mercer
a691497d40 Clean up resolve_supported_languages_using_cli FF 2025-10-22 17:04:42 +01:00
36 changed files with 1096 additions and 682 deletions

View File

@@ -0,0 +1,18 @@
import os
import re
# Get the PR number from the PR URL.
pr_number = os.environ['PR_URL'].split('/')[-1]
changelog_note = f"- Update default CodeQL bundle version to {os.environ['CLI_VERSION']}. [#{pr_number}]({os.environ['PR_URL']})"
# If the "[UNRELEASED]" section starts with "no user facing changes", remove that line.
with open('CHANGELOG.md', 'r') as f:
changelog = f.read()
changelog = changelog.replace('## [UNRELEASED]\n\nNo user facing changes.', '## [UNRELEASED]\n')
# Add the changelog note to the bottom of the "[UNRELEASED]" section.
changelog = re.sub(r'\n## (\d+\.\d+\.\d+)', f'{changelog_note}\n\n## \\1', changelog, count=1)
with open('CHANGELOG.md', 'w') as f:
f.write(changelog)

View File

@@ -40,6 +40,11 @@ jobs:
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com" git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config --global user.name "github-actions[bot]" git config --global user.name "github-actions[bot]"
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: '3.12'
- name: Set up Node.js - name: Set up Node.js
uses: actions/setup-node@v6 uses: actions/setup-node@v6
with: with:
@@ -78,28 +83,8 @@ jobs:
echo "PR_URL=$pr_url" | tee -a "$GITHUB_ENV" echo "PR_URL=$pr_url" | tee -a "$GITHUB_ENV"
- name: Create changelog note - name: Create changelog note
shell: python
run: | run: |
import os python .github/workflows/script/bundle_changelog.py
import re
# Get the PR number from the PR URL.
pr_number = os.environ['PR_URL'].split('/')[-1]
changelog_note = f"- Update default CodeQL bundle version to {os.environ['CLI_VERSION']}. [#{pr_number}]({os.environ['PR_URL']})"
# If the "[UNRELEASED]" section starts with "no user facing changes", remove that line.
# Use perl to avoid having to escape the newline character.
with open('CHANGELOG.md', 'r') as f:
changelog = f.read()
changelog = changelog.replace('## [UNRELEASED]\n\nNo user facing changes.', '## [UNRELEASED]\n')
# Add the changelog note to the bottom of the "[UNRELEASED]" section.
changelog = re.sub(r'\n## (\d+\.\d+\.\d+)', f'{changelog_note}\n\n## \\1', changelog, count=1)
with open('CHANGELOG.md', 'w') as f:
f.write(changelog)
- name: Push changelog note - name: Push changelog note
run: | run: |

View File

@@ -4,7 +4,7 @@ See the [releases page](https://github.com/github/codeql-action/releases) for th
## [UNRELEASED] ## [UNRELEASED]
- Update default CodeQL bundle version to 2.23.4. [#3276](https://github.com/github/codeql-action/pull/3276) - CodeQL Action v3 will be deprecated in December 2026. The Action now logs a warning for customers who are running v3 but could be running v4. For more information, see [Upcoming deprecation of CodeQL Action v3](https://github.blog/changelog/2025-10-28-upcoming-deprecation-of-codeql-action-v3/).
## 4.31.2 - 30 Oct 2025 ## 4.31.2 - 30 Oct 2025

View File

@@ -12,6 +12,7 @@ import filenames from "eslint-plugin-filenames";
import github from "eslint-plugin-github"; import github from "eslint-plugin-github";
import _import from "eslint-plugin-import"; import _import from "eslint-plugin-import";
import noAsyncForeach from "eslint-plugin-no-async-foreach"; import noAsyncForeach from "eslint-plugin-no-async-foreach";
import jsdoc from "eslint-plugin-jsdoc";
import globals from "globals"; import globals from "globals";
const __filename = fileURLToPath(import.meta.url); const __filename = fileURLToPath(import.meta.url);
@@ -52,6 +53,7 @@ export default [
github: fixupPluginRules(github), github: fixupPluginRules(github),
import: fixupPluginRules(_import), import: fixupPluginRules(_import),
"no-async-foreach": noAsyncForeach, "no-async-foreach": noAsyncForeach,
"jsdoc": jsdoc,
}, },
languageOptions: { languageOptions: {
@@ -133,6 +135,16 @@ export default [
"@typescript-eslint/no-shadow": "error", "@typescript-eslint/no-shadow": "error",
"@typescript-eslint/prefer-optional-chain": "error", "@typescript-eslint/prefer-optional-chain": "error",
"one-var": ["error", "never"], "one-var": ["error", "never"],
// Check param names to ensure that we don't have outdated JSDocs.
"jsdoc/check-param-names": [
"error",
{
// We don't currently require full JSDoc coverage, so this rule
// should not error on missing @param annotations.
disableMissingParamChecks: true,
}
],
}, },
}, },
{ {

View File

@@ -27680,7 +27680,7 @@ var require_package = __commonJS({
"@ava/typescript": "6.0.0", "@ava/typescript": "6.0.0",
"@eslint/compat": "^1.4.1", "@eslint/compat": "^1.4.1",
"@eslint/eslintrc": "^3.3.1", "@eslint/eslintrc": "^3.3.1",
"@eslint/js": "^9.39.0", "@eslint/js": "^9.39.1",
"@microsoft/eslint-formatter-sarif": "^3.1.0", "@microsoft/eslint-formatter-sarif": "^3.1.0",
"@octokit/types": "^16.0.0", "@octokit/types": "^16.0.0",
"@types/archiver": "^7.0.0", "@types/archiver": "^7.0.0",
@@ -27690,15 +27690,16 @@ var require_package = __commonJS({
"@types/node-forge": "^1.3.14", "@types/node-forge": "^1.3.14",
"@types/semver": "^7.7.1", "@types/semver": "^7.7.1",
"@types/sinon": "^17.0.4", "@types/sinon": "^17.0.4",
"@typescript-eslint/eslint-plugin": "^8.46.3", "@typescript-eslint/eslint-plugin": "^8.46.4",
"@typescript-eslint/parser": "^8.41.0", "@typescript-eslint/parser": "^8.41.0",
ava: "^6.4.1", ava: "^6.4.1",
esbuild: "^0.25.12", esbuild: "^0.27.0",
eslint: "^8.57.1", eslint: "^8.57.1",
"eslint-import-resolver-typescript": "^3.8.7", "eslint-import-resolver-typescript": "^3.8.7",
"eslint-plugin-filenames": "^1.3.2", "eslint-plugin-filenames": "^1.3.2",
"eslint-plugin-github": "^5.1.8", "eslint-plugin-github": "^5.1.8",
"eslint-plugin-import": "2.29.1", "eslint-plugin-import": "2.29.1",
"eslint-plugin-jsdoc": "^61.1.12",
"eslint-plugin-no-async-foreach": "^0.1.1", "eslint-plugin-no-async-foreach": "^0.1.1",
glob: "^11.0.3", glob: "^11.0.3",
nock: "^14.0.10", nock: "^14.0.10",
@@ -119955,12 +119956,6 @@ var featureConfig = {
legacyApi: true, legacyApi: true,
minimumVersion: void 0 minimumVersion: void 0
}, },
["resolve_supported_languages_using_cli" /* ResolveSupportedLanguagesUsingCli */]: {
defaultValue: false,
envVar: "CODEQL_ACTION_RESOLVE_SUPPORTED_LANGUAGES_USING_CLI",
minimumVersion: void 0,
toolsFeature: "builtinExtractorsSpecifyDefaultQueries" /* BuiltinExtractorsSpecifyDefaultQueries */
},
["overlay_analysis" /* OverlayAnalysis */]: { ["overlay_analysis" /* OverlayAnalysis */]: {
defaultValue: false, defaultValue: false,
envVar: "CODEQL_ACTION_OVERLAY_ANALYSIS", envVar: "CODEQL_ACTION_OVERLAY_ANALYSIS",

73
lib/analyze-action.js generated
View File

@@ -27680,7 +27680,7 @@ var require_package = __commonJS({
"@ava/typescript": "6.0.0", "@ava/typescript": "6.0.0",
"@eslint/compat": "^1.4.1", "@eslint/compat": "^1.4.1",
"@eslint/eslintrc": "^3.3.1", "@eslint/eslintrc": "^3.3.1",
"@eslint/js": "^9.39.0", "@eslint/js": "^9.39.1",
"@microsoft/eslint-formatter-sarif": "^3.1.0", "@microsoft/eslint-formatter-sarif": "^3.1.0",
"@octokit/types": "^16.0.0", "@octokit/types": "^16.0.0",
"@types/archiver": "^7.0.0", "@types/archiver": "^7.0.0",
@@ -27690,15 +27690,16 @@ var require_package = __commonJS({
"@types/node-forge": "^1.3.14", "@types/node-forge": "^1.3.14",
"@types/semver": "^7.7.1", "@types/semver": "^7.7.1",
"@types/sinon": "^17.0.4", "@types/sinon": "^17.0.4",
"@typescript-eslint/eslint-plugin": "^8.46.3", "@typescript-eslint/eslint-plugin": "^8.46.4",
"@typescript-eslint/parser": "^8.41.0", "@typescript-eslint/parser": "^8.41.0",
ava: "^6.4.1", ava: "^6.4.1",
esbuild: "^0.25.12", esbuild: "^0.27.0",
eslint: "^8.57.1", eslint: "^8.57.1",
"eslint-import-resolver-typescript": "^3.8.7", "eslint-import-resolver-typescript": "^3.8.7",
"eslint-plugin-filenames": "^1.3.2", "eslint-plugin-filenames": "^1.3.2",
"eslint-plugin-github": "^5.1.8", "eslint-plugin-github": "^5.1.8",
"eslint-plugin-import": "2.29.1", "eslint-plugin-import": "2.29.1",
"eslint-plugin-jsdoc": "^61.1.12",
"eslint-plugin-no-async-foreach": "^0.1.1", "eslint-plugin-no-async-foreach": "^0.1.1",
glob: "^11.0.3", glob: "^11.0.3",
nock: "^14.0.10", nock: "^14.0.10",
@@ -87413,14 +87414,14 @@ async function checkDiskUsage(logger) {
} }
} }
function checkActionVersion(version, githubVersion) { function checkActionVersion(version, githubVersion) {
if (!semver.satisfies(version, ">=3") && // do not log error if the customer is already running v3 if (!semver.satisfies(version, ">=4") && // do not log error if the customer is already running v4
!process.env["CODEQL_ACTION_DID_LOG_VERSION_DEPRECATION" /* LOG_VERSION_DEPRECATION */]) { !process.env["CODEQL_ACTION_DID_LOG_VERSION_DEPRECATION" /* LOG_VERSION_DEPRECATION */]) {
if (githubVersion.type === 0 /* DOTCOM */ || githubVersion.type === 2 /* GHE_DOTCOM */ || githubVersion.type === 1 /* GHES */ && semver.satisfies( if (githubVersion.type === 0 /* DOTCOM */ || githubVersion.type === 2 /* GHE_DOTCOM */ || githubVersion.type === 1 /* GHES */ && semver.satisfies(
semver.coerce(githubVersion.version) ?? "0.0.0", semver.coerce(githubVersion.version) ?? "0.0.0",
">=3.11" ">=3.20"
)) { )) {
core3.error( core3.error(
"CodeQL Action major versions v1 and v2 have been deprecated. Please update all occurrences of the CodeQL Action in your workflow files to v3. For more information, see https://github.blog/changelog/2025-01-10-code-scanning-codeql-action-v2-is-now-deprecated/" "CodeQL Action v3 will be deprecated in December 2026. Please update all occurrences of the CodeQL Action in your workflow files to v4. For more information, see https://github.blog/changelog/2025-10-28-upcoming-deprecation-of-codeql-action-v3/"
); );
core3.exportVariable("CODEQL_ACTION_DID_LOG_VERSION_DEPRECATION" /* LOG_VERSION_DEPRECATION */, "true"); core3.exportVariable("CODEQL_ACTION_DID_LOG_VERSION_DEPRECATION" /* LOG_VERSION_DEPRECATION */, "true");
} }
@@ -88203,8 +88204,8 @@ var path4 = __toESM(require("path"));
var semver4 = __toESM(require_semver2()); var semver4 = __toESM(require_semver2());
// src/defaults.json // src/defaults.json
var bundleVersion = "codeql-bundle-v2.23.4"; var bundleVersion = "codeql-bundle-v2.23.3";
var cliVersion = "2.23.4"; var cliVersion = "2.23.3";
// src/overlay-database-utils.ts // src/overlay-database-utils.ts
var crypto = __toESM(require("crypto")); var crypto = __toESM(require("crypto"));
@@ -88684,12 +88685,6 @@ var featureConfig = {
legacyApi: true, legacyApi: true,
minimumVersion: void 0 minimumVersion: void 0
}, },
["resolve_supported_languages_using_cli" /* ResolveSupportedLanguagesUsingCli */]: {
defaultValue: false,
envVar: "CODEQL_ACTION_RESOLVE_SUPPORTED_LANGUAGES_USING_CLI",
minimumVersion: void 0,
toolsFeature: "builtinExtractorsSpecifyDefaultQueries" /* BuiltinExtractorsSpecifyDefaultQueries */
},
["overlay_analysis" /* OverlayAnalysis */]: { ["overlay_analysis" /* OverlayAnalysis */]: {
defaultValue: false, defaultValue: false,
envVar: "CODEQL_ACTION_OVERLAY_ANALYSIS", envVar: "CODEQL_ACTION_OVERLAY_ANALYSIS",
@@ -89187,14 +89182,13 @@ Error Response: ${JSON.stringify(error4.response, null, 2)}`
} }
} }
function getDiffRanges(fileDiff, logger) { function getDiffRanges(fileDiff, logger) {
const filename = path5.join(getRequiredInput("checkout_path"), fileDiff.filename).replaceAll(path5.sep, "/");
if (fileDiff.patch === void 0) { if (fileDiff.patch === void 0) {
if (fileDiff.changes === 0) { if (fileDiff.changes === 0) {
return []; return [];
} }
return [ return [
{ {
path: filename, path: fileDiff.filename,
startLine: 0, startLine: 0,
endLine: 0 endLine: 0
} }
@@ -89218,7 +89212,7 @@ function getDiffRanges(fileDiff, logger) {
} }
if (additionRangeStartLine !== void 0) { if (additionRangeStartLine !== void 0) {
diffRanges.push({ diffRanges.push({
path: filename, path: fileDiff.filename,
startLine: additionRangeStartLine, startLine: additionRangeStartLine,
endLine: currentLine - 1 endLine: currentLine - 1
}); });
@@ -91329,6 +91323,25 @@ async function setupDiffInformedQueryRun(branches, logger) {
} }
); );
} }
function diffRangeExtensionPackContents(ranges) {
const header = `
extensions:
- addsTo:
pack: codeql/util
extensible: restrictAlertsTo
checkPresence: false
data:
`;
let data = ranges.map((range) => {
const filename = path12.join(getRequiredInput("checkout_path"), range.path).replaceAll(path12.sep, "/");
return ` - [${dump(filename, { forceQuotes: true }).trim()}, ${range.startLine}, ${range.endLine}]
`;
}).join("");
if (!data) {
data = ' - ["", 0, 0]\n';
}
return header + data;
}
function writeDiffRangeDataExtensionPack(logger, ranges) { function writeDiffRangeDataExtensionPack(logger, ranges) {
if (ranges === void 0) { if (ranges === void 0) {
return void 0; return void 0;
@@ -91350,27 +91363,7 @@ dataExtensions:
- pr-diff-range.yml - pr-diff-range.yml
` `
); );
const header = ` const extensionContents = diffRangeExtensionPackContents(ranges);
extensions:
- addsTo:
pack: codeql/util
extensible: restrictAlertsTo
checkPresence: false
data:
`;
let data = ranges.map(
(range) => (
// Using yaml.dump() with `forceQuotes: true` ensures that all special
// characters are escaped, and that the path is always rendered as a
// quoted string on a single line.
` - [${dump(range.path, { forceQuotes: true }).trim()}, ${range.startLine}, ${range.endLine}]
`
)
).join("");
if (!data) {
data = ' - ["", 0, 0]\n';
}
const extensionContents = header + data;
const extensionFilePath = path12.join(diffRangeDir, "pr-diff-range.yml"); const extensionFilePath = path12.join(diffRangeDir, "pr-diff-range.yml");
fs12.writeFileSync(extensionFilePath, extensionContents); fs12.writeFileSync(extensionFilePath, extensionContents);
logger.debug( logger.debug(
@@ -93653,7 +93646,6 @@ function filterAlertsByDiffRange(logger, sarif) {
if (!diffRanges?.length) { if (!diffRanges?.length) {
return sarif; return sarif;
} }
const checkoutPath = getRequiredInput("checkout_path");
for (const run2 of sarif.runs) { for (const run2 of sarif.runs) {
if (run2.results) { if (run2.results) {
run2.results = run2.results.filter((result) => { run2.results = run2.results.filter((result) => {
@@ -93667,9 +93659,8 @@ function filterAlertsByDiffRange(logger, sarif) {
if (!locationUri || locationStartLine === void 0) { if (!locationUri || locationStartLine === void 0) {
return false; return false;
} }
const locationPath = path14.join(checkoutPath, locationUri).replaceAll(path14.sep, "/");
return diffRanges.some( return diffRanges.some(
(range) => range.path === locationPath && (range.startLine <= locationStartLine && range.endLine >= locationStartLine || range.startLine === 0 && range.endLine === 0) (range) => range.path === locationUri && (range.startLine <= locationStartLine && range.endLine >= locationStartLine || range.startLine === 0 && range.endLine === 0)
); );
}); });
}); });

View File

@@ -27680,7 +27680,7 @@ var require_package = __commonJS({
"@ava/typescript": "6.0.0", "@ava/typescript": "6.0.0",
"@eslint/compat": "^1.4.1", "@eslint/compat": "^1.4.1",
"@eslint/eslintrc": "^3.3.1", "@eslint/eslintrc": "^3.3.1",
"@eslint/js": "^9.39.0", "@eslint/js": "^9.39.1",
"@microsoft/eslint-formatter-sarif": "^3.1.0", "@microsoft/eslint-formatter-sarif": "^3.1.0",
"@octokit/types": "^16.0.0", "@octokit/types": "^16.0.0",
"@types/archiver": "^7.0.0", "@types/archiver": "^7.0.0",
@@ -27690,15 +27690,16 @@ var require_package = __commonJS({
"@types/node-forge": "^1.3.14", "@types/node-forge": "^1.3.14",
"@types/semver": "^7.7.1", "@types/semver": "^7.7.1",
"@types/sinon": "^17.0.4", "@types/sinon": "^17.0.4",
"@typescript-eslint/eslint-plugin": "^8.46.3", "@typescript-eslint/eslint-plugin": "^8.46.4",
"@typescript-eslint/parser": "^8.41.0", "@typescript-eslint/parser": "^8.41.0",
ava: "^6.4.1", ava: "^6.4.1",
esbuild: "^0.25.12", esbuild: "^0.27.0",
eslint: "^8.57.1", eslint: "^8.57.1",
"eslint-import-resolver-typescript": "^3.8.7", "eslint-import-resolver-typescript": "^3.8.7",
"eslint-plugin-filenames": "^1.3.2", "eslint-plugin-filenames": "^1.3.2",
"eslint-plugin-github": "^5.1.8", "eslint-plugin-github": "^5.1.8",
"eslint-plugin-import": "2.29.1", "eslint-plugin-import": "2.29.1",
"eslint-plugin-jsdoc": "^61.1.12",
"eslint-plugin-no-async-foreach": "^0.1.1", "eslint-plugin-no-async-foreach": "^0.1.1",
glob: "^11.0.3", glob: "^11.0.3",
nock: "^14.0.10", nock: "^14.0.10",
@@ -83157,14 +83158,14 @@ async function checkDiskUsage(logger) {
} }
} }
function checkActionVersion(version, githubVersion) { function checkActionVersion(version, githubVersion) {
if (!semver.satisfies(version, ">=3") && // do not log error if the customer is already running v3 if (!semver.satisfies(version, ">=4") && // do not log error if the customer is already running v4
!process.env["CODEQL_ACTION_DID_LOG_VERSION_DEPRECATION" /* LOG_VERSION_DEPRECATION */]) { !process.env["CODEQL_ACTION_DID_LOG_VERSION_DEPRECATION" /* LOG_VERSION_DEPRECATION */]) {
if (githubVersion.type === 0 /* DOTCOM */ || githubVersion.type === 2 /* GHE_DOTCOM */ || githubVersion.type === 1 /* GHES */ && semver.satisfies( if (githubVersion.type === 0 /* DOTCOM */ || githubVersion.type === 2 /* GHE_DOTCOM */ || githubVersion.type === 1 /* GHES */ && semver.satisfies(
semver.coerce(githubVersion.version) ?? "0.0.0", semver.coerce(githubVersion.version) ?? "0.0.0",
">=3.11" ">=3.20"
)) { )) {
core3.error( core3.error(
"CodeQL Action major versions v1 and v2 have been deprecated. Please update all occurrences of the CodeQL Action in your workflow files to v3. For more information, see https://github.blog/changelog/2025-01-10-code-scanning-codeql-action-v2-is-now-deprecated/" "CodeQL Action v3 will be deprecated in December 2026. Please update all occurrences of the CodeQL Action in your workflow files to v4. For more information, see https://github.blog/changelog/2025-10-28-upcoming-deprecation-of-codeql-action-v3/"
); );
core3.exportVariable("CODEQL_ACTION_DID_LOG_VERSION_DEPRECATION" /* LOG_VERSION_DEPRECATION */, "true"); core3.exportVariable("CODEQL_ACTION_DID_LOG_VERSION_DEPRECATION" /* LOG_VERSION_DEPRECATION */, "true");
} }
@@ -83699,8 +83700,8 @@ var path3 = __toESM(require("path"));
var semver4 = __toESM(require_semver2()); var semver4 = __toESM(require_semver2());
// src/defaults.json // src/defaults.json
var bundleVersion = "codeql-bundle-v2.23.4"; var bundleVersion = "codeql-bundle-v2.23.3";
var cliVersion = "2.23.4"; var cliVersion = "2.23.3";
// src/overlay-database-utils.ts // src/overlay-database-utils.ts
var fs2 = __toESM(require("fs")); var fs2 = __toESM(require("fs"));
@@ -84004,12 +84005,6 @@ var featureConfig = {
legacyApi: true, legacyApi: true,
minimumVersion: void 0 minimumVersion: void 0
}, },
["resolve_supported_languages_using_cli" /* ResolveSupportedLanguagesUsingCli */]: {
defaultValue: false,
envVar: "CODEQL_ACTION_RESOLVE_SUPPORTED_LANGUAGES_USING_CLI",
minimumVersion: void 0,
toolsFeature: "builtinExtractorsSpecifyDefaultQueries" /* BuiltinExtractorsSpecifyDefaultQueries */
},
["overlay_analysis" /* OverlayAnalysis */]: { ["overlay_analysis" /* OverlayAnalysis */]: {
defaultValue: false, defaultValue: false,
envVar: "CODEQL_ACTION_OVERLAY_ANALYSIS", envVar: "CODEQL_ACTION_OVERLAY_ANALYSIS",

View File

@@ -1,6 +1,6 @@
{ {
"bundleVersion": "codeql-bundle-v2.23.4", "bundleVersion": "codeql-bundle-v2.23.3",
"cliVersion": "2.23.4", "cliVersion": "2.23.3",
"priorBundleVersion": "codeql-bundle-v2.23.3", "priorBundleVersion": "codeql-bundle-v2.23.2",
"priorCliVersion": "2.23.3" "priorCliVersion": "2.23.2"
} }

View File

@@ -27680,7 +27680,7 @@ var require_package = __commonJS({
"@ava/typescript": "6.0.0", "@ava/typescript": "6.0.0",
"@eslint/compat": "^1.4.1", "@eslint/compat": "^1.4.1",
"@eslint/eslintrc": "^3.3.1", "@eslint/eslintrc": "^3.3.1",
"@eslint/js": "^9.39.0", "@eslint/js": "^9.39.1",
"@microsoft/eslint-formatter-sarif": "^3.1.0", "@microsoft/eslint-formatter-sarif": "^3.1.0",
"@octokit/types": "^16.0.0", "@octokit/types": "^16.0.0",
"@types/archiver": "^7.0.0", "@types/archiver": "^7.0.0",
@@ -27690,15 +27690,16 @@ var require_package = __commonJS({
"@types/node-forge": "^1.3.14", "@types/node-forge": "^1.3.14",
"@types/semver": "^7.7.1", "@types/semver": "^7.7.1",
"@types/sinon": "^17.0.4", "@types/sinon": "^17.0.4",
"@typescript-eslint/eslint-plugin": "^8.46.3", "@typescript-eslint/eslint-plugin": "^8.46.4",
"@typescript-eslint/parser": "^8.41.0", "@typescript-eslint/parser": "^8.41.0",
ava: "^6.4.1", ava: "^6.4.1",
esbuild: "^0.25.12", esbuild: "^0.27.0",
eslint: "^8.57.1", eslint: "^8.57.1",
"eslint-import-resolver-typescript": "^3.8.7", "eslint-import-resolver-typescript": "^3.8.7",
"eslint-plugin-filenames": "^1.3.2", "eslint-plugin-filenames": "^1.3.2",
"eslint-plugin-github": "^5.1.8", "eslint-plugin-github": "^5.1.8",
"eslint-plugin-import": "2.29.1", "eslint-plugin-import": "2.29.1",
"eslint-plugin-jsdoc": "^61.1.12",
"eslint-plugin-no-async-foreach": "^0.1.1", "eslint-plugin-no-async-foreach": "^0.1.1",
glob: "^11.0.3", glob: "^11.0.3",
nock: "^14.0.10", nock: "^14.0.10",
@@ -90451,8 +90452,8 @@ var require_primordials = __commonJS({
ArrayPrototypeIndexOf(self2, el) { ArrayPrototypeIndexOf(self2, el) {
return self2.indexOf(el); return self2.indexOf(el);
}, },
ArrayPrototypeJoin(self2, sep4) { ArrayPrototypeJoin(self2, sep3) {
return self2.join(sep4); return self2.join(sep3);
}, },
ArrayPrototypeMap(self2, fn) { ArrayPrototypeMap(self2, fn) {
return self2.map(fn); return self2.map(fn);
@@ -102339,7 +102340,7 @@ var require_commonjs16 = __commonJS({
* *
* @internal * @internal
*/ */
constructor(cwd = process.cwd(), pathImpl, sep4, { nocase, childrenCacheSize = 16 * 1024, fs: fs17 = defaultFS } = {}) { constructor(cwd = process.cwd(), pathImpl, sep3, { nocase, childrenCacheSize = 16 * 1024, fs: fs17 = defaultFS } = {}) {
this.#fs = fsFromOption(fs17); this.#fs = fsFromOption(fs17);
if (cwd instanceof URL || cwd.startsWith("file://")) { if (cwd instanceof URL || cwd.startsWith("file://")) {
cwd = (0, node_url_1.fileURLToPath)(cwd); cwd = (0, node_url_1.fileURLToPath)(cwd);
@@ -102350,7 +102351,7 @@ var require_commonjs16 = __commonJS({
this.#resolveCache = new ResolveCache(); this.#resolveCache = new ResolveCache();
this.#resolvePosixCache = new ResolveCache(); this.#resolvePosixCache = new ResolveCache();
this.#children = new ChildrenCache(childrenCacheSize); this.#children = new ChildrenCache(childrenCacheSize);
const split = cwdPath.substring(this.rootPath.length).split(sep4); const split = cwdPath.substring(this.rootPath.length).split(sep3);
if (split.length === 1 && !split[0]) { if (split.length === 1 && !split[0]) {
split.pop(); split.pop();
} }
@@ -122973,8 +122974,8 @@ var path4 = __toESM(require("path"));
var semver4 = __toESM(require_semver2()); var semver4 = __toESM(require_semver2());
// src/defaults.json // src/defaults.json
var bundleVersion = "codeql-bundle-v2.23.4"; var bundleVersion = "codeql-bundle-v2.23.3";
var cliVersion = "2.23.4"; var cliVersion = "2.23.3";
// src/overlay-database-utils.ts // src/overlay-database-utils.ts
var fs3 = __toESM(require("fs")); var fs3 = __toESM(require("fs"));
@@ -123336,12 +123337,6 @@ var featureConfig = {
legacyApi: true, legacyApi: true,
minimumVersion: void 0 minimumVersion: void 0
}, },
["resolve_supported_languages_using_cli" /* ResolveSupportedLanguagesUsingCli */]: {
defaultValue: false,
envVar: "CODEQL_ACTION_RESOLVE_SUPPORTED_LANGUAGES_USING_CLI",
minimumVersion: void 0,
toolsFeature: "builtinExtractorsSpecifyDefaultQueries" /* BuiltinExtractorsSpecifyDefaultQueries */
},
["overlay_analysis" /* OverlayAnalysis */]: { ["overlay_analysis" /* OverlayAnalysis */]: {
defaultValue: false, defaultValue: false,
envVar: "CODEQL_ACTION_OVERLAY_ANALYSIS", envVar: "CODEQL_ACTION_OVERLAY_ANALYSIS",
@@ -127565,7 +127560,6 @@ function filterAlertsByDiffRange(logger, sarif) {
if (!diffRanges?.length) { if (!diffRanges?.length) {
return sarif; return sarif;
} }
const checkoutPath = getRequiredInput("checkout_path");
for (const run2 of sarif.runs) { for (const run2 of sarif.runs) {
if (run2.results) { if (run2.results) {
run2.results = run2.results.filter((result) => { run2.results = run2.results.filter((result) => {
@@ -127579,9 +127573,8 @@ function filterAlertsByDiffRange(logger, sarif) {
if (!locationUri || locationStartLine === void 0) { if (!locationUri || locationStartLine === void 0) {
return false; return false;
} }
const locationPath = path13.join(checkoutPath, locationUri).replaceAll(path13.sep, "/");
return diffRanges.some( return diffRanges.some(
(range) => range.path === locationPath && (range.startLine <= locationStartLine && range.endLine >= locationStartLine || range.startLine === 0 && range.endLine === 0) (range) => range.path === locationUri && (range.startLine <= locationStartLine && range.endLine >= locationStartLine || range.startLine === 0 && range.endLine === 0)
); );
}); });
}); });

35
lib/init-action.js generated
View File

@@ -27680,7 +27680,7 @@ var require_package = __commonJS({
"@ava/typescript": "6.0.0", "@ava/typescript": "6.0.0",
"@eslint/compat": "^1.4.1", "@eslint/compat": "^1.4.1",
"@eslint/eslintrc": "^3.3.1", "@eslint/eslintrc": "^3.3.1",
"@eslint/js": "^9.39.0", "@eslint/js": "^9.39.1",
"@microsoft/eslint-formatter-sarif": "^3.1.0", "@microsoft/eslint-formatter-sarif": "^3.1.0",
"@octokit/types": "^16.0.0", "@octokit/types": "^16.0.0",
"@types/archiver": "^7.0.0", "@types/archiver": "^7.0.0",
@@ -27690,15 +27690,16 @@ var require_package = __commonJS({
"@types/node-forge": "^1.3.14", "@types/node-forge": "^1.3.14",
"@types/semver": "^7.7.1", "@types/semver": "^7.7.1",
"@types/sinon": "^17.0.4", "@types/sinon": "^17.0.4",
"@typescript-eslint/eslint-plugin": "^8.46.3", "@typescript-eslint/eslint-plugin": "^8.46.4",
"@typescript-eslint/parser": "^8.41.0", "@typescript-eslint/parser": "^8.41.0",
ava: "^6.4.1", ava: "^6.4.1",
esbuild: "^0.25.12", esbuild: "^0.27.0",
eslint: "^8.57.1", eslint: "^8.57.1",
"eslint-import-resolver-typescript": "^3.8.7", "eslint-import-resolver-typescript": "^3.8.7",
"eslint-plugin-filenames": "^1.3.2", "eslint-plugin-filenames": "^1.3.2",
"eslint-plugin-github": "^5.1.8", "eslint-plugin-github": "^5.1.8",
"eslint-plugin-import": "2.29.1", "eslint-plugin-import": "2.29.1",
"eslint-plugin-jsdoc": "^61.1.12",
"eslint-plugin-no-async-foreach": "^0.1.1", "eslint-plugin-no-async-foreach": "^0.1.1",
glob: "^11.0.3", glob: "^11.0.3",
nock: "^14.0.10", nock: "^14.0.10",
@@ -84734,14 +84735,14 @@ async function checkDiskUsage(logger) {
} }
} }
function checkActionVersion(version, githubVersion) { function checkActionVersion(version, githubVersion) {
if (!semver.satisfies(version, ">=3") && // do not log error if the customer is already running v3 if (!semver.satisfies(version, ">=4") && // do not log error if the customer is already running v4
!process.env["CODEQL_ACTION_DID_LOG_VERSION_DEPRECATION" /* LOG_VERSION_DEPRECATION */]) { !process.env["CODEQL_ACTION_DID_LOG_VERSION_DEPRECATION" /* LOG_VERSION_DEPRECATION */]) {
if (githubVersion.type === 0 /* DOTCOM */ || githubVersion.type === 2 /* GHE_DOTCOM */ || githubVersion.type === 1 /* GHES */ && semver.satisfies( if (githubVersion.type === 0 /* DOTCOM */ || githubVersion.type === 2 /* GHE_DOTCOM */ || githubVersion.type === 1 /* GHES */ && semver.satisfies(
semver.coerce(githubVersion.version) ?? "0.0.0", semver.coerce(githubVersion.version) ?? "0.0.0",
">=3.11" ">=3.20"
)) { )) {
core3.error( core3.error(
"CodeQL Action major versions v1 and v2 have been deprecated. Please update all occurrences of the CodeQL Action in your workflow files to v3. For more information, see https://github.blog/changelog/2025-01-10-code-scanning-codeql-action-v2-is-now-deprecated/" "CodeQL Action v3 will be deprecated in December 2026. Please update all occurrences of the CodeQL Action in your workflow files to v4. For more information, see https://github.blog/changelog/2025-10-28-upcoming-deprecation-of-codeql-action-v3/"
); );
core3.exportVariable("CODEQL_ACTION_DID_LOG_VERSION_DEPRECATION" /* LOG_VERSION_DEPRECATION */, "true"); core3.exportVariable("CODEQL_ACTION_DID_LOG_VERSION_DEPRECATION" /* LOG_VERSION_DEPRECATION */, "true");
} }
@@ -85627,8 +85628,8 @@ var path5 = __toESM(require("path"));
var semver4 = __toESM(require_semver2()); var semver4 = __toESM(require_semver2());
// src/defaults.json // src/defaults.json
var bundleVersion = "codeql-bundle-v2.23.4"; var bundleVersion = "codeql-bundle-v2.23.3";
var cliVersion = "2.23.4"; var cliVersion = "2.23.3";
// src/overlay-database-utils.ts // src/overlay-database-utils.ts
var crypto = __toESM(require("crypto")); var crypto = __toESM(require("crypto"));
@@ -86098,12 +86099,6 @@ var featureConfig = {
legacyApi: true, legacyApi: true,
minimumVersion: void 0 minimumVersion: void 0
}, },
["resolve_supported_languages_using_cli" /* ResolveSupportedLanguagesUsingCli */]: {
defaultValue: false,
envVar: "CODEQL_ACTION_RESOLVE_SUPPORTED_LANGUAGES_USING_CLI",
minimumVersion: void 0,
toolsFeature: "builtinExtractorsSpecifyDefaultQueries" /* BuiltinExtractorsSpecifyDefaultQueries */
},
["overlay_analysis" /* OverlayAnalysis */]: { ["overlay_analysis" /* OverlayAnalysis */]: {
defaultValue: false, defaultValue: false,
envVar: "CODEQL_ACTION_OVERLAY_ANALYSIS", envVar: "CODEQL_ACTION_OVERLAY_ANALYSIS",
@@ -86649,10 +86644,9 @@ async function cachePrefix(codeql, language) {
} }
// src/config-utils.ts // src/config-utils.ts
async function getSupportedLanguageMap(codeql, features, logger) { async function getSupportedLanguageMap(codeql, logger) {
const resolveSupportedLanguagesUsingCli = await features.getValue( const resolveSupportedLanguagesUsingCli = await codeql.supportsFeature(
"resolve_supported_languages_using_cli" /* ResolveSupportedLanguagesUsingCli */, "builtinExtractorsSpecifyDefaultQueries" /* BuiltinExtractorsSpecifyDefaultQueries */
codeql
); );
const resolveResult = await codeql.betterResolveLanguages({ const resolveResult = await codeql.betterResolveLanguages({
filterToLanguagesWithQueries: resolveSupportedLanguagesUsingCli filterToLanguagesWithQueries: resolveSupportedLanguagesUsingCli
@@ -86700,14 +86694,14 @@ async function getRawLanguagesInRepo(repository, sourceRoot, logger) {
logger.debug(`Raw languages in repository: ${result.join(", ")}`); logger.debug(`Raw languages in repository: ${result.join(", ")}`);
return result; return result;
} }
async function getLanguages(codeql, languagesInput, repository, sourceRoot, features, logger) { async function getLanguages(codeql, languagesInput, repository, sourceRoot, logger) {
const { rawLanguages, autodetected } = await getRawLanguages( const { rawLanguages, autodetected } = await getRawLanguages(
languagesInput, languagesInput,
repository, repository,
sourceRoot, sourceRoot,
logger logger
); );
const languageMap = await getSupportedLanguageMap(codeql, features, logger); const languageMap = await getSupportedLanguageMap(codeql, logger);
const languagesSet = /* @__PURE__ */ new Set(); const languagesSet = /* @__PURE__ */ new Set();
const unknownLanguages = []; const unknownLanguages = [];
for (const language of rawLanguages) { for (const language of rawLanguages) {
@@ -86773,7 +86767,6 @@ async function initActionState({
languagesInput, languagesInput,
repository, repository,
sourceRoot, sourceRoot,
features,
logger logger
); );
const buildMode = await parseBuildModeInput( const buildMode = await parseBuildModeInput(

View File

@@ -27680,7 +27680,7 @@ var require_package = __commonJS({
"@ava/typescript": "6.0.0", "@ava/typescript": "6.0.0",
"@eslint/compat": "^1.4.1", "@eslint/compat": "^1.4.1",
"@eslint/eslintrc": "^3.3.1", "@eslint/eslintrc": "^3.3.1",
"@eslint/js": "^9.39.0", "@eslint/js": "^9.39.1",
"@microsoft/eslint-formatter-sarif": "^3.1.0", "@microsoft/eslint-formatter-sarif": "^3.1.0",
"@octokit/types": "^16.0.0", "@octokit/types": "^16.0.0",
"@types/archiver": "^7.0.0", "@types/archiver": "^7.0.0",
@@ -27690,15 +27690,16 @@ var require_package = __commonJS({
"@types/node-forge": "^1.3.14", "@types/node-forge": "^1.3.14",
"@types/semver": "^7.7.1", "@types/semver": "^7.7.1",
"@types/sinon": "^17.0.4", "@types/sinon": "^17.0.4",
"@typescript-eslint/eslint-plugin": "^8.46.3", "@typescript-eslint/eslint-plugin": "^8.46.4",
"@typescript-eslint/parser": "^8.41.0", "@typescript-eslint/parser": "^8.41.0",
ava: "^6.4.1", ava: "^6.4.1",
esbuild: "^0.25.12", esbuild: "^0.27.0",
eslint: "^8.57.1", eslint: "^8.57.1",
"eslint-import-resolver-typescript": "^3.8.7", "eslint-import-resolver-typescript": "^3.8.7",
"eslint-plugin-filenames": "^1.3.2", "eslint-plugin-filenames": "^1.3.2",
"eslint-plugin-github": "^5.1.8", "eslint-plugin-github": "^5.1.8",
"eslint-plugin-import": "2.29.1", "eslint-plugin-import": "2.29.1",
"eslint-plugin-jsdoc": "^61.1.12",
"eslint-plugin-no-async-foreach": "^0.1.1", "eslint-plugin-no-async-foreach": "^0.1.1",
glob: "^11.0.3", glob: "^11.0.3",
nock: "^14.0.10", nock: "^14.0.10",
@@ -83169,14 +83170,14 @@ async function checkDiskUsage(logger) {
} }
} }
function checkActionVersion(version, githubVersion) { function checkActionVersion(version, githubVersion) {
if (!semver.satisfies(version, ">=3") && // do not log error if the customer is already running v3 if (!semver.satisfies(version, ">=4") && // do not log error if the customer is already running v4
!process.env["CODEQL_ACTION_DID_LOG_VERSION_DEPRECATION" /* LOG_VERSION_DEPRECATION */]) { !process.env["CODEQL_ACTION_DID_LOG_VERSION_DEPRECATION" /* LOG_VERSION_DEPRECATION */]) {
if (githubVersion.type === 0 /* DOTCOM */ || githubVersion.type === 2 /* GHE_DOTCOM */ || githubVersion.type === 1 /* GHES */ && semver.satisfies( if (githubVersion.type === 0 /* DOTCOM */ || githubVersion.type === 2 /* GHE_DOTCOM */ || githubVersion.type === 1 /* GHES */ && semver.satisfies(
semver.coerce(githubVersion.version) ?? "0.0.0", semver.coerce(githubVersion.version) ?? "0.0.0",
">=3.11" ">=3.20"
)) { )) {
core3.error( core3.error(
"CodeQL Action major versions v1 and v2 have been deprecated. Please update all occurrences of the CodeQL Action in your workflow files to v3. For more information, see https://github.blog/changelog/2025-01-10-code-scanning-codeql-action-v2-is-now-deprecated/" "CodeQL Action v3 will be deprecated in December 2026. Please update all occurrences of the CodeQL Action in your workflow files to v4. For more information, see https://github.blog/changelog/2025-10-28-upcoming-deprecation-of-codeql-action-v3/"
); );
core3.exportVariable("CODEQL_ACTION_DID_LOG_VERSION_DEPRECATION" /* LOG_VERSION_DEPRECATION */, "true"); core3.exportVariable("CODEQL_ACTION_DID_LOG_VERSION_DEPRECATION" /* LOG_VERSION_DEPRECATION */, "true");
} }
@@ -83995,12 +83996,6 @@ var featureConfig = {
legacyApi: true, legacyApi: true,
minimumVersion: void 0 minimumVersion: void 0
}, },
["resolve_supported_languages_using_cli" /* ResolveSupportedLanguagesUsingCli */]: {
defaultValue: false,
envVar: "CODEQL_ACTION_RESOLVE_SUPPORTED_LANGUAGES_USING_CLI",
minimumVersion: void 0,
toolsFeature: "builtinExtractorsSpecifyDefaultQueries" /* BuiltinExtractorsSpecifyDefaultQueries */
},
["overlay_analysis" /* OverlayAnalysis */]: { ["overlay_analysis" /* OverlayAnalysis */]: {
defaultValue: false, defaultValue: false,
envVar: "CODEQL_ACTION_OVERLAY_ANALYSIS", envVar: "CODEQL_ACTION_OVERLAY_ANALYSIS",

View File

@@ -27680,7 +27680,7 @@ var require_package = __commonJS({
"@ava/typescript": "6.0.0", "@ava/typescript": "6.0.0",
"@eslint/compat": "^1.4.1", "@eslint/compat": "^1.4.1",
"@eslint/eslintrc": "^3.3.1", "@eslint/eslintrc": "^3.3.1",
"@eslint/js": "^9.39.0", "@eslint/js": "^9.39.1",
"@microsoft/eslint-formatter-sarif": "^3.1.0", "@microsoft/eslint-formatter-sarif": "^3.1.0",
"@octokit/types": "^16.0.0", "@octokit/types": "^16.0.0",
"@types/archiver": "^7.0.0", "@types/archiver": "^7.0.0",
@@ -27690,15 +27690,16 @@ var require_package = __commonJS({
"@types/node-forge": "^1.3.14", "@types/node-forge": "^1.3.14",
"@types/semver": "^7.7.1", "@types/semver": "^7.7.1",
"@types/sinon": "^17.0.4", "@types/sinon": "^17.0.4",
"@typescript-eslint/eslint-plugin": "^8.46.3", "@typescript-eslint/eslint-plugin": "^8.46.4",
"@typescript-eslint/parser": "^8.41.0", "@typescript-eslint/parser": "^8.41.0",
ava: "^6.4.1", ava: "^6.4.1",
esbuild: "^0.25.12", esbuild: "^0.27.0",
eslint: "^8.57.1", eslint: "^8.57.1",
"eslint-import-resolver-typescript": "^3.8.7", "eslint-import-resolver-typescript": "^3.8.7",
"eslint-plugin-filenames": "^1.3.2", "eslint-plugin-filenames": "^1.3.2",
"eslint-plugin-github": "^5.1.8", "eslint-plugin-github": "^5.1.8",
"eslint-plugin-import": "2.29.1", "eslint-plugin-import": "2.29.1",
"eslint-plugin-jsdoc": "^61.1.12",
"eslint-plugin-no-async-foreach": "^0.1.1", "eslint-plugin-no-async-foreach": "^0.1.1",
glob: "^11.0.3", glob: "^11.0.3",
nock: "^14.0.10", nock: "^14.0.10",
@@ -83245,14 +83246,14 @@ async function checkDiskUsage(logger) {
} }
} }
function checkActionVersion(version, githubVersion) { function checkActionVersion(version, githubVersion) {
if (!semver.satisfies(version, ">=3") && // do not log error if the customer is already running v3 if (!semver.satisfies(version, ">=4") && // do not log error if the customer is already running v4
!process.env["CODEQL_ACTION_DID_LOG_VERSION_DEPRECATION" /* LOG_VERSION_DEPRECATION */]) { !process.env["CODEQL_ACTION_DID_LOG_VERSION_DEPRECATION" /* LOG_VERSION_DEPRECATION */]) {
if (githubVersion.type === 0 /* DOTCOM */ || githubVersion.type === 2 /* GHE_DOTCOM */ || githubVersion.type === 1 /* GHES */ && semver.satisfies( if (githubVersion.type === 0 /* DOTCOM */ || githubVersion.type === 2 /* GHE_DOTCOM */ || githubVersion.type === 1 /* GHES */ && semver.satisfies(
semver.coerce(githubVersion.version) ?? "0.0.0", semver.coerce(githubVersion.version) ?? "0.0.0",
">=3.11" ">=3.20"
)) { )) {
core3.error( core3.error(
"CodeQL Action major versions v1 and v2 have been deprecated. Please update all occurrences of the CodeQL Action in your workflow files to v3. For more information, see https://github.blog/changelog/2025-01-10-code-scanning-codeql-action-v2-is-now-deprecated/" "CodeQL Action v3 will be deprecated in December 2026. Please update all occurrences of the CodeQL Action in your workflow files to v4. For more information, see https://github.blog/changelog/2025-10-28-upcoming-deprecation-of-codeql-action-v3/"
); );
core3.exportVariable("CODEQL_ACTION_DID_LOG_VERSION_DEPRECATION" /* LOG_VERSION_DEPRECATION */, "true"); core3.exportVariable("CODEQL_ACTION_DID_LOG_VERSION_DEPRECATION" /* LOG_VERSION_DEPRECATION */, "true");
} }
@@ -83587,8 +83588,8 @@ var path4 = __toESM(require("path"));
var semver3 = __toESM(require_semver2()); var semver3 = __toESM(require_semver2());
// src/defaults.json // src/defaults.json
var bundleVersion = "codeql-bundle-v2.23.4"; var bundleVersion = "codeql-bundle-v2.23.3";
var cliVersion = "2.23.4"; var cliVersion = "2.23.3";
// src/overlay-database-utils.ts // src/overlay-database-utils.ts
var fs3 = __toESM(require("fs")); var fs3 = __toESM(require("fs"));
@@ -83904,12 +83905,6 @@ var featureConfig = {
legacyApi: true, legacyApi: true,
minimumVersion: void 0 minimumVersion: void 0
}, },
["resolve_supported_languages_using_cli" /* ResolveSupportedLanguagesUsingCli */]: {
defaultValue: false,
envVar: "CODEQL_ACTION_RESOLVE_SUPPORTED_LANGUAGES_USING_CLI",
minimumVersion: void 0,
toolsFeature: "builtinExtractorsSpecifyDefaultQueries" /* BuiltinExtractorsSpecifyDefaultQueries */
},
["overlay_analysis" /* OverlayAnalysis */]: { ["overlay_analysis" /* OverlayAnalysis */]: {
defaultValue: false, defaultValue: false,
envVar: "CODEQL_ACTION_OVERLAY_ANALYSIS", envVar: "CODEQL_ACTION_OVERLAY_ANALYSIS",

View File

@@ -27680,7 +27680,7 @@ var require_package = __commonJS({
"@ava/typescript": "6.0.0", "@ava/typescript": "6.0.0",
"@eslint/compat": "^1.4.1", "@eslint/compat": "^1.4.1",
"@eslint/eslintrc": "^3.3.1", "@eslint/eslintrc": "^3.3.1",
"@eslint/js": "^9.39.0", "@eslint/js": "^9.39.1",
"@microsoft/eslint-formatter-sarif": "^3.1.0", "@microsoft/eslint-formatter-sarif": "^3.1.0",
"@octokit/types": "^16.0.0", "@octokit/types": "^16.0.0",
"@types/archiver": "^7.0.0", "@types/archiver": "^7.0.0",
@@ -27690,15 +27690,16 @@ var require_package = __commonJS({
"@types/node-forge": "^1.3.14", "@types/node-forge": "^1.3.14",
"@types/semver": "^7.7.1", "@types/semver": "^7.7.1",
"@types/sinon": "^17.0.4", "@types/sinon": "^17.0.4",
"@typescript-eslint/eslint-plugin": "^8.46.3", "@typescript-eslint/eslint-plugin": "^8.46.4",
"@typescript-eslint/parser": "^8.41.0", "@typescript-eslint/parser": "^8.41.0",
ava: "^6.4.1", ava: "^6.4.1",
esbuild: "^0.25.12", esbuild: "^0.27.0",
eslint: "^8.57.1", eslint: "^8.57.1",
"eslint-import-resolver-typescript": "^3.8.7", "eslint-import-resolver-typescript": "^3.8.7",
"eslint-plugin-filenames": "^1.3.2", "eslint-plugin-filenames": "^1.3.2",
"eslint-plugin-github": "^5.1.8", "eslint-plugin-github": "^5.1.8",
"eslint-plugin-import": "2.29.1", "eslint-plugin-import": "2.29.1",
"eslint-plugin-jsdoc": "^61.1.12",
"eslint-plugin-no-async-foreach": "^0.1.1", "eslint-plugin-no-async-foreach": "^0.1.1",
glob: "^11.0.3", glob: "^11.0.3",
nock: "^14.0.10", nock: "^14.0.10",
@@ -119361,12 +119362,6 @@ var featureConfig = {
legacyApi: true, legacyApi: true,
minimumVersion: void 0 minimumVersion: void 0
}, },
["resolve_supported_languages_using_cli" /* ResolveSupportedLanguagesUsingCli */]: {
defaultValue: false,
envVar: "CODEQL_ACTION_RESOLVE_SUPPORTED_LANGUAGES_USING_CLI",
minimumVersion: void 0,
toolsFeature: "builtinExtractorsSpecifyDefaultQueries" /* BuiltinExtractorsSpecifyDefaultQueries */
},
["overlay_analysis" /* OverlayAnalysis */]: { ["overlay_analysis" /* OverlayAnalysis */]: {
defaultValue: false, defaultValue: false,
envVar: "CODEQL_ACTION_OVERLAY_ANALYSIS", envVar: "CODEQL_ACTION_OVERLAY_ANALYSIS",

View File

@@ -47338,7 +47338,7 @@ var require_package = __commonJS({
"@ava/typescript": "6.0.0", "@ava/typescript": "6.0.0",
"@eslint/compat": "^1.4.1", "@eslint/compat": "^1.4.1",
"@eslint/eslintrc": "^3.3.1", "@eslint/eslintrc": "^3.3.1",
"@eslint/js": "^9.39.0", "@eslint/js": "^9.39.1",
"@microsoft/eslint-formatter-sarif": "^3.1.0", "@microsoft/eslint-formatter-sarif": "^3.1.0",
"@octokit/types": "^16.0.0", "@octokit/types": "^16.0.0",
"@types/archiver": "^7.0.0", "@types/archiver": "^7.0.0",
@@ -47348,15 +47348,16 @@ var require_package = __commonJS({
"@types/node-forge": "^1.3.14", "@types/node-forge": "^1.3.14",
"@types/semver": "^7.7.1", "@types/semver": "^7.7.1",
"@types/sinon": "^17.0.4", "@types/sinon": "^17.0.4",
"@typescript-eslint/eslint-plugin": "^8.46.3", "@typescript-eslint/eslint-plugin": "^8.46.4",
"@typescript-eslint/parser": "^8.41.0", "@typescript-eslint/parser": "^8.41.0",
ava: "^6.4.1", ava: "^6.4.1",
esbuild: "^0.25.12", esbuild: "^0.27.0",
eslint: "^8.57.1", eslint: "^8.57.1",
"eslint-import-resolver-typescript": "^3.8.7", "eslint-import-resolver-typescript": "^3.8.7",
"eslint-plugin-filenames": "^1.3.2", "eslint-plugin-filenames": "^1.3.2",
"eslint-plugin-github": "^5.1.8", "eslint-plugin-github": "^5.1.8",
"eslint-plugin-import": "2.29.1", "eslint-plugin-import": "2.29.1",
"eslint-plugin-jsdoc": "^61.1.12",
"eslint-plugin-no-async-foreach": "^0.1.1", "eslint-plugin-no-async-foreach": "^0.1.1",
glob: "^11.0.3", glob: "^11.0.3",
nock: "^14.0.10", nock: "^14.0.10",
@@ -99682,8 +99683,8 @@ function getActionsLogger() {
var core7 = __toESM(require_core()); var core7 = __toESM(require_core());
// src/defaults.json // src/defaults.json
var bundleVersion = "codeql-bundle-v2.23.4"; var bundleVersion = "codeql-bundle-v2.23.3";
var cliVersion = "2.23.4"; var cliVersion = "2.23.3";
// src/languages.ts // src/languages.ts
var KnownLanguage = /* @__PURE__ */ ((KnownLanguage2) => { var KnownLanguage = /* @__PURE__ */ ((KnownLanguage2) => {
@@ -100023,12 +100024,6 @@ var featureConfig = {
legacyApi: true, legacyApi: true,
minimumVersion: void 0 minimumVersion: void 0
}, },
["resolve_supported_languages_using_cli" /* ResolveSupportedLanguagesUsingCli */]: {
defaultValue: false,
envVar: "CODEQL_ACTION_RESOLVE_SUPPORTED_LANGUAGES_USING_CLI",
minimumVersion: void 0,
toolsFeature: "builtinExtractorsSpecifyDefaultQueries" /* BuiltinExtractorsSpecifyDefaultQueries */
},
["overlay_analysis" /* OverlayAnalysis */]: { ["overlay_analysis" /* OverlayAnalysis */]: {
defaultValue: false, defaultValue: false,
envVar: "CODEQL_ACTION_OVERLAY_ANALYSIS", envVar: "CODEQL_ACTION_OVERLAY_ANALYSIS",

23
lib/upload-lib.js generated
View File

@@ -28977,7 +28977,7 @@ var require_package = __commonJS({
"@ava/typescript": "6.0.0", "@ava/typescript": "6.0.0",
"@eslint/compat": "^1.4.1", "@eslint/compat": "^1.4.1",
"@eslint/eslintrc": "^3.3.1", "@eslint/eslintrc": "^3.3.1",
"@eslint/js": "^9.39.0", "@eslint/js": "^9.39.1",
"@microsoft/eslint-formatter-sarif": "^3.1.0", "@microsoft/eslint-formatter-sarif": "^3.1.0",
"@octokit/types": "^16.0.0", "@octokit/types": "^16.0.0",
"@types/archiver": "^7.0.0", "@types/archiver": "^7.0.0",
@@ -28987,15 +28987,16 @@ var require_package = __commonJS({
"@types/node-forge": "^1.3.14", "@types/node-forge": "^1.3.14",
"@types/semver": "^7.7.1", "@types/semver": "^7.7.1",
"@types/sinon": "^17.0.4", "@types/sinon": "^17.0.4",
"@typescript-eslint/eslint-plugin": "^8.46.3", "@typescript-eslint/eslint-plugin": "^8.46.4",
"@typescript-eslint/parser": "^8.41.0", "@typescript-eslint/parser": "^8.41.0",
ava: "^6.4.1", ava: "^6.4.1",
esbuild: "^0.25.12", esbuild: "^0.27.0",
eslint: "^8.57.1", eslint: "^8.57.1",
"eslint-import-resolver-typescript": "^3.8.7", "eslint-import-resolver-typescript": "^3.8.7",
"eslint-plugin-filenames": "^1.3.2", "eslint-plugin-filenames": "^1.3.2",
"eslint-plugin-github": "^5.1.8", "eslint-plugin-github": "^5.1.8",
"eslint-plugin-import": "2.29.1", "eslint-plugin-import": "2.29.1",
"eslint-plugin-jsdoc": "^61.1.12",
"eslint-plugin-no-async-foreach": "^0.1.1", "eslint-plugin-no-async-foreach": "^0.1.1",
glob: "^11.0.3", glob: "^11.0.3",
nock: "^14.0.10", nock: "^14.0.10",
@@ -83219,6 +83220,7 @@ var upload_lib_exports = {};
__export(upload_lib_exports, { __export(upload_lib_exports, {
InvalidSarifUploadError: () => InvalidSarifUploadError, InvalidSarifUploadError: () => InvalidSarifUploadError,
buildPayload: () => buildPayload, buildPayload: () => buildPayload,
filterAlertsByDiffRange: () => filterAlertsByDiffRange,
findSarifFilesInDir: () => findSarifFilesInDir, findSarifFilesInDir: () => findSarifFilesInDir,
getGroupedSarifFilePaths: () => getGroupedSarifFilePaths, getGroupedSarifFilePaths: () => getGroupedSarifFilePaths,
getSarifFilePaths: () => getSarifFilePaths, getSarifFilePaths: () => getSarifFilePaths,
@@ -86723,8 +86725,8 @@ var path4 = __toESM(require("path"));
var semver4 = __toESM(require_semver2()); var semver4 = __toESM(require_semver2());
// src/defaults.json // src/defaults.json
var bundleVersion = "codeql-bundle-v2.23.4"; var bundleVersion = "codeql-bundle-v2.23.3";
var cliVersion = "2.23.4"; var cliVersion = "2.23.3";
// src/overlay-database-utils.ts // src/overlay-database-utils.ts
var fs3 = __toESM(require("fs")); var fs3 = __toESM(require("fs"));
@@ -87061,12 +87063,6 @@ var featureConfig = {
legacyApi: true, legacyApi: true,
minimumVersion: void 0 minimumVersion: void 0
}, },
["resolve_supported_languages_using_cli" /* ResolveSupportedLanguagesUsingCli */]: {
defaultValue: false,
envVar: "CODEQL_ACTION_RESOLVE_SUPPORTED_LANGUAGES_USING_CLI",
minimumVersion: void 0,
toolsFeature: "builtinExtractorsSpecifyDefaultQueries" /* BuiltinExtractorsSpecifyDefaultQueries */
},
["overlay_analysis" /* OverlayAnalysis */]: { ["overlay_analysis" /* OverlayAnalysis */]: {
defaultValue: false, defaultValue: false,
envVar: "CODEQL_ACTION_OVERLAY_ANALYSIS", envVar: "CODEQL_ACTION_OVERLAY_ANALYSIS",
@@ -90620,7 +90616,6 @@ function filterAlertsByDiffRange(logger, sarif) {
if (!diffRanges?.length) { if (!diffRanges?.length) {
return sarif; return sarif;
} }
const checkoutPath = getRequiredInput("checkout_path");
for (const run of sarif.runs) { for (const run of sarif.runs) {
if (run.results) { if (run.results) {
run.results = run.results.filter((result) => { run.results = run.results.filter((result) => {
@@ -90634,9 +90629,8 @@ function filterAlertsByDiffRange(logger, sarif) {
if (!locationUri || locationStartLine === void 0) { if (!locationUri || locationStartLine === void 0) {
return false; return false;
} }
const locationPath = path10.join(checkoutPath, locationUri).replaceAll(path10.sep, "/");
return diffRanges.some( return diffRanges.some(
(range) => range.path === locationPath && (range.startLine <= locationStartLine && range.endLine >= locationStartLine || range.startLine === 0 && range.endLine === 0) (range) => range.path === locationUri && (range.startLine <= locationStartLine && range.endLine >= locationStartLine || range.startLine === 0 && range.endLine === 0)
); );
}); });
}); });
@@ -90648,6 +90642,7 @@ function filterAlertsByDiffRange(logger, sarif) {
0 && (module.exports = { 0 && (module.exports = {
InvalidSarifUploadError, InvalidSarifUploadError,
buildPayload, buildPayload,
filterAlertsByDiffRange,
findSarifFilesInDir, findSarifFilesInDir,
getGroupedSarifFilePaths, getGroupedSarifFilePaths,
getSarifFilePaths, getSarifFilePaths,

View File

@@ -27680,7 +27680,7 @@ var require_package = __commonJS({
"@ava/typescript": "6.0.0", "@ava/typescript": "6.0.0",
"@eslint/compat": "^1.4.1", "@eslint/compat": "^1.4.1",
"@eslint/eslintrc": "^3.3.1", "@eslint/eslintrc": "^3.3.1",
"@eslint/js": "^9.39.0", "@eslint/js": "^9.39.1",
"@microsoft/eslint-formatter-sarif": "^3.1.0", "@microsoft/eslint-formatter-sarif": "^3.1.0",
"@octokit/types": "^16.0.0", "@octokit/types": "^16.0.0",
"@types/archiver": "^7.0.0", "@types/archiver": "^7.0.0",
@@ -27690,15 +27690,16 @@ var require_package = __commonJS({
"@types/node-forge": "^1.3.14", "@types/node-forge": "^1.3.14",
"@types/semver": "^7.7.1", "@types/semver": "^7.7.1",
"@types/sinon": "^17.0.4", "@types/sinon": "^17.0.4",
"@typescript-eslint/eslint-plugin": "^8.46.3", "@typescript-eslint/eslint-plugin": "^8.46.4",
"@typescript-eslint/parser": "^8.41.0", "@typescript-eslint/parser": "^8.41.0",
ava: "^6.4.1", ava: "^6.4.1",
esbuild: "^0.25.12", esbuild: "^0.27.0",
eslint: "^8.57.1", eslint: "^8.57.1",
"eslint-import-resolver-typescript": "^3.8.7", "eslint-import-resolver-typescript": "^3.8.7",
"eslint-plugin-filenames": "^1.3.2", "eslint-plugin-filenames": "^1.3.2",
"eslint-plugin-github": "^5.1.8", "eslint-plugin-github": "^5.1.8",
"eslint-plugin-import": "2.29.1", "eslint-plugin-import": "2.29.1",
"eslint-plugin-jsdoc": "^61.1.12",
"eslint-plugin-no-async-foreach": "^0.1.1", "eslint-plugin-no-async-foreach": "^0.1.1",
glob: "^11.0.3", glob: "^11.0.3",
nock: "^14.0.10", nock: "^14.0.10",
@@ -119527,12 +119528,6 @@ var featureConfig = {
legacyApi: true, legacyApi: true,
minimumVersion: void 0 minimumVersion: void 0
}, },
["resolve_supported_languages_using_cli" /* ResolveSupportedLanguagesUsingCli */]: {
defaultValue: false,
envVar: "CODEQL_ACTION_RESOLVE_SUPPORTED_LANGUAGES_USING_CLI",
minimumVersion: void 0,
toolsFeature: "builtinExtractorsSpecifyDefaultQueries" /* BuiltinExtractorsSpecifyDefaultQueries */
},
["overlay_analysis" /* OverlayAnalysis */]: { ["overlay_analysis" /* OverlayAnalysis */]: {
defaultValue: false, defaultValue: false,
envVar: "CODEQL_ACTION_OVERLAY_ANALYSIS", envVar: "CODEQL_ACTION_OVERLAY_ANALYSIS",

View File

@@ -27680,7 +27680,7 @@ var require_package = __commonJS({
"@ava/typescript": "6.0.0", "@ava/typescript": "6.0.0",
"@eslint/compat": "^1.4.1", "@eslint/compat": "^1.4.1",
"@eslint/eslintrc": "^3.3.1", "@eslint/eslintrc": "^3.3.1",
"@eslint/js": "^9.39.0", "@eslint/js": "^9.39.1",
"@microsoft/eslint-formatter-sarif": "^3.1.0", "@microsoft/eslint-formatter-sarif": "^3.1.0",
"@octokit/types": "^16.0.0", "@octokit/types": "^16.0.0",
"@types/archiver": "^7.0.0", "@types/archiver": "^7.0.0",
@@ -27690,15 +27690,16 @@ var require_package = __commonJS({
"@types/node-forge": "^1.3.14", "@types/node-forge": "^1.3.14",
"@types/semver": "^7.7.1", "@types/semver": "^7.7.1",
"@types/sinon": "^17.0.4", "@types/sinon": "^17.0.4",
"@typescript-eslint/eslint-plugin": "^8.46.3", "@typescript-eslint/eslint-plugin": "^8.46.4",
"@typescript-eslint/parser": "^8.41.0", "@typescript-eslint/parser": "^8.41.0",
ava: "^6.4.1", ava: "^6.4.1",
esbuild: "^0.25.12", esbuild: "^0.27.0",
eslint: "^8.57.1", eslint: "^8.57.1",
"eslint-import-resolver-typescript": "^3.8.7", "eslint-import-resolver-typescript": "^3.8.7",
"eslint-plugin-filenames": "^1.3.2", "eslint-plugin-filenames": "^1.3.2",
"eslint-plugin-github": "^5.1.8", "eslint-plugin-github": "^5.1.8",
"eslint-plugin-import": "2.29.1", "eslint-plugin-import": "2.29.1",
"eslint-plugin-jsdoc": "^61.1.12",
"eslint-plugin-no-async-foreach": "^0.1.1", "eslint-plugin-no-async-foreach": "^0.1.1",
glob: "^11.0.3", glob: "^11.0.3",
nock: "^14.0.10", nock: "^14.0.10",
@@ -86065,14 +86066,14 @@ async function checkDiskUsage(logger) {
} }
} }
function checkActionVersion(version, githubVersion) { function checkActionVersion(version, githubVersion) {
if (!semver.satisfies(version, ">=3") && // do not log error if the customer is already running v3 if (!semver.satisfies(version, ">=4") && // do not log error if the customer is already running v4
!process.env["CODEQL_ACTION_DID_LOG_VERSION_DEPRECATION" /* LOG_VERSION_DEPRECATION */]) { !process.env["CODEQL_ACTION_DID_LOG_VERSION_DEPRECATION" /* LOG_VERSION_DEPRECATION */]) {
if (githubVersion.type === 0 /* DOTCOM */ || githubVersion.type === 2 /* GHE_DOTCOM */ || githubVersion.type === 1 /* GHES */ && semver.satisfies( if (githubVersion.type === 0 /* DOTCOM */ || githubVersion.type === 2 /* GHE_DOTCOM */ || githubVersion.type === 1 /* GHES */ && semver.satisfies(
semver.coerce(githubVersion.version) ?? "0.0.0", semver.coerce(githubVersion.version) ?? "0.0.0",
">=3.11" ">=3.20"
)) { )) {
core3.error( core3.error(
"CodeQL Action major versions v1 and v2 have been deprecated. Please update all occurrences of the CodeQL Action in your workflow files to v3. For more information, see https://github.blog/changelog/2025-01-10-code-scanning-codeql-action-v2-is-now-deprecated/" "CodeQL Action v3 will be deprecated in December 2026. Please update all occurrences of the CodeQL Action in your workflow files to v4. For more information, see https://github.blog/changelog/2025-10-28-upcoming-deprecation-of-codeql-action-v3/"
); );
core3.exportVariable("CODEQL_ACTION_DID_LOG_VERSION_DEPRECATION" /* LOG_VERSION_DEPRECATION */, "true"); core3.exportVariable("CODEQL_ACTION_DID_LOG_VERSION_DEPRECATION" /* LOG_VERSION_DEPRECATION */, "true");
} }
@@ -86503,8 +86504,8 @@ var path4 = __toESM(require("path"));
var semver3 = __toESM(require_semver2()); var semver3 = __toESM(require_semver2());
// src/defaults.json // src/defaults.json
var bundleVersion = "codeql-bundle-v2.23.4"; var bundleVersion = "codeql-bundle-v2.23.3";
var cliVersion = "2.23.4"; var cliVersion = "2.23.3";
// src/overlay-database-utils.ts // src/overlay-database-utils.ts
var fs3 = __toESM(require("fs")); var fs3 = __toESM(require("fs"));
@@ -86854,12 +86855,6 @@ var featureConfig = {
legacyApi: true, legacyApi: true,
minimumVersion: void 0 minimumVersion: void 0
}, },
["resolve_supported_languages_using_cli" /* ResolveSupportedLanguagesUsingCli */]: {
defaultValue: false,
envVar: "CODEQL_ACTION_RESOLVE_SUPPORTED_LANGUAGES_USING_CLI",
minimumVersion: void 0,
toolsFeature: "builtinExtractorsSpecifyDefaultQueries" /* BuiltinExtractorsSpecifyDefaultQueries */
},
["overlay_analysis" /* OverlayAnalysis */]: { ["overlay_analysis" /* OverlayAnalysis */]: {
defaultValue: false, defaultValue: false,
envVar: "CODEQL_ACTION_OVERLAY_ANALYSIS", envVar: "CODEQL_ACTION_OVERLAY_ANALYSIS",
@@ -91090,7 +91085,6 @@ function filterAlertsByDiffRange(logger, sarif) {
if (!diffRanges?.length) { if (!diffRanges?.length) {
return sarif; return sarif;
} }
const checkoutPath = getRequiredInput("checkout_path");
for (const run2 of sarif.runs) { for (const run2 of sarif.runs) {
if (run2.results) { if (run2.results) {
run2.results = run2.results.filter((result) => { run2.results = run2.results.filter((result) => {
@@ -91104,9 +91098,8 @@ function filterAlertsByDiffRange(logger, sarif) {
if (!locationUri || locationStartLine === void 0) { if (!locationUri || locationStartLine === void 0) {
return false; return false;
} }
const locationPath = path11.join(checkoutPath, locationUri).replaceAll(path11.sep, "/");
return diffRanges.some( return diffRanges.some(
(range) => range.path === locationPath && (range.startLine <= locationStartLine && range.endLine >= locationStartLine || range.startLine === 0 && range.endLine === 0) (range) => range.path === locationUri && (range.startLine <= locationStartLine && range.endLine >= locationStartLine || range.startLine === 0 && range.endLine === 0)
); );
}); });
}); });

726
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -53,7 +53,7 @@
"@ava/typescript": "6.0.0", "@ava/typescript": "6.0.0",
"@eslint/compat": "^1.4.1", "@eslint/compat": "^1.4.1",
"@eslint/eslintrc": "^3.3.1", "@eslint/eslintrc": "^3.3.1",
"@eslint/js": "^9.39.0", "@eslint/js": "^9.39.1",
"@microsoft/eslint-formatter-sarif": "^3.1.0", "@microsoft/eslint-formatter-sarif": "^3.1.0",
"@octokit/types": "^16.0.0", "@octokit/types": "^16.0.0",
"@types/archiver": "^7.0.0", "@types/archiver": "^7.0.0",
@@ -63,15 +63,16 @@
"@types/node-forge": "^1.3.14", "@types/node-forge": "^1.3.14",
"@types/semver": "^7.7.1", "@types/semver": "^7.7.1",
"@types/sinon": "^17.0.4", "@types/sinon": "^17.0.4",
"@typescript-eslint/eslint-plugin": "^8.46.3", "@typescript-eslint/eslint-plugin": "^8.46.4",
"@typescript-eslint/parser": "^8.41.0", "@typescript-eslint/parser": "^8.41.0",
"ava": "^6.4.1", "ava": "^6.4.1",
"esbuild": "^0.25.12", "esbuild": "^0.27.0",
"eslint": "^8.57.1", "eslint": "^8.57.1",
"eslint-import-resolver-typescript": "^3.8.7", "eslint-import-resolver-typescript": "^3.8.7",
"eslint-plugin-filenames": "^1.3.2", "eslint-plugin-filenames": "^1.3.2",
"eslint-plugin-github": "^5.1.8", "eslint-plugin-github": "^5.1.8",
"eslint-plugin-import": "2.29.1", "eslint-plugin-import": "2.29.1",
"eslint-plugin-jsdoc": "^61.1.12",
"eslint-plugin-no-async-foreach": "^0.1.1", "eslint-plugin-no-async-foreach": "^0.1.1",
"glob": "^11.0.3", "glob": "^11.0.3",
"nock": "^14.0.10", "nock": "^14.0.10",

View File

@@ -4,12 +4,14 @@ import * as path from "path";
import test from "ava"; import test from "ava";
import * as sinon from "sinon"; import * as sinon from "sinon";
import * as actionsUtil from "./actions-util";
import { CodeQuality, CodeScanning } from "./analyses"; import { CodeQuality, CodeScanning } from "./analyses";
import { import {
runQueries, runQueries,
defaultSuites, defaultSuites,
resolveQuerySuiteAlias, resolveQuerySuiteAlias,
addSarifExtension, addSarifExtension,
diffRangeExtensionPackContents,
} from "./analyze"; } from "./analyze";
import { createStubCodeQL } from "./codeql"; import { createStubCodeQL } from "./codeql";
import { Feature } from "./feature-flags"; import { Feature } from "./feature-flags";
@@ -158,3 +160,23 @@ test("addSarifExtension", (t) => {
); );
} }
}); });
test("diffRangeExtensionPackContents", (t) => {
sinon
.stub(actionsUtil, "getRequiredInput")
.withArgs("checkout_path")
.returns("/checkout/path");
const output = diffRangeExtensionPackContents([
{
path: "main.js",
startLine: 10,
endLine: 20,
},
]);
const expected = fs.readFileSync(
`${__dirname}/../src/testdata/pr-diff-range.yml`,
"utf8",
);
t.deepEqual(output, expected);
});

View File

@@ -5,7 +5,11 @@ import { performance } from "perf_hooks";
import * as io from "@actions/io"; import * as io from "@actions/io";
import * as yaml from "js-yaml"; import * as yaml from "js-yaml";
import { getTemporaryDirectory, PullRequestBranches } from "./actions-util"; import {
getTemporaryDirectory,
getRequiredInput,
PullRequestBranches,
} from "./actions-util";
import * as analyses from "./analyses"; import * as analyses from "./analyses";
import { setupCppAutobuild } from "./autobuild"; import { setupCppAutobuild } from "./autobuild";
import { type CodeQL } from "./codeql"; import { type CodeQL } from "./codeql";
@@ -38,89 +42,26 @@ export class CodeQLAnalysisError extends Error {
} }
} }
export interface QueriesStatusReport { type KnownLanguageKey = keyof typeof KnownLanguage;
/**
* Time taken in ms to run queries for actions (or undefined if this language was not analyzed).
*
* The "builtin" designation is now outdated with the move to CLI config parsing: this is the time
* taken to run _all_ the queries.
*/
analyze_builtin_queries_actions_duration_ms?: number;
/**
* Time taken in ms to run queries for cpp (or undefined if this language was not analyzed).
*
* The "builtin" designation is now outdated with the move to CLI config parsing: this is the time
* taken to run _all_ the queries.
*/
analyze_builtin_queries_cpp_duration_ms?: number;
/**
* Time taken in ms to run queries for csharp (or undefined if this language was not analyzed).
*
* The "builtin" designation is now outdated with the move to CLI config parsing: this is the time
* taken to run _all_ the queries.
*/
analyze_builtin_queries_csharp_duration_ms?: number;
/**
* Time taken in ms to run queries for go (or undefined if this language was not analyzed).
*
* The "builtin" designation is now outdated with the move to CLI config parsing: this is the time
* taken to run _all_ the queries.
*/
analyze_builtin_queries_go_duration_ms?: number;
/**
* Time taken in ms to run queries for java (or undefined if this language was not analyzed).
*
* The "builtin" designation is now outdated with the move to CLI config parsing: this is the time
* taken to run _all_ the queries.
*/
analyze_builtin_queries_java_duration_ms?: number;
/**
* Time taken in ms to run queries for javascript (or undefined if this language was not analyzed).
*
* The "builtin" designation is now outdated with the move to CLI config parsing: this is the time
* taken to run _all_ the queries.
*/
analyze_builtin_queries_javascript_duration_ms?: number;
/**
* Time taken in ms to run queries for python (or undefined if this language was not analyzed).
*
* The "builtin" designation is now outdated with the move to CLI config parsing: this is the time
* taken to run _all_ the queries.
*/
analyze_builtin_queries_python_duration_ms?: number;
/**
* Time taken in ms to run queries for ruby (or undefined if this language was not analyzed).
*
* The "builtin" designation is now outdated with the move to CLI config parsing: this is the time
* taken to run _all_ the queries.
*/
analyze_builtin_queries_ruby_duration_ms?: number;
/** Time taken in ms to run queries for swift (or undefined if this language was not analyzed).
*
* The "builtin" designation is now outdated with the move to CLI config parsing: this is the time
* taken to run _all_ the queries.
*/
analyze_builtin_queries_swift_duration_ms?: number;
/** Time taken in ms to interpret results for actions (or undefined if this language was not analyzed). */ type RunQueriesDurationStatusReport = {
interpret_results_actions_duration_ms?: number; /**
/** Time taken in ms to interpret results for cpp (or undefined if this language was not analyzed). */ * Time taken in ms to run queries for the language (or undefined if this language was not analyzed).
interpret_results_cpp_duration_ms?: number; *
/** Time taken in ms to interpret results for csharp (or undefined if this language was not analyzed). */ * The "builtin" designation is now outdated with the move to CLI config parsing: this is the time
interpret_results_csharp_duration_ms?: number; * taken to run _all_ the queries.
/** Time taken in ms to interpret results for go (or undefined if this language was not analyzed). */ */
interpret_results_go_duration_ms?: number; [L in KnownLanguageKey as `analyze_builtin_queries_${L}_duration_ms`]?: number;
/** Time taken in ms to interpret results for java (or undefined if this language was not analyzed). */ };
interpret_results_java_duration_ms?: number;
/** Time taken in ms to interpret results for javascript (or undefined if this language was not analyzed). */
interpret_results_javascript_duration_ms?: number;
/** Time taken in ms to interpret results for python (or undefined if this language was not analyzed). */
interpret_results_python_duration_ms?: number;
/** Time taken in ms to interpret results for ruby (or undefined if this language was not analyzed). */
interpret_results_ruby_duration_ms?: number;
/** Time taken in ms to interpret results for swift (or undefined if this language was not analyzed). */
interpret_results_swift_duration_ms?: number;
type InterpretResultsDurationStatusReport = {
/** Time taken in ms to interpret results for the language (or undefined if this language was not analyzed). */
[L in KnownLanguageKey as `interpret_results_${L}_duration_ms`]?: number;
};
export interface QueriesStatusReport
extends RunQueriesDurationStatusReport,
InterpretResultsDurationStatusReport {
/** /**
* Whether the analysis is diff-informed (in the sense that the action generates a diff-range data * Whether the analysis is diff-informed (in the sense that the action generates a diff-range data
* extension for the analysis, regardless of whether the data extension is actually used by queries). * extension for the analysis, regardless of whether the data extension is actually used by queries).
@@ -307,6 +248,45 @@ export async function setupDiffInformedQueryRun(
); );
} }
export function diffRangeExtensionPackContents(
ranges: DiffThunkRange[],
): string {
const header = `
extensions:
- addsTo:
pack: codeql/util
extensible: restrictAlertsTo
checkPresence: false
data:
`;
let data = ranges
.map((range) => {
// Diff-informed queries expect the file path to be absolute. CodeQL always
// uses forward slashes as the path separator, so on Windows we need to
// replace any backslashes with forward slashes.
const filename = path
.join(getRequiredInput("checkout_path"), range.path)
.replaceAll(path.sep, "/");
// Using yaml.dump() with `forceQuotes: true` ensures that all special
// characters are escaped, and that the path is always rendered as a
// quoted string on a single line.
return (
` - [${yaml.dump(filename, { forceQuotes: true }).trim()}, ` +
`${range.startLine}, ${range.endLine}]\n`
);
})
.join("");
if (!data) {
// Ensure that the data extension is not empty, so that a pull request with
// no edited lines would exclude (instead of accepting) all alerts.
data = ' - ["", 0, 0]\n';
}
return header + data;
}
/** /**
* Create an extension pack in the temporary directory that contains the file * Create an extension pack in the temporary directory that contains the file
* line ranges that were added or modified in the pull request. * line ranges that were added or modified in the pull request.
@@ -355,32 +335,7 @@ dataExtensions:
`, `,
); );
const header = ` const extensionContents = diffRangeExtensionPackContents(ranges);
extensions:
- addsTo:
pack: codeql/util
extensible: restrictAlertsTo
checkPresence: false
data:
`;
let data = ranges
.map(
(range) =>
// Using yaml.dump() with `forceQuotes: true` ensures that all special
// characters are escaped, and that the path is always rendered as a
// quoted string on a single line.
` - [${yaml.dump(range.path, { forceQuotes: true }).trim()}, ` +
`${range.startLine}, ${range.endLine}]\n`,
)
.join("");
if (!data) {
// Ensure that the data extension is not empty, so that a pull request with
// no edited lines would exclude (instead of accepting) all alerts.
data = ' - ["", 0, 0]\n';
}
const extensionContents = header + data;
const extensionFilePath = path.join(diffRangeDir, "pr-diff-range.yml"); const extensionFilePath = path.join(diffRangeDir, "pr-diff-range.yml");
fs.writeFileSync(extensionFilePath, extensionContents); fs.writeFileSync(extensionFilePath, extensionContents);
logger.debug( logger.debug(

View File

@@ -1071,8 +1071,11 @@ export async function getCodeQLForCmd(
/** /**
* Gets the options for `path` of `options` as an array of extra option strings. * Gets the options for `path` of `options` as an array of extra option strings.
* *
* @param ignoringOptions Options that should be ignored, for example because they have already * @param paths The CLI command components to get extra options for.
* been passed and it is an error to pass them more than once. * @param args Additional arguments for this function.
* @param args.ignoringOptions
* Options that should be ignored, for example because they have already
* been passed and it is an error to pass them more than once.
*/ */
function getExtraOptionsFromEnv( function getExtraOptionsFromEnv(
paths: string[], paths: string[],
@@ -1154,8 +1157,9 @@ async function runCli(
/** /**
* Writes the code scanning configuration that is to be used by the CLI. * Writes the code scanning configuration that is to be used by the CLI.
* *
* @param codeql The CodeQL object to use. * @param config The CodeQL Action state to write.
* @param config The CodeQL Action state to use. * @param logger The logger to use.
*
* @returns The path to the generated user configuration file. * @returns The path to the generated user configuration file.
*/ */
async function writeCodeScanningConfigFile( async function writeCodeScanningConfigFile(

View File

@@ -873,71 +873,62 @@ const mockRepositoryNwo = parseRepositoryNwo("owner/repo");
expectedLanguages: ["javascript"], expectedLanguages: ["javascript"],
}, },
].forEach((args) => { ].forEach((args) => {
for (const resolveSupportedLanguagesUsingCli of [true, false]) { test(`getLanguages: ${args.name}`, async (t) => {
test(`getLanguages${resolveSupportedLanguagesUsingCli ? " (supported languages via CLI)" : ""}: ${args.name}`, async (t) => { const mockRequest = mockLanguagesInRepo(args.languagesInRepository);
const features = createFeatures( const stubExtractorEntry = {
resolveSupportedLanguagesUsingCli extractor_root: "",
? [Feature.ResolveSupportedLanguagesUsingCli] };
: [], const codeQL = createStubCodeQL({
); betterResolveLanguages: (options) =>
const mockRequest = mockLanguagesInRepo(args.languagesInRepository); Promise.resolve({
const stubExtractorEntry = { aliases: {
extractor_root: "", "c#": KnownLanguage.csharp,
}; c: KnownLanguage.cpp,
const codeQL = createStubCodeQL({ kotlin: KnownLanguage.java,
betterResolveLanguages: (options) => typescript: KnownLanguage.javascript,
Promise.resolve({ },
aliases: { extractors: {
"c#": KnownLanguage.csharp, cpp: [stubExtractorEntry],
c: KnownLanguage.cpp, csharp: [stubExtractorEntry],
kotlin: KnownLanguage.java, java: [stubExtractorEntry],
typescript: KnownLanguage.javascript, javascript: [stubExtractorEntry],
}, python: [stubExtractorEntry],
extractors: { ...(options?.filterToLanguagesWithQueries
cpp: [stubExtractorEntry], ? {}
csharp: [stubExtractorEntry], : {
java: [stubExtractorEntry], html: [stubExtractorEntry],
javascript: [stubExtractorEntry], }),
python: [stubExtractorEntry], },
...(options?.filterToLanguagesWithQueries }),
? {}
: {
html: [stubExtractorEntry],
}),
},
}),
});
if (args.expectedLanguages) {
// happy path
const actualLanguages = await configUtils.getLanguages(
codeQL,
args.languagesInput,
mockRepositoryNwo,
".",
features,
mockLogger,
);
t.deepEqual(actualLanguages.sort(), args.expectedLanguages.sort());
} else {
// there is an error
await t.throwsAsync(
async () =>
await configUtils.getLanguages(
codeQL,
args.languagesInput,
mockRepositoryNwo,
".",
features,
mockLogger,
),
{ message: args.expectedError },
);
}
t.deepEqual(mockRequest.called, args.expectedApiCall);
}); });
}
if (args.expectedLanguages) {
// happy path
const actualLanguages = await configUtils.getLanguages(
codeQL,
args.languagesInput,
mockRepositoryNwo,
".",
mockLogger,
);
t.deepEqual(actualLanguages.sort(), args.expectedLanguages.sort());
} else {
// there is an error
await t.throwsAsync(
async () =>
await configUtils.getLanguages(
codeQL,
args.languagesInput,
mockRepositoryNwo,
".",
mockLogger,
),
{ message: args.expectedError },
);
}
t.deepEqual(mockRequest.called, args.expectedApiCall);
});
}); });
for (const { displayName, language, feature } of [ for (const { displayName, language, feature } of [

View File

@@ -34,6 +34,7 @@ import {
OverlayDatabaseMode, OverlayDatabaseMode,
} from "./overlay-database-utils"; } from "./overlay-database-utils";
import { RepositoryNwo } from "./repository"; import { RepositoryNwo } from "./repository";
import { ToolsFeature } from "./tools-features";
import { downloadTrapCaches } from "./trap-caching"; import { downloadTrapCaches } from "./trap-caching";
import { import {
GitHubVersion, GitHubVersion,
@@ -177,12 +178,10 @@ export interface Config {
export async function getSupportedLanguageMap( export async function getSupportedLanguageMap(
codeql: CodeQL, codeql: CodeQL,
features: FeatureEnablement,
logger: Logger, logger: Logger,
): Promise<Record<string, string>> { ): Promise<Record<string, string>> {
const resolveSupportedLanguagesUsingCli = await features.getValue( const resolveSupportedLanguagesUsingCli = await codeql.supportsFeature(
Feature.ResolveSupportedLanguagesUsingCli, ToolsFeature.BuiltinExtractorsSpecifyDefaultQueries,
codeql,
); );
const resolveResult = await codeql.betterResolveLanguages({ const resolveResult = await codeql.betterResolveLanguages({
filterToLanguagesWithQueries: resolveSupportedLanguagesUsingCli, filterToLanguagesWithQueries: resolveSupportedLanguagesUsingCli,
@@ -283,7 +282,6 @@ export async function getLanguages(
languagesInput: string | undefined, languagesInput: string | undefined,
repository: RepositoryNwo, repository: RepositoryNwo,
sourceRoot: string, sourceRoot: string,
features: FeatureEnablement,
logger: Logger, logger: Logger,
): Promise<Language[]> { ): Promise<Language[]> {
// Obtain languages without filtering them. // Obtain languages without filtering them.
@@ -294,7 +292,7 @@ export async function getLanguages(
logger, logger,
); );
const languageMap = await getSupportedLanguageMap(codeql, features, logger); const languageMap = await getSupportedLanguageMap(codeql, logger);
const languagesSet = new Set<Language>(); const languagesSet = new Set<Language>();
const unknownLanguages: string[] = []; const unknownLanguages: string[] = [];
@@ -431,7 +429,6 @@ export async function initActionState(
languagesInput, languagesInput,
repository, repository,
sourceRoot, sourceRoot,
features,
logger, logger,
); );
@@ -1036,7 +1033,6 @@ export async function getConfig(
* pack. * pack.
* *
* @param registriesInput The value of the `registries` input. * @param registriesInput The value of the `registries` input.
* @param codeQL a codeQL object, used only for checking the version of CodeQL.
* @param tempDir a temporary directory to store the generated qlconfig.yml file. * @param tempDir a temporary directory to store the generated qlconfig.yml file.
* @param logger a logger object. * @param logger a logger object.
* @returns The path to the generated `qlconfig.yml` file and the auth tokens to * @returns The path to the generated `qlconfig.yml` file and the auth tokens to

View File

@@ -160,7 +160,6 @@ const PACK_IDENTIFIER_PATTERN = (function () {
* Version and path are optional. * Version and path are optional.
* *
* @param packStr the package specification to verify. * @param packStr the package specification to verify.
* @param configFile Config file to use for error reporting
*/ */
export function parsePacksSpecification(packStr: string): Pack { export function parsePacksSpecification(packStr: string): Pack {
if (typeof packStr !== "string") { if (typeof packStr !== "string") {

View File

@@ -1,6 +1,6 @@
{ {
"bundleVersion": "codeql-bundle-v2.23.4", "bundleVersion": "codeql-bundle-v2.23.3",
"cliVersion": "2.23.4", "cliVersion": "2.23.3",
"priorBundleVersion": "codeql-bundle-v2.23.3", "priorBundleVersion": "codeql-bundle-v2.23.2",
"priorCliVersion": "2.23.3" "priorCliVersion": "2.23.2"
} }

View File

@@ -188,10 +188,6 @@ test(
); );
function runGetDiffRanges(changes: number, patch: string[] | undefined): any { function runGetDiffRanges(changes: number, patch: string[] | undefined): any {
sinon
.stub(actionsUtil, "getRequiredInput")
.withArgs("checkout_path")
.returns("/checkout/path");
return exportedForTesting.getDiffRanges( return exportedForTesting.getDiffRanges(
{ {
filename: "test.txt", filename: "test.txt",
@@ -211,7 +207,7 @@ test("getDiffRanges: file diff too large", async (t) => {
const diffRanges = runGetDiffRanges(1000000, undefined); const diffRanges = runGetDiffRanges(1000000, undefined);
t.deepEqual(diffRanges, [ t.deepEqual(diffRanges, [
{ {
path: "/checkout/path/test.txt", path: "test.txt",
startLine: 0, startLine: 0,
endLine: 0, endLine: 0,
}, },
@@ -232,7 +228,7 @@ test("getDiffRanges: diff thunk with single addition range", async (t) => {
]); ]);
t.deepEqual(diffRanges, [ t.deepEqual(diffRanges, [
{ {
path: "/checkout/path/test.txt", path: "test.txt",
startLine: 53, startLine: 53,
endLine: 54, endLine: 54,
}, },
@@ -268,7 +264,7 @@ test("getDiffRanges: diff thunk with single update range", async (t) => {
]); ]);
t.deepEqual(diffRanges, [ t.deepEqual(diffRanges, [
{ {
path: "/checkout/path/test.txt", path: "test.txt",
startLine: 53, startLine: 53,
endLine: 53, endLine: 53,
}, },
@@ -290,12 +286,12 @@ test("getDiffRanges: diff thunk with addition ranges", async (t) => {
]); ]);
t.deepEqual(diffRanges, [ t.deepEqual(diffRanges, [
{ {
path: "/checkout/path/test.txt", path: "test.txt",
startLine: 53, startLine: 53,
endLine: 53, endLine: 53,
}, },
{ {
path: "/checkout/path/test.txt", path: "test.txt",
startLine: 55, startLine: 55,
endLine: 55, endLine: 55,
}, },
@@ -322,12 +318,12 @@ test("getDiffRanges: diff thunk with mixed ranges", async (t) => {
]); ]);
t.deepEqual(diffRanges, [ t.deepEqual(diffRanges, [
{ {
path: "/checkout/path/test.txt", path: "test.txt",
startLine: 54, startLine: 54,
endLine: 54, endLine: 54,
}, },
{ {
path: "/checkout/path/test.txt", path: "test.txt",
startLine: 57, startLine: 57,
endLine: 58, endLine: 58,
}, },
@@ -357,12 +353,12 @@ test("getDiffRanges: multiple diff thunks", async (t) => {
]); ]);
t.deepEqual(diffRanges, [ t.deepEqual(diffRanges, [
{ {
path: "/checkout/path/test.txt", path: "test.txt",
startLine: 53, startLine: 53,
endLine: 54, endLine: 54,
}, },
{ {
path: "/checkout/path/test.txt", path: "test.txt",
startLine: 153, startLine: 153,
endLine: 154, endLine: 154,
}, },
@@ -373,7 +369,7 @@ test("getDiffRanges: no diff context lines", async (t) => {
const diffRanges = runGetDiffRanges(2, ["@@ -30 +50,2 @@", "+1", "+2"]); const diffRanges = runGetDiffRanges(2, ["@@ -30 +50,2 @@", "+1", "+2"]);
t.deepEqual(diffRanges, [ t.deepEqual(diffRanges, [
{ {
path: "/checkout/path/test.txt", path: "test.txt",
startLine: 50, startLine: 50,
endLine: 51, endLine: 51,
}, },

View File

@@ -191,13 +191,6 @@ function getDiffRanges(
fileDiff: FileDiff, fileDiff: FileDiff,
logger: Logger, logger: Logger,
): DiffThunkRange[] | undefined { ): DiffThunkRange[] | undefined {
// Diff-informed queries expect the file path to be absolute. CodeQL always
// uses forward slashes as the path separator, so on Windows we need to
// replace any backslashes with forward slashes.
const filename = path
.join(actionsUtil.getRequiredInput("checkout_path"), fileDiff.filename)
.replaceAll(path.sep, "/");
if (fileDiff.patch === undefined) { if (fileDiff.patch === undefined) {
if (fileDiff.changes === 0) { if (fileDiff.changes === 0) {
// There are situations where a changed file legitimately has no diff. // There are situations where a changed file legitimately has no diff.
@@ -212,7 +205,7 @@ function getDiffRanges(
// to a special diff range that covers the entire file. // to a special diff range that covers the entire file.
return [ return [
{ {
path: filename, path: fileDiff.filename,
startLine: 0, startLine: 0,
endLine: 0, endLine: 0,
}, },
@@ -247,7 +240,7 @@ function getDiffRanges(
// Any line that does not start with a "+" or "-" terminates the current // Any line that does not start with a "+" or "-" terminates the current
// range of added lines. // range of added lines.
diffRanges.push({ diffRanges.push({
path: filename, path: fileDiff.filename,
startLine: additionRangeStartLine, startLine: additionRangeStartLine,
endLine: currentLine - 1, endLine: currentLine - 1,
}); });

View File

@@ -76,7 +76,6 @@ export enum Feature {
OverlayAnalysisSwift = "overlay_analysis_swift", OverlayAnalysisSwift = "overlay_analysis_swift",
PythonDefaultIsToNotExtractStdlib = "python_default_is_to_not_extract_stdlib", PythonDefaultIsToNotExtractStdlib = "python_default_is_to_not_extract_stdlib",
QaTelemetryEnabled = "qa_telemetry_enabled", QaTelemetryEnabled = "qa_telemetry_enabled",
ResolveSupportedLanguagesUsingCli = "resolve_supported_languages_using_cli",
UseRepositoryProperties = "use_repository_properties", UseRepositoryProperties = "use_repository_properties",
ValidateDbConfig = "validate_db_config", ValidateDbConfig = "validate_db_config",
} }
@@ -161,12 +160,6 @@ export const featureConfig: Record<
legacyApi: true, legacyApi: true,
minimumVersion: undefined, minimumVersion: undefined,
}, },
[Feature.ResolveSupportedLanguagesUsingCli]: {
defaultValue: false,
envVar: "CODEQL_ACTION_RESOLVE_SUPPORTED_LANGUAGES_USING_CLI",
minimumVersion: undefined,
toolsFeature: ToolsFeature.BuiltinExtractorsSpecifyDefaultQueries,
},
[Feature.OverlayAnalysis]: { [Feature.OverlayAnalysis]: {
defaultValue: false, defaultValue: false,
envVar: "CODEQL_ACTION_OVERLAY_ANALYSIS", envVar: "CODEQL_ACTION_OVERLAY_ANALYSIS",

View File

@@ -252,7 +252,7 @@ export interface EventReport {
* *
* @param actionName The name of the action, e.g. 'init', 'finish', 'upload-sarif' * @param actionName The name of the action, e.g. 'init', 'finish', 'upload-sarif'
* @param status The status. Must be 'success', 'failure', or 'starting' * @param status The status. Must be 'success', 'failure', or 'starting'
* @param startedAt The time this action started executing. * @param actionStartedAt The time this action started executing.
* @param cause Cause of failure (only supply if status is 'failure') * @param cause Cause of failure (only supply if status is 'failure')
* @param exception Exception (only supply if status is 'failure') * @param exception Exception (only supply if status is 'failure')
* @returns undefined if an exception was thrown. * @returns undefined if an exception was thrown.

8
src/testdata/pr-diff-range.yml vendored Normal file
View File

@@ -0,0 +1,8 @@
extensions:
- addsTo:
pack: codeql/util
extensible: restrictAlertsTo
checkPresence: false
data:
- ['/checkout/path/main.js', 10, 20]

View File

@@ -0,0 +1,178 @@
{
"$schema": "https://raw.githubusercontent.com/oasis-tcs/sarif-spec/master/Schemata/sarif-schema-2.1.0.json",
"version": "2.1.0",
"runs": [{
"tool": {
"driver": {
"name": "LGTM.com",
"organization": "Semmle",
"version": "1.24.0-SNAPSHOT",
"rules": [{
"id": "js/unused-local-variable",
"name": "js/unused-local-variable",
"shortDescription": {
"text": "Unused variable, import, function or class"
},
"fullDescription": {
"text": "Unused variables, imports, functions or classes may be a symptom of a bug and should be examined carefully."
},
"defaultConfiguration": {
"level": "note"
},
"properties": {
"tags": ["maintainability"],
"kind": "problem",
"precision": "very-high",
"name": "Unused variable, import, function or class",
"description": "Unused variables, imports, functions or classes may be a symptom of a bug\n and should be examined carefully.",
"id": "js/unused-local-variable",
"problem.severity": "recommendation"
}
}]
}
},
"results": [{
"ruleId": "js/unused-local-variable",
"ruleIndex": 0,
"message": {
"text": "Unused variable foo."
},
"locations": [{
"physicalLocation": {
"artifactLocation": {
"uri": "main.js",
"uriBaseId": "%SRCROOT%",
"index": 0
},
"region": {
"startLine": 2,
"startColumn": 7,
"endColumn": 10
}
}
}],
"partialFingerprints": {
"primaryLocationLineHash": "39fa2ee980eb94b0:1",
"primaryLocationStartColumnFingerprint": "4"
}
}],
"columnKind": "utf16CodeUnits",
"properties": {
"semmle.formatSpecifier": "2.1.0",
"semmle.sourceLanguage": "java"
}
},
{
"tool" : {
"driver" : {
"name" : "CodeQL command-line toolchain",
"organization" : "GitHub",
"semanticVersion" : "2.0.0",
"rules" : [ {
"id" : "js/unused-local-variable",
"name" : "js/unused-local-variable",
"shortDescription" : {
"text" : "Unused variable, import, function or class"
},
"fullDescription" : {
"text" : "Unused variables, imports, functions or classes may be a symptom of a bug and should be examined carefully."
},
"defaultConfiguration" : {
"level": "note"
},
"properties" : {
"tags" : [ "maintainability" ],
"kind" : "problem",
"precision" : "very-high",
"name" : "Unused variable, import, function or class",
"description" : "Unused variables, imports, functions or classes may be a symptom of a bug\n and should be examined carefully.",
"id" : "js/unused-local-variable",
"problem.severity" : "recommendation"
}
},
{
"id": "js/inconsistent-use-of-new",
"name": "js/inconsistent-use-of-new",
"shortDescription": {
"text": "Inconsistent use of 'new'"
},
"fullDescription": {
"text": "If a function is intended to be a constructor, it should always be invoked with 'new'. Otherwise, it should always be invoked as a normal function, that is, without 'new'."
},
"defaultConfiguration": {
"level": "note"
},
"properties": {
"tags": [
"reliability",
"correctness",
"language-features"
],
"kind": "problem",
"precision": "very-high",
"problem.severity": "warning"
}
} ]
}
},
"artifacts" : [ {
"location" : {
"uri" : "main.js",
"uriBaseId" : "%SRCROOT%",
"index" : 0
}
},
{
"location": {
"uri": "src/promiseUtils.js",
"uriBaseId": "%SRCROOT%",
"index": 1
}
},
{
"location": {
"uri": "src/LiveQueryClient.js",
"uriBaseId": "%SRCROOT%",
"index": 2
}
},
{
"location": {
"uri": "src/ParseObject.js",
"uriBaseId": "%SRCROOT%",
"index": 3
}
} ],
"results" : [ {
"ruleId" : "js/unused-local-variable",
"ruleIndex" : 0,
"message" : {
"text" : "Unused variable foo."
},
"locations" : [ {
"physicalLocation" : {
"artifactLocation" : {
"uri" : "main.js",
"uriBaseId" : "%SRCROOT%",
"index" : 0
},
"region" : {
"startLine" : 2,
"startColumn" : 7,
"endColumn" : 10
}
}
} ],
"partialFingerprints" : {
"primaryLocationLineHash" : "39fa2ee980eb94b0:1",
"primaryLocationStartColumnFingerprint" : "4"
}
}],
"newlineSequences" : [ "\r\n", "\n", "", "" ],
"columnKind" : "utf16CodeUnits",
"properties" : {
"semmle.formatSpecifier" : "sarif-latest"
}
}
]
}

View File

@@ -9,10 +9,16 @@ import * as sinon from "sinon";
import * as analyses from "./analyses"; import * as analyses from "./analyses";
import { AnalysisKind, CodeQuality, CodeScanning } from "./analyses"; import { AnalysisKind, CodeQuality, CodeScanning } from "./analyses";
import * as api from "./api-client"; import * as api from "./api-client";
import * as diffUtils from "./diff-informed-analysis-utils";
import { getRunnerLogger, Logger } from "./logging"; import { getRunnerLogger, Logger } from "./logging";
import { setupTests } from "./testing-utils"; import { setupTests } from "./testing-utils";
import * as uploadLib from "./upload-lib"; import * as uploadLib from "./upload-lib";
import { GitHubVariant, initializeEnvironment, withTmpDir } from "./util"; import {
GitHubVariant,
initializeEnvironment,
SarifFile,
withTmpDir,
} from "./util";
setupTests(test); setupTests(test);
@@ -960,3 +966,30 @@ for (const analysis of [CodeScanning, CodeQuality]) {
}); });
}); });
} }
function runFilterAlertsByDiffRange(
input: SarifFile,
diffRanges: diffUtils.DiffThunkRange[],
): SarifFile {
sinon.stub(diffUtils, "readDiffRangesJsonFile").returns(diffRanges);
return uploadLib.filterAlertsByDiffRange(getRunnerLogger(true), input);
}
test("filterAlertsByDiffRange filters out alerts outside diff-range", (t) => {
const input = uploadLib.readSarifFile(
`${__dirname}/../src/testdata/valid-sarif.sarif`,
);
const actualOutput = runFilterAlertsByDiffRange(input, [
{
path: "main.js",
startLine: 1,
endLine: 3,
},
]);
const expectedOutput = uploadLib.readSarifFile(
`${__dirname}/../src/testdata/valid-sarif-diff-filtered.sarif`,
);
t.deepEqual(actualOutput, expectedOutput);
});

View File

@@ -738,7 +738,7 @@ export async function postProcessSarifFiles(
* @param logger The logger to use. * @param logger The logger to use.
* @param pathInput The input provided for `post-processed-sarif-path`. * @param pathInput The input provided for `post-processed-sarif-path`.
* @param uploadTarget The upload target. * @param uploadTarget The upload target.
* @param processingResults The results of post-processing SARIF files. * @param postProcessingResults The results of post-processing SARIF files.
*/ */
export async function writePostProcessedFiles( export async function writePostProcessedFiles(
logger: Logger, logger: Logger,
@@ -1134,14 +1134,15 @@ export class InvalidSarifUploadError extends Error {
} }
} }
function filterAlertsByDiffRange(logger: Logger, sarif: SarifFile): SarifFile { export function filterAlertsByDiffRange(
logger: Logger,
sarif: SarifFile,
): SarifFile {
const diffRanges = readDiffRangesJsonFile(logger); const diffRanges = readDiffRangesJsonFile(logger);
if (!diffRanges?.length) { if (!diffRanges?.length) {
return sarif; return sarif;
} }
const checkoutPath = actionsUtil.getRequiredInput("checkout_path");
for (const run of sarif.runs) { for (const run of sarif.runs) {
if (run.results) { if (run.results) {
run.results = run.results.filter((result) => { run.results = run.results.filter((result) => {
@@ -1156,11 +1157,6 @@ function filterAlertsByDiffRange(logger: Logger, sarif: SarifFile): SarifFile {
if (!locationUri || locationStartLine === undefined) { if (!locationUri || locationStartLine === undefined) {
return false; return false;
} }
// CodeQL always uses forward slashes as the path separator, so on Windows we
// need to replace any backslashes with forward slashes.
const locationPath = path
.join(checkoutPath, locationUri)
.replaceAll(path.sep, "/");
// Alert filtering here replicates the same behavior as the restrictAlertsTo // Alert filtering here replicates the same behavior as the restrictAlertsTo
// extensible predicate in CodeQL. See the restrictAlertsTo documentation // extensible predicate in CodeQL. See the restrictAlertsTo documentation
// https://codeql.github.com/codeql-standard-libraries/csharp/codeql/util/AlertFiltering.qll/predicate.AlertFiltering$restrictAlertsTo.3.html // https://codeql.github.com/codeql-standard-libraries/csharp/codeql/util/AlertFiltering.qll/predicate.AlertFiltering$restrictAlertsTo.3.html
@@ -1168,7 +1164,7 @@ function filterAlertsByDiffRange(logger: Logger, sarif: SarifFile): SarifFile {
// of an alert location. // of an alert location.
return diffRanges.some( return diffRanges.some(
(range) => (range) =>
range.path === locationPath && range.path === locationUri &&
((range.startLine <= locationStartLine && ((range.startLine <= locationStartLine &&
range.endLine >= locationStartLine) || range.endLine >= locationStartLine) ||
(range.startLine === 0 && range.endLine === 0)), (range.startLine === 0 && range.endLine === 0)),

View File

@@ -447,13 +447,21 @@ const CHECK_ACTION_VERSION_TESTS: Array<[string, util.GitHubVersion, boolean]> =
["2.2.1", { type: util.GitHubVariant.DOTCOM }, true], ["2.2.1", { type: util.GitHubVariant.DOTCOM }, true],
["2.2.1", { type: util.GitHubVariant.GHE_DOTCOM }, true], ["2.2.1", { type: util.GitHubVariant.GHE_DOTCOM }, true],
["2.2.1", { type: util.GitHubVariant.GHES, version: "3.10" }, false], ["2.2.1", { type: util.GitHubVariant.GHES, version: "3.10" }, false],
["2.2.1", { type: util.GitHubVariant.GHES, version: "3.11" }, true], ["2.2.1", { type: util.GitHubVariant.GHES, version: "3.11" }, false],
["2.2.1", { type: util.GitHubVariant.GHES, version: "3.12" }, true], ["2.2.1", { type: util.GitHubVariant.GHES, version: "3.12" }, false],
["3.2.1", { type: util.GitHubVariant.DOTCOM }, false], ["3.2.1", { type: util.GitHubVariant.DOTCOM }, true],
["3.2.1", { type: util.GitHubVariant.GHE_DOTCOM }, false], ["3.2.1", { type: util.GitHubVariant.GHE_DOTCOM }, true],
["3.2.1", { type: util.GitHubVariant.GHES, version: "3.10" }, false], ["3.2.1", { type: util.GitHubVariant.GHES, version: "3.10" }, false],
["3.2.1", { type: util.GitHubVariant.GHES, version: "3.11" }, false], ["3.2.1", { type: util.GitHubVariant.GHES, version: "3.11" }, false],
["3.2.1", { type: util.GitHubVariant.GHES, version: "3.12" }, false], ["3.2.1", { type: util.GitHubVariant.GHES, version: "3.12" }, false],
["3.2.1", { type: util.GitHubVariant.GHES, version: "3.19" }, false],
["3.2.1", { type: util.GitHubVariant.GHES, version: "3.20" }, true],
["3.2.1", { type: util.GitHubVariant.GHES, version: "3.21" }, true],
["4.2.1", { type: util.GitHubVariant.DOTCOM }, false],
["4.2.1", { type: util.GitHubVariant.GHE_DOTCOM }, false],
["4.2.1", { type: util.GitHubVariant.GHES, version: "3.19" }, false],
["4.2.1", { type: util.GitHubVariant.GHES, version: "3.20" }, false],
["4.2.1", { type: util.GitHubVariant.GHES, version: "3.21" }, false],
]; ];
for (const [ for (const [
@@ -480,9 +488,7 @@ for (const [
if (shouldReportError) { if (shouldReportError) {
t.true( t.true(
warningSpy.calledOnceWithExactly( warningSpy.calledOnceWithExactly(
sinon.match( sinon.match("CodeQL Action v3 will be deprecated in December 2026."),
"CodeQL Action major versions v1 and v2 have been deprecated.",
),
), ),
); );
} else { } else {

View File

@@ -1114,38 +1114,38 @@ export async function checkDiskUsage(
} }
/** /**
* Prompt the customer to upgrade to CodeQL Action v3, if appropriate. * Prompt the customer to upgrade to CodeQL Action v4, if appropriate.
* *
* Check whether a customer is running v1 or v2. If they are, and we can determine that the GitHub * Check whether a customer is running v3. If they are, and we can determine that the GitHub
* instance supports v3, then log an error prompting the customer to upgrade to v3. * instance supports v4, then log an error prompting the customer to upgrade to v4.
*/ */
export function checkActionVersion( export function checkActionVersion(
version: string, version: string,
githubVersion: GitHubVersion, githubVersion: GitHubVersion,
) { ) {
if ( if (
!semver.satisfies(version, ">=3") && // do not log error if the customer is already running v3 !semver.satisfies(version, ">=4") && // do not log error if the customer is already running v4
!process.env[EnvVar.LOG_VERSION_DEPRECATION] // do not log error if we have already !process.env[EnvVar.LOG_VERSION_DEPRECATION] // do not log error if we have already
) { ) {
// Only error for versions of GHES that are compatible with CodeQL Action version 3. // Only error for versions of GHES that are compatible with CodeQL Action version 4.
// //
// GHES 3.11 shipped without the v3 tag, but it also shipped without this warning message code. // GHES 3.20 is the first version to ship with the v4 tag and this warning message code.
// Therefore users who are seeing this warning message code have pulled in a new version of the // Therefore, users who are seeing this warning message code are running on GHES 3.20 or newer,
// Action, and with it the v3 tag. // and should update to CodeQL Action v4.
if ( if (
githubVersion.type === GitHubVariant.DOTCOM || githubVersion.type === GitHubVariant.DOTCOM ||
githubVersion.type === GitHubVariant.GHE_DOTCOM || githubVersion.type === GitHubVariant.GHE_DOTCOM ||
(githubVersion.type === GitHubVariant.GHES && (githubVersion.type === GitHubVariant.GHES &&
semver.satisfies( semver.satisfies(
semver.coerce(githubVersion.version) ?? "0.0.0", semver.coerce(githubVersion.version) ?? "0.0.0",
">=3.11", ">=3.20",
)) ))
) { ) {
core.error( core.error(
"CodeQL Action major versions v1 and v2 have been deprecated. " + "CodeQL Action v3 will be deprecated in December 2026. " +
"Please update all occurrences of the CodeQL Action in your workflow files to v3. " + "Please update all occurrences of the CodeQL Action in your workflow files to v4. " +
"For more information, see " + "For more information, see " +
"https://github.blog/changelog/2025-01-10-code-scanning-codeql-action-v2-is-now-deprecated/", "https://github.blog/changelog/2025-10-28-upcoming-deprecation-of-codeql-action-v3/",
); );
// set LOG_VERSION_DEPRECATION env var to prevent the warning from being logged multiple times // set LOG_VERSION_DEPRECATION env var to prevent the warning from being logged multiple times
core.exportVariable(EnvVar.LOG_VERSION_DEPRECATION, "true"); core.exportVariable(EnvVar.LOG_VERSION_DEPRECATION, "true");