Compare commits

...

20 Commits

Author SHA1 Message Date
Henry Mercer
6dba00881c Merge pull request #3372 from github/mergeback/v4.31.9-to-main-5d4e8d1a
Mergeback v4.31.9 refs/heads/releases/v4 into main
2025-12-16 19:33:12 +00:00
github-actions[bot]
d4d47c0d3d Rebuild 2025-12-16 18:56:12 +00:00
github-actions[bot]
6c6e810910 Update changelog and version after v4.31.9 2025-12-16 18:32:18 +00:00
Henry Mercer
5d4e8d1aca Merge pull request #3371 from github/update-v4.31.9-998798e34
Merge main into releases/v4
2025-12-16 18:30:42 +00:00
github-actions[bot]
1dc115f17a Update changelog for v4.31.9 2025-12-16 17:45:14 +00:00
Nick Rolfe
998798e34d Merge pull request #3352 from github/nickrolfe/jar-min-ff-cleanup
Clean up `JavaMinimizeDependencyJars` feature flag
2025-12-16 17:25:23 +00:00
Henry Mercer
5eb751966f Merge pull request #3358 from github/henrymercer/database-upload-telemetry
Add status report for uploading databases to API
2025-12-16 16:18:52 +00:00
Nick Rolfe
d29eddb39b Extract version number to constant 2025-12-16 16:17:52 +00:00
Henry Mercer
e9626872ef Merge branch 'main' into henrymercer/database-upload-telemetry 2025-12-16 15:53:31 +00:00
Henry Mercer
19c7f96922 Rename isOverlayBase 2025-12-16 15:41:50 +00:00
Henry Mercer
ae5de9a20d Use getErrorMessage in log too 2025-12-16 15:41:04 +00:00
Henry Mercer
0cb86337c5 Prefer performance.now() 2025-12-16 15:38:29 +00:00
Henry Mercer
c07cc0d3a9 Merge pull request #3351 from github/henrymercer/ghec-dr-determine-tools-version-from-ffs
Determine CodeQL version from feature flags on GHEC-DR
2025-12-16 13:42:01 +00:00
Henry Mercer
a2ee53c0d3 Use full names for GitHub variants 2025-12-16 13:23:24 +00:00
Henry Mercer
5d063dd3af Populate database upload results telemetry 2025-12-15 12:55:12 +00:00
Henry Mercer
8e921c3145 Return status report from cleanupAndUploadDatabases 2025-12-15 12:55:12 +00:00
Nick Rolfe
805b7e1790 Clean up JavaMinimizeDependencyJars feature flag 2025-12-11 10:46:56 +00:00
Henry Mercer
da501245d4 Update PR template to include GHEC-DR 2025-12-10 17:41:20 +00:00
Henry Mercer
1fc7d3785d Rename GHE_DOTCOM to GHEC_DR
This more closely reflects the published naming https://docs.github.com/en/enterprise-cloud@latest/admin/data-residency/about-github-enterprise-cloud-with-data-residency
2025-12-10 17:41:19 +00:00
Henry Mercer
7a55ffeaf1 Determine CodeQL version from feature flags on GHEC-DR 2025-12-10 17:35:27 +00:00
29 changed files with 378 additions and 402 deletions

View File

@@ -34,7 +34,7 @@ Products:
Environments:
- **Dotcom** - Impacts CodeQL workflows on `github.com`.
- **Dotcom** - Impacts CodeQL workflows on `github.com` and/or GitHub Enterprise Cloud with Data Residency.
- **GHES** - Impacts CodeQL workflows on GitHub Enterprise Server.
- **Testing/None** - This change does not impact any CodeQL workflows in production.

View File

@@ -6,6 +6,10 @@ See the [releases page](https://github.com/github/codeql-action/releases) for th
No user facing changes.
## 4.31.9 - 16 Dec 2025
No user facing changes.
## 4.31.8 - 11 Dec 2025
- Update default CodeQL bundle version to 2.23.8. [#3354](https://github.com/github/codeql-action/pull/3354)

View File

@@ -27627,7 +27627,7 @@ var require_package = __commonJS({
"package.json"(exports2, module2) {
module2.exports = {
name: "codeql",
version: "4.31.9",
version: "4.31.10",
private: true,
description: "CodeQL action",
scripts: {
@@ -119255,7 +119255,7 @@ function parseGitHubUrl(inputUrl) {
var CODEQL_ACTION_WARNED_ABOUT_VERSION_ENV_VAR = "CODEQL_ACTION_WARNED_ABOUT_VERSION";
var hasBeenWarnedAboutVersion = false;
function checkGitHubVersionInRange(version, logger) {
if (hasBeenWarnedAboutVersion || version.type !== 1 /* GHES */) {
if (hasBeenWarnedAboutVersion || version.type !== "GitHub Enterprise Server" /* GHES */) {
return;
}
const disallowedAPIVersionReason = apiVersionInRange(
@@ -119457,17 +119457,17 @@ function getApiClient() {
var cachedGitHubVersion = void 0;
async function getGitHubVersionFromApi(apiClient, apiDetails) {
if (parseGitHubUrl(apiDetails.url) === GITHUB_DOTCOM_URL) {
return { type: 0 /* DOTCOM */ };
return { type: "GitHub.com" /* DOTCOM */ };
}
const response = await apiClient.rest.meta.get();
if (response.headers[GITHUB_ENTERPRISE_VERSION_HEADER] === void 0) {
return { type: 0 /* DOTCOM */ };
return { type: "GitHub.com" /* DOTCOM */ };
}
if (response.headers[GITHUB_ENTERPRISE_VERSION_HEADER] === "ghe.com") {
return { type: 2 /* GHE_DOTCOM */ };
return { type: "GitHub Enterprise Cloud with data residency" /* GHEC_DR */ };
}
const version = response.headers[GITHUB_ENTERPRISE_VERSION_HEADER];
return { type: 1 /* GHES */, version };
return { type: "GitHub Enterprise Server" /* GHES */, version };
}
async function getGitHubVersion() {
if (cachedGitHubVersion === void 0) {
@@ -120070,11 +120070,6 @@ var featureConfig = {
legacyApi: true,
minimumVersion: void 0
},
["java_minimize_dependency_jars" /* JavaMinimizeDependencyJars */]: {
defaultValue: false,
envVar: "CODEQL_ACTION_JAVA_MINIMIZE_DEPENDENCY_JARS",
minimumVersion: "2.23.0"
},
["overlay_analysis" /* OverlayAnalysis */]: {
defaultValue: false,
envVar: "CODEQL_ACTION_OVERLAY_ANALYSIS",
@@ -120990,7 +120985,7 @@ async function uploadDebugArtifacts(logger, toUpload, rootDir, artifactName, ghV
}
}
async function getArtifactUploaderClient(logger, ghVariant) {
if (ghVariant === 1 /* GHES */) {
if (ghVariant === "GitHub Enterprise Server" /* GHES */) {
logger.info(
"Debug artifacts can be consumed with `actions/download-artifact@v3` because the `v4` version is not yet compatible on GHES."
);

99
lib/analyze-action.js generated
View File

@@ -27627,7 +27627,7 @@ var require_package = __commonJS({
"package.json"(exports2, module2) {
module2.exports = {
name: "codeql",
version: "4.31.9",
version: "4.31.10",
private: true,
description: "CodeQL action",
scripts: {
@@ -87417,7 +87417,7 @@ async function checkDiskUsage(logger) {
function checkActionVersion(version, githubVersion) {
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 */]) {
if (githubVersion.type === 0 /* DOTCOM */ || githubVersion.type === 2 /* GHE_DOTCOM */ || githubVersion.type === 1 /* GHES */ && semver.satisfies(
if (githubVersion.type === "GitHub.com" /* DOTCOM */ || githubVersion.type === "GitHub Enterprise Cloud with data residency" /* GHEC_DR */ || githubVersion.type === "GitHub Enterprise Server" /* GHES */ && semver.satisfies(
semver.coerce(githubVersion.version) ?? "0.0.0",
">=3.20"
)) {
@@ -87793,17 +87793,17 @@ function getAuthorizationHeaderFor(logger, apiDetails, url2) {
var cachedGitHubVersion = void 0;
async function getGitHubVersionFromApi(apiClient, apiDetails) {
if (parseGitHubUrl(apiDetails.url) === GITHUB_DOTCOM_URL) {
return { type: 0 /* DOTCOM */ };
return { type: "GitHub.com" /* DOTCOM */ };
}
const response = await apiClient.rest.meta.get();
if (response.headers[GITHUB_ENTERPRISE_VERSION_HEADER] === void 0) {
return { type: 0 /* DOTCOM */ };
return { type: "GitHub.com" /* DOTCOM */ };
}
if (response.headers[GITHUB_ENTERPRISE_VERSION_HEADER] === "ghe.com") {
return { type: 2 /* GHE_DOTCOM */ };
return { type: "GitHub Enterprise Cloud with data residency" /* GHEC_DR */ };
}
const version = response.headers[GITHUB_ENTERPRISE_VERSION_HEADER];
return { type: 1 /* GHES */, version };
return { type: "GitHub Enterprise Server" /* GHES */, version };
}
async function getGitHubVersion() {
if (cachedGitHubVersion === void 0) {
@@ -88710,11 +88710,6 @@ var featureConfig = {
legacyApi: true,
minimumVersion: void 0
},
["java_minimize_dependency_jars" /* JavaMinimizeDependencyJars */]: {
defaultValue: false,
envVar: "CODEQL_ACTION_JAVA_MINIMIZE_DEPENDENCY_JARS",
minimumVersion: "2.23.0"
},
["overlay_analysis" /* OverlayAnalysis */]: {
defaultValue: false,
envVar: "CODEQL_ACTION_OVERLAY_ANALYSIS",
@@ -88968,15 +88963,15 @@ var GitHubFeatureFlags = class {
return version;
}
async getDefaultCliVersion(variant) {
if (variant === 0 /* DOTCOM */) {
return await this.getDefaultDotcomCliVersion();
if (supportsFeatureFlags(variant)) {
return await this.getDefaultCliVersionFromFlags();
}
return {
cliVersion,
tagName: bundleVersion
};
}
async getDefaultDotcomCliVersion() {
async getDefaultCliVersionFromFlags() {
const response = await this.getAllFeatures();
const enabledFeatureFlagCliVersions = Object.entries(response).map(
([f, isEnabled]) => isEnabled ? this.getCliVersionFromFeatureFlag(f) : void 0
@@ -89065,7 +89060,7 @@ var GitHubFeatureFlags = class {
}
}
async loadApiResponse() {
if (this.gitHubVersion.type !== 0 /* DOTCOM */ && this.gitHubVersion.type !== 2 /* GHE_DOTCOM */) {
if (!supportsFeatureFlags(this.gitHubVersion.type)) {
this.logger.debug(
"Not running against github.com. Disabling all toggleable features."
);
@@ -89118,6 +89113,9 @@ var GitHubFeatureFlags = class {
}
}
};
function supportsFeatureFlags(githubVariant) {
return githubVariant === "GitHub.com" /* DOTCOM */ || githubVariant === "GitHub Enterprise Cloud with data residency" /* GHEC_DR */;
}
// src/diff-informed-analysis-utils.ts
async function getDiffInformedAnalysisBranches(codeql, features, logger) {
@@ -89125,7 +89123,7 @@ async function getDiffInformedAnalysisBranches(codeql, features, logger) {
return void 0;
}
const gitHubVersion = await getGitHubVersion();
if (gitHubVersion.type === 1 /* GHES */ && satisfiesGHESVersion(gitHubVersion.version, "<3.19", true)) {
if (gitHubVersion.type === "GitHub Enterprise Server" /* GHES */ && satisfiesGHESVersion(gitHubVersion.version, "<3.19", true)) {
return void 0;
}
const branches = getPullRequestBranches();
@@ -90158,7 +90156,7 @@ async function getCodeQLSource(toolsInput, defaultCliVersion, apiDetails, varian
toolsVersion: cliVersion2 ?? humanReadableVersion
};
}
if (variant !== 0 /* DOTCOM */ && !forceShippedTools && !toolsInput) {
if (variant === "GitHub Enterprise Server" /* GHES */ && !forceShippedTools && !toolsInput) {
const result = await findOverridingToolsInCache(
humanReadableVersion,
logger
@@ -91275,15 +91273,7 @@ async function getFeaturePrefix(codeql, features, language) {
enabledFeatures.push(feature);
}
};
if (language === "java" /* java */) {
const minimizeJavaJars = await features.getValue(
"java_minimize_dependency_jars" /* JavaMinimizeDependencyJars */,
codeql
);
if (minimizeJavaJars) {
return "minify-";
}
} else if (language === "csharp" /* csharp */) {
if (language === "csharp" /* csharp */) {
await addFeatureIfEnabled("csharp_new_cache_key" /* CsharpNewCacheKey */);
await addFeatureIfEnabled("csharp_cache_bmn" /* CsharpCacheBuildModeNone */);
}
@@ -91300,11 +91290,7 @@ async function cachePrefix2(codeql, features, language) {
prefix = `${prefix}-${customPrefix}`;
}
const featurePrefix = await getFeaturePrefix(codeql, features, language);
if (featurePrefix === "minify-") {
return `${featurePrefix}${prefix}-${CODEQL_DEPENDENCY_CACHE_VERSION}-${runnerOs}-${language}-`;
} else {
return `${prefix}-${featurePrefix}${CODEQL_DEPENDENCY_CACHE_VERSION}-${runnerOs}-${language}-`;
}
return `${prefix}-${featurePrefix}${CODEQL_DEPENDENCY_CACHE_VERSION}-${runnerOs}-${language}-`;
}
var internal = {
makePatternCheck
@@ -91736,27 +91722,28 @@ var fs13 = __toESM(require("fs"));
async function cleanupAndUploadDatabases(repositoryNwo, codeql, config, apiDetails, features, logger) {
if (getRequiredInput("upload-database") !== "true") {
logger.debug("Database upload disabled in workflow. Skipping upload.");
return;
return [];
}
if (!config.analysisKinds.includes("code-scanning" /* CodeScanning */)) {
logger.debug(
`Not uploading database because 'analysis-kinds: ${"code-scanning" /* CodeScanning */}' is not enabled.`
);
return;
return [];
}
if (isInTestMode()) {
logger.debug("In test mode. Skipping database upload.");
return;
return [];
}
if (config.gitHubVersion.type !== 0 /* DOTCOM */ && config.gitHubVersion.type !== 2 /* GHE_DOTCOM */) {
if (config.gitHubVersion.type !== "GitHub.com" /* DOTCOM */ && config.gitHubVersion.type !== "GitHub Enterprise Cloud with data residency" /* GHEC_DR */) {
logger.debug("Not running against github.com or GHEC-DR. Skipping upload.");
return;
return [];
}
if (!await isAnalyzingDefaultBranch()) {
logger.debug("Not analyzing default branch. Skipping upload.");
return;
return [];
}
const cleanupLevel = config.overlayDatabaseMode === "overlay-base" /* OverlayBase */ && await features.getValue("upload_overlay_db_to_api" /* UploadOverlayDbToApi */) ? "overlay" /* Overlay */ : "clear" /* Clear */;
const shouldUploadOverlayBase = config.overlayDatabaseMode === "overlay-base" /* OverlayBase */ && await features.getValue("upload_overlay_db_to_api" /* UploadOverlayDbToApi */);
const cleanupLevel = shouldUploadOverlayBase ? "overlay" /* Overlay */ : "clear" /* Clear */;
await withGroupAsync("Cleaning up databases", async () => {
await codeql.databaseCleanupCluster(config, cleanupLevel);
});
@@ -91767,6 +91754,7 @@ async function cleanupAndUploadDatabases(repositoryNwo, codeql, config, apiDetai
if (uploadsBaseUrl.endsWith("/")) {
uploadsBaseUrl = uploadsBaseUrl.slice(0, -1);
}
const reports = [];
for (const language of config.languages) {
try {
const bundledDb = await bundleDb(config, language, codeql, language);
@@ -91776,6 +91764,7 @@ async function cleanupAndUploadDatabases(repositoryNwo, codeql, config, apiDetai
getRequiredInput("checkout_path")
);
try {
const startTime = performance.now();
await client.request(
`POST /repos/:owner/:repo/code-scanning/codeql/databases/:language?name=:name&commit_oid=:commit_oid`,
{
@@ -91793,14 +91782,28 @@ async function cleanupAndUploadDatabases(repositoryNwo, codeql, config, apiDetai
}
}
);
const endTime = performance.now();
reports.push({
language,
zipped_upload_size_bytes: bundledDbSize,
is_overlay_base: shouldUploadOverlayBase,
upload_duration_ms: endTime - startTime
});
logger.debug(`Successfully uploaded database for ${language}`);
} finally {
bundledDbReadStream.close();
}
} catch (e) {
logger.warning(`Failed to upload database for ${language}: ${e}`);
logger.warning(
`Failed to upload database for ${language}: ${getErrorMessage(e)}`
);
reports.push({
language,
error: getErrorMessage(e)
});
}
}
return reports;
}
// src/status-report.ts
@@ -93202,7 +93205,7 @@ function areAllRunsUnique(sarifObjects) {
return true;
}
async function shouldShowCombineSarifFilesDeprecationWarning(sarifObjects, githubVersion) {
if (githubVersion.type === 1 /* GHES */ && satisfiesGHESVersion(githubVersion.version, "<3.14", true)) {
if (githubVersion.type === "GitHub Enterprise Server" /* GHES */ && satisfiesGHESVersion(githubVersion.version, "<3.14", true)) {
return false;
}
return !areAllRunsUnique(sarifObjects) && !process.env.CODEQL_MERGE_SARIF_DEPRECATION_WARNING;
@@ -93217,7 +93220,7 @@ async function throwIfCombineSarifFilesDisabled(sarifObjects, githubVersion) {
);
}
async function shouldDisableCombineSarifFiles(sarifObjects, githubVersion) {
if (githubVersion.type === 1 /* GHES */) {
if (githubVersion.type === "GitHub Enterprise Server" /* GHES */) {
if (satisfiesGHESVersion(githubVersion.version, "<3.18", true)) {
return false;
}
@@ -93232,7 +93235,7 @@ async function combineSarifFilesUsingCLI(sarifFiles, gitHubVersion, features, lo
const sarifObjects = sarifFiles.map((sarifFile) => {
return JSON.parse(fs15.readFileSync(sarifFile, "utf8"));
});
const deprecationWarningMessage = gitHubVersion.type === 1 /* GHES */ ? "and will be removed in GitHub Enterprise Server 3.18" : "and will be removed in July 2025";
const deprecationWarningMessage = gitHubVersion.type === "GitHub Enterprise Server" /* GHES */ ? "and will be removed in GitHub Enterprise Server 3.18" : "and will be removed in July 2025";
const deprecationMoreInformationMessage = "For more information, see https://github.blog/changelog/2024-05-06-code-scanning-will-stop-combining-runs-from-a-single-upload";
if (!areAllRunsProducedByCodeQL(sarifObjects)) {
await throwIfCombineSarifFilesDisabled(sarifObjects, gitHubVersion);
@@ -93814,7 +93817,7 @@ async function postProcessAndUploadSarif(logger, features, uploadKind, checkoutP
}
// src/analyze-action.ts
async function sendStatusReport2(startedAt, config, stats, error3, trapCacheUploadTime, dbCreationTimings, didUploadTrapCaches, trapCacheCleanup, dependencyCacheResults, logger) {
async function sendStatusReport2(startedAt, config, stats, error3, trapCacheUploadTime, dbCreationTimings, didUploadTrapCaches, trapCacheCleanup, dependencyCacheResults, databaseUploadResults, logger) {
const status = getActionsStatus(error3, stats?.analyze_failure_language);
const statusReportBase = await createStatusReportBase(
"finish" /* Analyze */,
@@ -93832,7 +93835,8 @@ async function sendStatusReport2(startedAt, config, stats, error3, trapCacheUplo
...stats || {},
...dbCreationTimings || {},
...trapCacheCleanup || {},
dependency_caching_upload_results: dependencyCacheResults
dependency_caching_upload_results: dependencyCacheResults,
database_upload_results: databaseUploadResults
};
if (config && didUploadTrapCaches) {
const trapCacheUploadStatusReport = {
@@ -93914,6 +93918,7 @@ async function run() {
let dbCreationTimings = void 0;
let didUploadTrapCaches = false;
let dependencyCacheResults;
let databaseUploadResults = [];
initializeEnvironment(getActionVersion());
persistInputs();
const logger = getActionsLogger();
@@ -94043,7 +94048,7 @@ async function run() {
logger.info("Not uploading results");
}
await cleanupAndUploadOverlayBaseDatabaseToCache(codeql, config, logger);
await cleanupAndUploadDatabases(
databaseUploadResults = await cleanupAndUploadDatabases(
repositoryNwo,
codeql,
config,
@@ -94097,6 +94102,7 @@ async function run() {
didUploadTrapCaches,
trapCacheCleanupTelemetry,
dependencyCacheResults,
databaseUploadResults,
logger
);
return;
@@ -94115,6 +94121,7 @@ async function run() {
didUploadTrapCaches,
trapCacheCleanupTelemetry,
dependencyCacheResults,
databaseUploadResults,
logger
);
} else if (runStats !== void 0) {
@@ -94128,6 +94135,7 @@ async function run() {
didUploadTrapCaches,
trapCacheCleanupTelemetry,
dependencyCacheResults,
databaseUploadResults,
logger
);
} else {
@@ -94141,6 +94149,7 @@ async function run() {
didUploadTrapCaches,
trapCacheCleanupTelemetry,
dependencyCacheResults,
databaseUploadResults,
logger
);
}

View File

@@ -27627,7 +27627,7 @@ var require_package = __commonJS({
"package.json"(exports2, module2) {
module2.exports = {
name: "codeql",
version: "4.31.9",
version: "4.31.10",
private: true,
description: "CodeQL action",
scripts: {
@@ -83034,7 +83034,7 @@ function parseGitHubUrl(inputUrl) {
var CODEQL_ACTION_WARNED_ABOUT_VERSION_ENV_VAR = "CODEQL_ACTION_WARNED_ABOUT_VERSION";
var hasBeenWarnedAboutVersion = false;
function checkGitHubVersionInRange(version, logger) {
if (hasBeenWarnedAboutVersion || version.type !== 1 /* GHES */) {
if (hasBeenWarnedAboutVersion || version.type !== "GitHub Enterprise Server" /* GHES */) {
return;
}
const disallowedAPIVersionReason = apiVersionInRange(
@@ -83161,7 +83161,7 @@ async function checkDiskUsage(logger) {
function checkActionVersion(version, githubVersion) {
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 */]) {
if (githubVersion.type === 0 /* DOTCOM */ || githubVersion.type === 2 /* GHE_DOTCOM */ || githubVersion.type === 1 /* GHES */ && semver.satisfies(
if (githubVersion.type === "GitHub.com" /* DOTCOM */ || githubVersion.type === "GitHub Enterprise Cloud with data residency" /* GHEC_DR */ || githubVersion.type === "GitHub Enterprise Server" /* GHES */ && semver.satisfies(
semver.coerce(githubVersion.version) ?? "0.0.0",
">=3.20"
)) {
@@ -83367,17 +83367,17 @@ function getApiClient() {
var cachedGitHubVersion = void 0;
async function getGitHubVersionFromApi(apiClient, apiDetails) {
if (parseGitHubUrl(apiDetails.url) === GITHUB_DOTCOM_URL) {
return { type: 0 /* DOTCOM */ };
return { type: "GitHub.com" /* DOTCOM */ };
}
const response = await apiClient.rest.meta.get();
if (response.headers[GITHUB_ENTERPRISE_VERSION_HEADER] === void 0) {
return { type: 0 /* DOTCOM */ };
return { type: "GitHub.com" /* DOTCOM */ };
}
if (response.headers[GITHUB_ENTERPRISE_VERSION_HEADER] === "ghe.com") {
return { type: 2 /* GHE_DOTCOM */ };
return { type: "GitHub Enterprise Cloud with data residency" /* GHEC_DR */ };
}
const version = response.headers[GITHUB_ENTERPRISE_VERSION_HEADER];
return { type: 1 /* GHES */, version };
return { type: "GitHub Enterprise Server" /* GHES */, version };
}
async function getGitHubVersion() {
if (cachedGitHubVersion === void 0) {
@@ -84011,11 +84011,6 @@ var featureConfig = {
legacyApi: true,
minimumVersion: void 0
},
["java_minimize_dependency_jars" /* JavaMinimizeDependencyJars */]: {
defaultValue: false,
envVar: "CODEQL_ACTION_JAVA_MINIMIZE_DEPENDENCY_JARS",
minimumVersion: "2.23.0"
},
["overlay_analysis" /* OverlayAnalysis */]: {
defaultValue: false,
envVar: "CODEQL_ACTION_OVERLAY_ANALYSIS",
@@ -84269,15 +84264,15 @@ var GitHubFeatureFlags = class {
return version;
}
async getDefaultCliVersion(variant) {
if (variant === 0 /* DOTCOM */) {
return await this.getDefaultDotcomCliVersion();
if (supportsFeatureFlags(variant)) {
return await this.getDefaultCliVersionFromFlags();
}
return {
cliVersion,
tagName: bundleVersion
};
}
async getDefaultDotcomCliVersion() {
async getDefaultCliVersionFromFlags() {
const response = await this.getAllFeatures();
const enabledFeatureFlagCliVersions = Object.entries(response).map(
([f, isEnabled]) => isEnabled ? this.getCliVersionFromFeatureFlag(f) : void 0
@@ -84366,7 +84361,7 @@ var GitHubFeatureFlags = class {
}
}
async loadApiResponse() {
if (this.gitHubVersion.type !== 0 /* DOTCOM */ && this.gitHubVersion.type !== 2 /* GHE_DOTCOM */) {
if (!supportsFeatureFlags(this.gitHubVersion.type)) {
this.logger.debug(
"Not running against github.com. Disabling all toggleable features."
);
@@ -84419,6 +84414,9 @@ var GitHubFeatureFlags = class {
}
}
};
function supportsFeatureFlags(githubVariant) {
return githubVariant === "GitHub.com" /* DOTCOM */ || githubVariant === "GitHub Enterprise Cloud with data residency" /* GHEC_DR */;
}
// src/trap-caching.ts
var actionsCache2 = __toESM(require_cache3());

View File

@@ -27627,7 +27627,7 @@ var require_package = __commonJS({
"package.json"(exports2, module2) {
module2.exports = {
name: "codeql",
version: "4.31.9",
version: "4.31.10",
private: true,
description: "CodeQL action",
scripts: {
@@ -122165,7 +122165,7 @@ function parseGitHubUrl(inputUrl) {
var CODEQL_ACTION_WARNED_ABOUT_VERSION_ENV_VAR = "CODEQL_ACTION_WARNED_ABOUT_VERSION";
var hasBeenWarnedAboutVersion = false;
function checkGitHubVersionInRange(version, logger) {
if (hasBeenWarnedAboutVersion || version.type !== 1 /* GHES */) {
if (hasBeenWarnedAboutVersion || version.type !== "GitHub Enterprise Server" /* GHES */) {
return;
}
const disallowedAPIVersionReason = apiVersionInRange(
@@ -122667,17 +122667,17 @@ function getAuthorizationHeaderFor(logger, apiDetails, url2) {
var cachedGitHubVersion = void 0;
async function getGitHubVersionFromApi(apiClient, apiDetails) {
if (parseGitHubUrl(apiDetails.url) === GITHUB_DOTCOM_URL) {
return { type: 0 /* DOTCOM */ };
return { type: "GitHub.com" /* DOTCOM */ };
}
const response = await apiClient.rest.meta.get();
if (response.headers[GITHUB_ENTERPRISE_VERSION_HEADER] === void 0) {
return { type: 0 /* DOTCOM */ };
return { type: "GitHub.com" /* DOTCOM */ };
}
if (response.headers[GITHUB_ENTERPRISE_VERSION_HEADER] === "ghe.com") {
return { type: 2 /* GHE_DOTCOM */ };
return { type: "GitHub Enterprise Cloud with data residency" /* GHEC_DR */ };
}
const version = response.headers[GITHUB_ENTERPRISE_VERSION_HEADER];
return { type: 1 /* GHES */, version };
return { type: "GitHub Enterprise Server" /* GHES */, version };
}
async function getGitHubVersion() {
if (cachedGitHubVersion === void 0) {
@@ -123451,11 +123451,6 @@ var featureConfig = {
legacyApi: true,
minimumVersion: void 0
},
["java_minimize_dependency_jars" /* JavaMinimizeDependencyJars */]: {
defaultValue: false,
envVar: "CODEQL_ACTION_JAVA_MINIMIZE_DEPENDENCY_JARS",
minimumVersion: "2.23.0"
},
["overlay_analysis" /* OverlayAnalysis */]: {
defaultValue: false,
envVar: "CODEQL_ACTION_OVERLAY_ANALYSIS",
@@ -123709,15 +123704,15 @@ var GitHubFeatureFlags = class {
return version;
}
async getDefaultCliVersion(variant) {
if (variant === 0 /* DOTCOM */) {
return await this.getDefaultDotcomCliVersion();
if (supportsFeatureFlags(variant)) {
return await this.getDefaultCliVersionFromFlags();
}
return {
cliVersion,
tagName: bundleVersion
};
}
async getDefaultDotcomCliVersion() {
async getDefaultCliVersionFromFlags() {
const response = await this.getAllFeatures();
const enabledFeatureFlagCliVersions = Object.entries(response).map(
([f, isEnabled]) => isEnabled ? this.getCliVersionFromFeatureFlag(f) : void 0
@@ -123806,7 +123801,7 @@ var GitHubFeatureFlags = class {
}
}
async loadApiResponse() {
if (this.gitHubVersion.type !== 0 /* DOTCOM */ && this.gitHubVersion.type !== 2 /* GHE_DOTCOM */) {
if (!supportsFeatureFlags(this.gitHubVersion.type)) {
this.logger.debug(
"Not running against github.com. Disabling all toggleable features."
);
@@ -123859,6 +123854,9 @@ var GitHubFeatureFlags = class {
}
}
};
function supportsFeatureFlags(githubVariant) {
return githubVariant === "GitHub.com" /* DOTCOM */ || githubVariant === "GitHub Enterprise Cloud with data residency" /* GHEC_DR */;
}
// src/diff-informed-analysis-utils.ts
function getDiffRangesJsonFilePath() {
@@ -124635,7 +124633,7 @@ async function getCodeQLSource(toolsInput, defaultCliVersion, apiDetails, varian
toolsVersion: cliVersion2 ?? humanReadableVersion
};
}
if (variant !== 0 /* DOTCOM */ && !forceShippedTools && !toolsInput) {
if (variant === "GitHub Enterprise Server" /* GHES */ && !forceShippedTools && !toolsInput) {
const result = await findOverridingToolsInCache(
humanReadableVersion,
logger
@@ -125710,7 +125708,7 @@ async function uploadDebugArtifacts(logger, toUpload, rootDir, artifactName, ghV
}
}
async function getArtifactUploaderClient(logger, ghVariant) {
if (ghVariant === 1 /* GHES */) {
if (ghVariant === "GitHub Enterprise Server" /* GHES */) {
logger.info(
"Debug artifacts can be consumed with `actions/download-artifact@v3` because the `v4` version is not yet compatible on GHES."
);
@@ -127184,7 +127182,7 @@ function areAllRunsUnique(sarifObjects) {
return true;
}
async function shouldShowCombineSarifFilesDeprecationWarning(sarifObjects, githubVersion) {
if (githubVersion.type === 1 /* GHES */ && satisfiesGHESVersion(githubVersion.version, "<3.14", true)) {
if (githubVersion.type === "GitHub Enterprise Server" /* GHES */ && satisfiesGHESVersion(githubVersion.version, "<3.14", true)) {
return false;
}
return !areAllRunsUnique(sarifObjects) && !process.env.CODEQL_MERGE_SARIF_DEPRECATION_WARNING;
@@ -127199,7 +127197,7 @@ async function throwIfCombineSarifFilesDisabled(sarifObjects, githubVersion) {
);
}
async function shouldDisableCombineSarifFiles(sarifObjects, githubVersion) {
if (githubVersion.type === 1 /* GHES */) {
if (githubVersion.type === "GitHub Enterprise Server" /* GHES */) {
if (satisfiesGHESVersion(githubVersion.version, "<3.18", true)) {
return false;
}
@@ -127214,7 +127212,7 @@ async function combineSarifFilesUsingCLI(sarifFiles, gitHubVersion, features, lo
const sarifObjects = sarifFiles.map((sarifFile) => {
return JSON.parse(fs14.readFileSync(sarifFile, "utf8"));
});
const deprecationWarningMessage = gitHubVersion.type === 1 /* GHES */ ? "and will be removed in GitHub Enterprise Server 3.18" : "and will be removed in July 2025";
const deprecationWarningMessage = gitHubVersion.type === "GitHub Enterprise Server" /* GHES */ ? "and will be removed in GitHub Enterprise Server 3.18" : "and will be removed in July 2025";
const deprecationMoreInformationMessage = "For more information, see https://github.blog/changelog/2024-05-06-code-scanning-will-stop-combining-runs-from-a-single-upload";
if (!areAllRunsProducedByCodeQL(sarifObjects)) {
await throwIfCombineSarifFilesDisabled(sarifObjects, gitHubVersion);

64
lib/init-action.js generated
View File

@@ -27627,7 +27627,7 @@ var require_package = __commonJS({
"package.json"(exports2, module2) {
module2.exports = {
name: "codeql",
version: "4.31.9",
version: "4.31.10",
private: true,
description: "CodeQL action",
scripts: {
@@ -81567,6 +81567,11 @@ var require_follow_redirects = __commonJS({
});
// src/init-action.ts
var init_action_exports = {};
__export(init_action_exports, {
CODEQL_VERSION_JAR_MINIMIZATION: () => CODEQL_VERSION_JAR_MINIMIZATION
});
module.exports = __toCommonJS(init_action_exports);
var fs14 = __toESM(require("fs"));
var path15 = __toESM(require("path"));
var core13 = __toESM(require_core());
@@ -84534,7 +84539,7 @@ function parseGitHubUrl(inputUrl) {
var CODEQL_ACTION_WARNED_ABOUT_VERSION_ENV_VAR = "CODEQL_ACTION_WARNED_ABOUT_VERSION";
var hasBeenWarnedAboutVersion = false;
function checkGitHubVersionInRange(version, logger) {
if (hasBeenWarnedAboutVersion || version.type !== 1 /* GHES */) {
if (hasBeenWarnedAboutVersion || version.type !== "GitHub Enterprise Server" /* GHES */) {
return;
}
const disallowedAPIVersionReason = apiVersionInRange(
@@ -84738,7 +84743,7 @@ async function checkDiskUsage(logger) {
function checkActionVersion(version, githubVersion) {
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 */]) {
if (githubVersion.type === 0 /* DOTCOM */ || githubVersion.type === 2 /* GHE_DOTCOM */ || githubVersion.type === 1 /* GHES */ && semver.satisfies(
if (githubVersion.type === "GitHub.com" /* DOTCOM */ || githubVersion.type === "GitHub Enterprise Cloud with data residency" /* GHEC_DR */ || githubVersion.type === "GitHub Enterprise Server" /* GHES */ && semver.satisfies(
semver.coerce(githubVersion.version) ?? "0.0.0",
">=3.20"
)) {
@@ -85118,17 +85123,17 @@ function getAuthorizationHeaderFor(logger, apiDetails, url) {
var cachedGitHubVersion = void 0;
async function getGitHubVersionFromApi(apiClient, apiDetails) {
if (parseGitHubUrl(apiDetails.url) === GITHUB_DOTCOM_URL) {
return { type: 0 /* DOTCOM */ };
return { type: "GitHub.com" /* DOTCOM */ };
}
const response = await apiClient.rest.meta.get();
if (response.headers[GITHUB_ENTERPRISE_VERSION_HEADER] === void 0) {
return { type: 0 /* DOTCOM */ };
return { type: "GitHub.com" /* DOTCOM */ };
}
if (response.headers[GITHUB_ENTERPRISE_VERSION_HEADER] === "ghe.com") {
return { type: 2 /* GHE_DOTCOM */ };
return { type: "GitHub Enterprise Cloud with data residency" /* GHEC_DR */ };
}
const version = response.headers[GITHUB_ENTERPRISE_VERSION_HEADER];
return { type: 1 /* GHES */, version };
return { type: "GitHub Enterprise Server" /* GHES */, version };
}
async function getGitHubVersion() {
if (cachedGitHubVersion === void 0) {
@@ -85350,7 +85355,7 @@ var RepositoryPropertyName = /* @__PURE__ */ ((RepositoryPropertyName2) => {
return RepositoryPropertyName2;
})(RepositoryPropertyName || {});
async function loadPropertiesFromApi(gitHubVersion, logger, repositoryNwo) {
if (gitHubVersion.type === 1 /* GHES */) {
if (gitHubVersion.type === "GitHub Enterprise Server" /* GHES */) {
return {};
}
try {
@@ -86124,11 +86129,6 @@ var featureConfig = {
legacyApi: true,
minimumVersion: void 0
},
["java_minimize_dependency_jars" /* JavaMinimizeDependencyJars */]: {
defaultValue: false,
envVar: "CODEQL_ACTION_JAVA_MINIMIZE_DEPENDENCY_JARS",
minimumVersion: "2.23.0"
},
["overlay_analysis" /* OverlayAnalysis */]: {
defaultValue: false,
envVar: "CODEQL_ACTION_OVERLAY_ANALYSIS",
@@ -86382,15 +86382,15 @@ var GitHubFeatureFlags = class {
return version;
}
async getDefaultCliVersion(variant) {
if (variant === 0 /* DOTCOM */) {
return await this.getDefaultDotcomCliVersion();
if (supportsFeatureFlags(variant)) {
return await this.getDefaultCliVersionFromFlags();
}
return {
cliVersion,
tagName: bundleVersion
};
}
async getDefaultDotcomCliVersion() {
async getDefaultCliVersionFromFlags() {
const response = await this.getAllFeatures();
const enabledFeatureFlagCliVersions = Object.entries(response).map(
([f, isEnabled]) => isEnabled ? this.getCliVersionFromFeatureFlag(f) : void 0
@@ -86479,7 +86479,7 @@ var GitHubFeatureFlags = class {
}
}
async loadApiResponse() {
if (this.gitHubVersion.type !== 0 /* DOTCOM */ && this.gitHubVersion.type !== 2 /* GHE_DOTCOM */) {
if (!supportsFeatureFlags(this.gitHubVersion.type)) {
this.logger.debug(
"Not running against github.com. Disabling all toggleable features."
);
@@ -86532,6 +86532,9 @@ var GitHubFeatureFlags = class {
}
}
};
function supportsFeatureFlags(githubVariant) {
return githubVariant === "GitHub.com" /* DOTCOM */ || githubVariant === "GitHub Enterprise Cloud with data residency" /* GHEC_DR */;
}
// src/diff-informed-analysis-utils.ts
async function shouldPerformDiffInformedAnalysis(codeql, features, logger) {
@@ -86542,7 +86545,7 @@ async function getDiffInformedAnalysisBranches(codeql, features, logger) {
return void 0;
}
const gitHubVersion = await getGitHubVersion();
if (gitHubVersion.type === 1 /* GHES */ && satisfiesGHESVersion(gitHubVersion.version, "<3.19", true)) {
if (gitHubVersion.type === "GitHub Enterprise Server" /* GHES */ && satisfiesGHESVersion(gitHubVersion.version, "<3.19", true)) {
return void 0;
}
const branches = getPullRequestBranches();
@@ -87455,15 +87458,7 @@ async function getFeaturePrefix(codeql, features, language) {
enabledFeatures.push(feature);
}
};
if (language === "java" /* java */) {
const minimizeJavaJars = await features.getValue(
"java_minimize_dependency_jars" /* JavaMinimizeDependencyJars */,
codeql
);
if (minimizeJavaJars) {
return "minify-";
}
} else if (language === "csharp" /* csharp */) {
if (language === "csharp" /* csharp */) {
await addFeatureIfEnabled("csharp_new_cache_key" /* CsharpNewCacheKey */);
await addFeatureIfEnabled("csharp_cache_bmn" /* CsharpCacheBuildModeNone */);
}
@@ -87480,11 +87475,7 @@ async function cachePrefix2(codeql, features, language) {
prefix = `${prefix}-${customPrefix}`;
}
const featurePrefix = await getFeaturePrefix(codeql, features, language);
if (featurePrefix === "minify-") {
return `${featurePrefix}${prefix}-${CODEQL_DEPENDENCY_CACHE_VERSION}-${runnerOs}-${language}-`;
} else {
return `${prefix}-${featurePrefix}${CODEQL_DEPENDENCY_CACHE_VERSION}-${runnerOs}-${language}-`;
}
return `${prefix}-${featurePrefix}${CODEQL_DEPENDENCY_CACHE_VERSION}-${runnerOs}-${language}-`;
}
var internal = {
makePatternCheck
@@ -88435,7 +88426,7 @@ async function getCodeQLSource(toolsInput, defaultCliVersion, apiDetails, varian
toolsVersion: cliVersion2 ?? humanReadableVersion
};
}
if (variant !== 0 /* DOTCOM */ && !forceShippedTools && !toolsInput) {
if (variant === "GitHub Enterprise Server" /* GHES */ && !forceShippedTools && !toolsInput) {
const result = await findOverridingToolsInCache(
humanReadableVersion,
logger
@@ -89888,6 +89879,7 @@ var internal2 = {
};
// src/init-action.ts
var CODEQL_VERSION_JAR_MINIMIZATION = "2.23.0";
async function sendStartingStatusReport(startedAt, config, logger) {
const statusReportBase = await createStatusReportBase(
"init" /* Init */,
@@ -90278,7 +90270,7 @@ exec ${goBinaryPath} "$@"`
logger.debug(
`${"CODEQL_EXTRACTOR_JAVA_OPTION_MINIMIZE_DEPENDENCY_JARS" /* JAVA_EXTRACTOR_MINIMIZE_DEPENDENCY_JARS */} is already set to '${process.env["CODEQL_EXTRACTOR_JAVA_OPTION_MINIMIZE_DEPENDENCY_JARS" /* JAVA_EXTRACTOR_MINIMIZE_DEPENDENCY_JARS */]}', so the Action will not override it.`
);
} else if (await features.getValue("java_minimize_dependency_jars" /* JavaMinimizeDependencyJars */, codeql) && config.dependencyCachingEnabled && config.buildMode === "none" /* None */ && config.languages.includes("java" /* java */)) {
} else if (await codeQlVersionAtLeast(codeql, CODEQL_VERSION_JAR_MINIMIZATION) && config.dependencyCachingEnabled && config.buildMode === "none" /* None */ && config.languages.includes("java" /* java */)) {
core13.exportVariable(
"CODEQL_EXTRACTOR_JAVA_OPTION_MINIMIZE_DEPENDENCY_JARS" /* JAVA_EXTRACTOR_MINIMIZE_DEPENDENCY_JARS */,
"true"
@@ -90399,6 +90391,10 @@ async function runWrapper() {
await checkForTimeout();
}
void runWrapper();
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
CODEQL_VERSION_JAR_MINIMIZATION
});
/*! Bundled license information:
undici/lib/fetch/body.js:

View File

@@ -27627,7 +27627,7 @@ var require_package = __commonJS({
"package.json"(exports2, module2) {
module2.exports = {
name: "codeql",
version: "4.31.9",
version: "4.31.10",
private: true,
description: "CodeQL action",
scripts: {
@@ -83034,7 +83034,7 @@ function parseGitHubUrl(inputUrl) {
var CODEQL_ACTION_WARNED_ABOUT_VERSION_ENV_VAR = "CODEQL_ACTION_WARNED_ABOUT_VERSION";
var hasBeenWarnedAboutVersion = false;
function checkGitHubVersionInRange(version, logger) {
if (hasBeenWarnedAboutVersion || version.type !== 1 /* GHES */) {
if (hasBeenWarnedAboutVersion || version.type !== "GitHub Enterprise Server" /* GHES */) {
return;
}
const disallowedAPIVersionReason = apiVersionInRange(
@@ -83173,7 +83173,7 @@ async function checkDiskUsage(logger) {
function checkActionVersion(version, githubVersion) {
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 */]) {
if (githubVersion.type === 0 /* DOTCOM */ || githubVersion.type === 2 /* GHE_DOTCOM */ || githubVersion.type === 1 /* GHES */ && semver.satisfies(
if (githubVersion.type === "GitHub.com" /* DOTCOM */ || githubVersion.type === "GitHub Enterprise Cloud with data residency" /* GHEC_DR */ || githubVersion.type === "GitHub Enterprise Server" /* GHES */ && semver.satisfies(
semver.coerce(githubVersion.version) ?? "0.0.0",
">=3.20"
)) {
@@ -83375,17 +83375,17 @@ function getApiClient() {
var cachedGitHubVersion = void 0;
async function getGitHubVersionFromApi(apiClient, apiDetails) {
if (parseGitHubUrl(apiDetails.url) === GITHUB_DOTCOM_URL) {
return { type: 0 /* DOTCOM */ };
return { type: "GitHub.com" /* DOTCOM */ };
}
const response = await apiClient.rest.meta.get();
if (response.headers[GITHUB_ENTERPRISE_VERSION_HEADER] === void 0) {
return { type: 0 /* DOTCOM */ };
return { type: "GitHub.com" /* DOTCOM */ };
}
if (response.headers[GITHUB_ENTERPRISE_VERSION_HEADER] === "ghe.com") {
return { type: 2 /* GHE_DOTCOM */ };
return { type: "GitHub Enterprise Cloud with data residency" /* GHEC_DR */ };
}
const version = response.headers[GITHUB_ENTERPRISE_VERSION_HEADER];
return { type: 1 /* GHES */, version };
return { type: "GitHub Enterprise Server" /* GHES */, version };
}
async function getGitHubVersion() {
if (cachedGitHubVersion === void 0) {
@@ -84002,11 +84002,6 @@ var featureConfig = {
legacyApi: true,
minimumVersion: void 0
},
["java_minimize_dependency_jars" /* JavaMinimizeDependencyJars */]: {
defaultValue: false,
envVar: "CODEQL_ACTION_JAVA_MINIMIZE_DEPENDENCY_JARS",
minimumVersion: "2.23.0"
},
["overlay_analysis" /* OverlayAnalysis */]: {
defaultValue: false,
envVar: "CODEQL_ACTION_OVERLAY_ANALYSIS",

View File

@@ -27627,7 +27627,7 @@ var require_package = __commonJS({
"package.json"(exports2, module2) {
module2.exports = {
name: "codeql",
version: "4.31.9",
version: "4.31.10",
private: true,
description: "CodeQL action",
scripts: {
@@ -83091,7 +83091,7 @@ function parseGitHubUrl(inputUrl) {
var CODEQL_ACTION_WARNED_ABOUT_VERSION_ENV_VAR = "CODEQL_ACTION_WARNED_ABOUT_VERSION";
var hasBeenWarnedAboutVersion = false;
function checkGitHubVersionInRange(version, logger) {
if (hasBeenWarnedAboutVersion || version.type !== 1 /* GHES */) {
if (hasBeenWarnedAboutVersion || version.type !== "GitHub Enterprise Server" /* GHES */) {
return;
}
const disallowedAPIVersionReason = apiVersionInRange(
@@ -83249,7 +83249,7 @@ async function checkDiskUsage(logger) {
function checkActionVersion(version, githubVersion) {
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 */]) {
if (githubVersion.type === 0 /* DOTCOM */ || githubVersion.type === 2 /* GHE_DOTCOM */ || githubVersion.type === 1 /* GHES */ && semver.satisfies(
if (githubVersion.type === "GitHub.com" /* DOTCOM */ || githubVersion.type === "GitHub Enterprise Cloud with data residency" /* GHEC_DR */ || githubVersion.type === "GitHub Enterprise Server" /* GHES */ && semver.satisfies(
semver.coerce(githubVersion.version) ?? "0.0.0",
">=3.20"
)) {
@@ -83492,17 +83492,17 @@ function getAuthorizationHeaderFor(logger, apiDetails, url) {
var cachedGitHubVersion = void 0;
async function getGitHubVersionFromApi(apiClient, apiDetails) {
if (parseGitHubUrl(apiDetails.url) === GITHUB_DOTCOM_URL) {
return { type: 0 /* DOTCOM */ };
return { type: "GitHub.com" /* DOTCOM */ };
}
const response = await apiClient.rest.meta.get();
if (response.headers[GITHUB_ENTERPRISE_VERSION_HEADER] === void 0) {
return { type: 0 /* DOTCOM */ };
return { type: "GitHub.com" /* DOTCOM */ };
}
if (response.headers[GITHUB_ENTERPRISE_VERSION_HEADER] === "ghe.com") {
return { type: 2 /* GHE_DOTCOM */ };
return { type: "GitHub Enterprise Cloud with data residency" /* GHEC_DR */ };
}
const version = response.headers[GITHUB_ENTERPRISE_VERSION_HEADER];
return { type: 1 /* GHES */, version };
return { type: "GitHub Enterprise Server" /* GHES */, version };
}
async function getGitHubVersion() {
if (cachedGitHubVersion === void 0) {
@@ -83914,11 +83914,6 @@ var featureConfig = {
legacyApi: true,
minimumVersion: void 0
},
["java_minimize_dependency_jars" /* JavaMinimizeDependencyJars */]: {
defaultValue: false,
envVar: "CODEQL_ACTION_JAVA_MINIMIZE_DEPENDENCY_JARS",
minimumVersion: "2.23.0"
},
["overlay_analysis" /* OverlayAnalysis */]: {
defaultValue: false,
envVar: "CODEQL_ACTION_OVERLAY_ANALYSIS",
@@ -84172,15 +84167,15 @@ var GitHubFeatureFlags = class {
return version;
}
async getDefaultCliVersion(variant) {
if (variant === 0 /* DOTCOM */) {
return await this.getDefaultDotcomCliVersion();
if (supportsFeatureFlags(variant)) {
return await this.getDefaultCliVersionFromFlags();
}
return {
cliVersion,
tagName: bundleVersion
};
}
async getDefaultDotcomCliVersion() {
async getDefaultCliVersionFromFlags() {
const response = await this.getAllFeatures();
const enabledFeatureFlagCliVersions = Object.entries(response).map(
([f, isEnabled]) => isEnabled ? this.getCliVersionFromFeatureFlag(f) : void 0
@@ -84269,7 +84264,7 @@ var GitHubFeatureFlags = class {
}
}
async loadApiResponse() {
if (this.gitHubVersion.type !== 0 /* DOTCOM */ && this.gitHubVersion.type !== 2 /* GHE_DOTCOM */) {
if (!supportsFeatureFlags(this.gitHubVersion.type)) {
this.logger.debug(
"Not running against github.com. Disabling all toggleable features."
);
@@ -84322,6 +84317,9 @@ var GitHubFeatureFlags = class {
}
}
};
function supportsFeatureFlags(githubVariant) {
return githubVariant === "GitHub.com" /* DOTCOM */ || githubVariant === "GitHub Enterprise Cloud with data residency" /* GHEC_DR */;
}
// src/init.ts
var toolrunner4 = __toESM(require_toolrunner());
@@ -85267,7 +85265,7 @@ async function getCodeQLSource(toolsInput, defaultCliVersion, apiDetails, varian
toolsVersion: cliVersion2 ?? humanReadableVersion
};
}
if (variant !== 0 /* DOTCOM */ && !forceShippedTools && !toolsInput) {
if (variant === "GitHub Enterprise Server" /* GHES */ && !forceShippedTools && !toolsInput) {
const result = await findOverridingToolsInCache(
humanReadableVersion,
logger

View File

@@ -27627,7 +27627,7 @@ var require_package = __commonJS({
"package.json"(exports2, module2) {
module2.exports = {
name: "codeql",
version: "4.31.9",
version: "4.31.10",
private: true,
description: "CodeQL action",
scripts: {
@@ -119234,7 +119234,7 @@ function parseGitHubUrl(inputUrl) {
var CODEQL_ACTION_WARNED_ABOUT_VERSION_ENV_VAR = "CODEQL_ACTION_WARNED_ABOUT_VERSION";
var hasBeenWarnedAboutVersion = false;
function checkGitHubVersionInRange(version, logger) {
if (hasBeenWarnedAboutVersion || version.type !== 1 /* GHES */) {
if (hasBeenWarnedAboutVersion || version.type !== "GitHub Enterprise Server" /* GHES */) {
return;
}
const disallowedAPIVersionReason = apiVersionInRange(
@@ -119340,17 +119340,17 @@ function getApiClient() {
var cachedGitHubVersion = void 0;
async function getGitHubVersionFromApi(apiClient, apiDetails) {
if (parseGitHubUrl(apiDetails.url) === GITHUB_DOTCOM_URL) {
return { type: 0 /* DOTCOM */ };
return { type: "GitHub.com" /* DOTCOM */ };
}
const response = await apiClient.rest.meta.get();
if (response.headers[GITHUB_ENTERPRISE_VERSION_HEADER] === void 0) {
return { type: 0 /* DOTCOM */ };
return { type: "GitHub.com" /* DOTCOM */ };
}
if (response.headers[GITHUB_ENTERPRISE_VERSION_HEADER] === "ghe.com") {
return { type: 2 /* GHE_DOTCOM */ };
return { type: "GitHub Enterprise Cloud with data residency" /* GHEC_DR */ };
}
const version = response.headers[GITHUB_ENTERPRISE_VERSION_HEADER];
return { type: 1 /* GHES */, version };
return { type: "GitHub Enterprise Server" /* GHES */, version };
}
async function getGitHubVersion() {
if (cachedGitHubVersion === void 0) {
@@ -119476,11 +119476,6 @@ var featureConfig = {
legacyApi: true,
minimumVersion: void 0
},
["java_minimize_dependency_jars" /* JavaMinimizeDependencyJars */]: {
defaultValue: false,
envVar: "CODEQL_ACTION_JAVA_MINIMIZE_DEPENDENCY_JARS",
minimumVersion: "2.23.0"
},
["overlay_analysis" /* OverlayAnalysis */]: {
defaultValue: false,
envVar: "CODEQL_ACTION_OVERLAY_ANALYSIS",
@@ -119853,7 +119848,7 @@ var glob = __toESM(require_glob3());
// src/debug-artifacts.ts
async function getArtifactUploaderClient(logger, ghVariant) {
if (ghVariant === 1 /* GHES */) {
if (ghVariant === "GitHub Enterprise Server" /* GHES */) {
logger.info(
"Debug artifacts can be consumed with `actions/download-artifact@v3` because the `v4` version is not yet compatible on GHES."
);

View File

@@ -47322,7 +47322,7 @@ var require_package = __commonJS({
"package.json"(exports2, module2) {
module2.exports = {
name: "codeql",
version: "4.31.9",
version: "4.31.10",
private: true,
description: "CodeQL action",
scripts: {
@@ -100067,11 +100067,6 @@ var featureConfig = {
legacyApi: true,
minimumVersion: void 0
},
["java_minimize_dependency_jars" /* JavaMinimizeDependencyJars */]: {
defaultValue: false,
envVar: "CODEQL_ACTION_JAVA_MINIMIZE_DEPENDENCY_JARS",
minimumVersion: "2.23.0"
},
["overlay_analysis" /* OverlayAnalysis */]: {
defaultValue: false,
envVar: "CODEQL_ACTION_OVERLAY_ANALYSIS",

23
lib/upload-lib.js generated
View File

@@ -28924,7 +28924,7 @@ var require_package = __commonJS({
"package.json"(exports2, module2) {
module2.exports = {
name: "codeql",
version: "4.31.9",
version: "4.31.10",
private: true,
description: "CodeQL action",
scripts: {
@@ -86348,17 +86348,17 @@ function getAuthorizationHeaderFor(logger, apiDetails, url2) {
var cachedGitHubVersion = void 0;
async function getGitHubVersionFromApi(apiClient, apiDetails) {
if (parseGitHubUrl(apiDetails.url) === GITHUB_DOTCOM_URL) {
return { type: 0 /* DOTCOM */ };
return { type: "GitHub.com" /* DOTCOM */ };
}
const response = await apiClient.rest.meta.get();
if (response.headers[GITHUB_ENTERPRISE_VERSION_HEADER] === void 0) {
return { type: 0 /* DOTCOM */ };
return { type: "GitHub.com" /* DOTCOM */ };
}
if (response.headers[GITHUB_ENTERPRISE_VERSION_HEADER] === "ghe.com") {
return { type: 2 /* GHE_DOTCOM */ };
return { type: "GitHub Enterprise Cloud with data residency" /* GHEC_DR */ };
}
const version = response.headers[GITHUB_ENTERPRISE_VERSION_HEADER];
return { type: 1 /* GHES */, version };
return { type: "GitHub Enterprise Server" /* GHES */, version };
}
async function getGitHubVersion() {
if (cachedGitHubVersion === void 0) {
@@ -87067,11 +87067,6 @@ var featureConfig = {
legacyApi: true,
minimumVersion: void 0
},
["java_minimize_dependency_jars" /* JavaMinimizeDependencyJars */]: {
defaultValue: false,
envVar: "CODEQL_ACTION_JAVA_MINIMIZE_DEPENDENCY_JARS",
minimumVersion: "2.23.0"
},
["overlay_analysis" /* OverlayAnalysis */]: {
defaultValue: false,
envVar: "CODEQL_ACTION_OVERLAY_ANALYSIS",
@@ -87983,7 +87978,7 @@ async function getCodeQLSource(toolsInput, defaultCliVersion, apiDetails, varian
toolsVersion: cliVersion2 ?? humanReadableVersion
};
}
if (variant !== 0 /* DOTCOM */ && !forceShippedTools && !toolsInput) {
if (variant === "GitHub Enterprise Server" /* GHES */ && !forceShippedTools && !toolsInput) {
const result = await findOverridingToolsInCache(
humanReadableVersion,
logger
@@ -90054,7 +90049,7 @@ function areAllRunsUnique(sarifObjects) {
return true;
}
async function shouldShowCombineSarifFilesDeprecationWarning(sarifObjects, githubVersion) {
if (githubVersion.type === 1 /* GHES */ && satisfiesGHESVersion(githubVersion.version, "<3.14", true)) {
if (githubVersion.type === "GitHub Enterprise Server" /* GHES */ && satisfiesGHESVersion(githubVersion.version, "<3.14", true)) {
return false;
}
return !areAllRunsUnique(sarifObjects) && !process.env.CODEQL_MERGE_SARIF_DEPRECATION_WARNING;
@@ -90069,7 +90064,7 @@ async function throwIfCombineSarifFilesDisabled(sarifObjects, githubVersion) {
);
}
async function shouldDisableCombineSarifFiles(sarifObjects, githubVersion) {
if (githubVersion.type === 1 /* GHES */) {
if (githubVersion.type === "GitHub Enterprise Server" /* GHES */) {
if (satisfiesGHESVersion(githubVersion.version, "<3.18", true)) {
return false;
}
@@ -90084,7 +90079,7 @@ async function combineSarifFilesUsingCLI(sarifFiles, gitHubVersion, features, lo
const sarifObjects = sarifFiles.map((sarifFile) => {
return JSON.parse(fs11.readFileSync(sarifFile, "utf8"));
});
const deprecationWarningMessage = gitHubVersion.type === 1 /* GHES */ ? "and will be removed in GitHub Enterprise Server 3.18" : "and will be removed in July 2025";
const deprecationWarningMessage = gitHubVersion.type === "GitHub Enterprise Server" /* GHES */ ? "and will be removed in GitHub Enterprise Server 3.18" : "and will be removed in July 2025";
const deprecationMoreInformationMessage = "For more information, see https://github.blog/changelog/2024-05-06-code-scanning-will-stop-combining-runs-from-a-single-upload";
if (!areAllRunsProducedByCodeQL(sarifObjects)) {
await throwIfCombineSarifFilesDisabled(sarifObjects, gitHubVersion);

View File

@@ -27627,7 +27627,7 @@ var require_package = __commonJS({
"package.json"(exports2, module2) {
module2.exports = {
name: "codeql",
version: "4.31.9",
version: "4.31.10",
private: true,
description: "CodeQL action",
scripts: {
@@ -119234,7 +119234,7 @@ function parseGitHubUrl(inputUrl) {
var CODEQL_ACTION_WARNED_ABOUT_VERSION_ENV_VAR = "CODEQL_ACTION_WARNED_ABOUT_VERSION";
var hasBeenWarnedAboutVersion = false;
function checkGitHubVersionInRange(version, logger) {
if (hasBeenWarnedAboutVersion || version.type !== 1 /* GHES */) {
if (hasBeenWarnedAboutVersion || version.type !== "GitHub Enterprise Server" /* GHES */) {
return;
}
const disallowedAPIVersionReason = apiVersionInRange(
@@ -119344,17 +119344,17 @@ function getApiClient() {
var cachedGitHubVersion = void 0;
async function getGitHubVersionFromApi(apiClient, apiDetails) {
if (parseGitHubUrl(apiDetails.url) === GITHUB_DOTCOM_URL) {
return { type: 0 /* DOTCOM */ };
return { type: "GitHub.com" /* DOTCOM */ };
}
const response = await apiClient.rest.meta.get();
if (response.headers[GITHUB_ENTERPRISE_VERSION_HEADER] === void 0) {
return { type: 0 /* DOTCOM */ };
return { type: "GitHub.com" /* DOTCOM */ };
}
if (response.headers[GITHUB_ENTERPRISE_VERSION_HEADER] === "ghe.com") {
return { type: 2 /* GHE_DOTCOM */ };
return { type: "GitHub Enterprise Cloud with data residency" /* GHEC_DR */ };
}
const version = response.headers[GITHUB_ENTERPRISE_VERSION_HEADER];
return { type: 1 /* GHES */, version };
return { type: "GitHub Enterprise Server" /* GHES */, version };
}
async function getGitHubVersion() {
if (cachedGitHubVersion === void 0) {
@@ -119642,11 +119642,6 @@ var featureConfig = {
legacyApi: true,
minimumVersion: void 0
},
["java_minimize_dependency_jars" /* JavaMinimizeDependencyJars */]: {
defaultValue: false,
envVar: "CODEQL_ACTION_JAVA_MINIMIZE_DEPENDENCY_JARS",
minimumVersion: "2.23.0"
},
["overlay_analysis" /* OverlayAnalysis */]: {
defaultValue: false,
envVar: "CODEQL_ACTION_OVERLAY_ANALYSIS",
@@ -119925,7 +119920,7 @@ async function uploadDebugArtifacts(logger, toUpload, rootDir, artifactName, ghV
}
}
async function getArtifactUploaderClient(logger, ghVariant) {
if (ghVariant === 1 /* GHES */) {
if (ghVariant === "GitHub Enterprise Server" /* GHES */) {
logger.info(
"Debug artifacts can be consumed with `actions/download-artifact@v3` because the `v4` version is not yet compatible on GHES."
);

View File

@@ -27627,7 +27627,7 @@ var require_package = __commonJS({
"package.json"(exports2, module2) {
module2.exports = {
name: "codeql",
version: "4.31.9",
version: "4.31.10",
private: true,
description: "CodeQL action",
scripts: {
@@ -86069,7 +86069,7 @@ async function checkDiskUsage(logger) {
function checkActionVersion(version, githubVersion) {
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 */]) {
if (githubVersion.type === 0 /* DOTCOM */ || githubVersion.type === 2 /* GHE_DOTCOM */ || githubVersion.type === 1 /* GHES */ && semver.satisfies(
if (githubVersion.type === "GitHub.com" /* DOTCOM */ || githubVersion.type === "GitHub Enterprise Cloud with data residency" /* GHEC_DR */ || githubVersion.type === "GitHub Enterprise Server" /* GHES */ && semver.satisfies(
semver.coerce(githubVersion.version) ?? "0.0.0",
">=3.20"
)) {
@@ -86394,17 +86394,17 @@ function getAuthorizationHeaderFor(logger, apiDetails, url2) {
var cachedGitHubVersion = void 0;
async function getGitHubVersionFromApi(apiClient, apiDetails) {
if (parseGitHubUrl(apiDetails.url) === GITHUB_DOTCOM_URL) {
return { type: 0 /* DOTCOM */ };
return { type: "GitHub.com" /* DOTCOM */ };
}
const response = await apiClient.rest.meta.get();
if (response.headers[GITHUB_ENTERPRISE_VERSION_HEADER] === void 0) {
return { type: 0 /* DOTCOM */ };
return { type: "GitHub.com" /* DOTCOM */ };
}
if (response.headers[GITHUB_ENTERPRISE_VERSION_HEADER] === "ghe.com") {
return { type: 2 /* GHE_DOTCOM */ };
return { type: "GitHub Enterprise Cloud with data residency" /* GHEC_DR */ };
}
const version = response.headers[GITHUB_ENTERPRISE_VERSION_HEADER];
return { type: 1 /* GHES */, version };
return { type: "GitHub Enterprise Server" /* GHES */, version };
}
async function getGitHubVersion() {
if (cachedGitHubVersion === void 0) {
@@ -86864,11 +86864,6 @@ var featureConfig = {
legacyApi: true,
minimumVersion: void 0
},
["java_minimize_dependency_jars" /* JavaMinimizeDependencyJars */]: {
defaultValue: false,
envVar: "CODEQL_ACTION_JAVA_MINIMIZE_DEPENDENCY_JARS",
minimumVersion: "2.23.0"
},
["overlay_analysis" /* OverlayAnalysis */]: {
defaultValue: false,
envVar: "CODEQL_ACTION_OVERLAY_ANALYSIS",
@@ -87122,15 +87117,15 @@ var GitHubFeatureFlags = class {
return version;
}
async getDefaultCliVersion(variant) {
if (variant === 0 /* DOTCOM */) {
return await this.getDefaultDotcomCliVersion();
if (supportsFeatureFlags(variant)) {
return await this.getDefaultCliVersionFromFlags();
}
return {
cliVersion,
tagName: bundleVersion
};
}
async getDefaultDotcomCliVersion() {
async getDefaultCliVersionFromFlags() {
const response = await this.getAllFeatures();
const enabledFeatureFlagCliVersions = Object.entries(response).map(
([f, isEnabled]) => isEnabled ? this.getCliVersionFromFeatureFlag(f) : void 0
@@ -87219,7 +87214,7 @@ var GitHubFeatureFlags = class {
}
}
async loadApiResponse() {
if (this.gitHubVersion.type !== 0 /* DOTCOM */ && this.gitHubVersion.type !== 2 /* GHE_DOTCOM */) {
if (!supportsFeatureFlags(this.gitHubVersion.type)) {
this.logger.debug(
"Not running against github.com. Disabling all toggleable features."
);
@@ -87272,6 +87267,9 @@ var GitHubFeatureFlags = class {
}
}
};
function supportsFeatureFlags(githubVariant) {
return githubVariant === "GitHub.com" /* DOTCOM */ || githubVariant === "GitHub Enterprise Cloud with data residency" /* GHEC_DR */;
}
// src/status-report.ts
var os = __toESM(require("os"));
@@ -88501,7 +88499,7 @@ async function getCodeQLSource(toolsInput, defaultCliVersion, apiDetails, varian
toolsVersion: cliVersion2 ?? humanReadableVersion
};
}
if (variant !== 0 /* DOTCOM */ && !forceShippedTools && !toolsInput) {
if (variant === "GitHub Enterprise Server" /* GHES */ && !forceShippedTools && !toolsInput) {
const result = await findOverridingToolsInCache(
humanReadableVersion,
logger
@@ -90572,7 +90570,7 @@ function areAllRunsUnique(sarifObjects) {
return true;
}
async function shouldShowCombineSarifFilesDeprecationWarning(sarifObjects, githubVersion) {
if (githubVersion.type === 1 /* GHES */ && satisfiesGHESVersion(githubVersion.version, "<3.14", true)) {
if (githubVersion.type === "GitHub Enterprise Server" /* GHES */ && satisfiesGHESVersion(githubVersion.version, "<3.14", true)) {
return false;
}
return !areAllRunsUnique(sarifObjects) && !process.env.CODEQL_MERGE_SARIF_DEPRECATION_WARNING;
@@ -90587,7 +90585,7 @@ async function throwIfCombineSarifFilesDisabled(sarifObjects, githubVersion) {
);
}
async function shouldDisableCombineSarifFiles(sarifObjects, githubVersion) {
if (githubVersion.type === 1 /* GHES */) {
if (githubVersion.type === "GitHub Enterprise Server" /* GHES */) {
if (satisfiesGHESVersion(githubVersion.version, "<3.18", true)) {
return false;
}
@@ -90602,7 +90600,7 @@ async function combineSarifFilesUsingCLI(sarifFiles, gitHubVersion, features, lo
const sarifObjects = sarifFiles.map((sarifFile) => {
return JSON.parse(fs12.readFileSync(sarifFile, "utf8"));
});
const deprecationWarningMessage = gitHubVersion.type === 1 /* GHES */ ? "and will be removed in GitHub Enterprise Server 3.18" : "and will be removed in July 2025";
const deprecationWarningMessage = gitHubVersion.type === "GitHub Enterprise Server" /* GHES */ ? "and will be removed in GitHub Enterprise Server 3.18" : "and will be removed in July 2025";
const deprecationMoreInformationMessage = "For more information, see https://github.blog/changelog/2024-05-06-code-scanning-will-stop-combining-runs-from-a-single-upload";
if (!areAllRunsProducedByCodeQL(sarifObjects)) {
await throwIfCombineSarifFilesDisabled(sarifObjects, gitHubVersion);

15
package-lock.json generated
View File

@@ -1,12 +1,12 @@
{
"name": "codeql",
"version": "4.31.9",
"version": "4.31.10",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "codeql",
"version": "4.31.9",
"version": "4.31.10",
"license": "MIT",
"dependencies": {
"@actions/artifact": "^4.0.0",
@@ -1799,6 +1799,7 @@
"resolved": "https://registry.npmjs.org/@octokit/core/-/core-5.2.2.tgz",
"integrity": "sha512-/g2d4sW9nUDJOMz3mabVQvOGhVa4e/BN/Um7yca9Bb2XTzPPnfTWHWQg+IsEYO7M3Vx+EXvaM/I2pJWIMun1bg==",
"license": "MIT",
"peer": true,
"dependencies": {
"@octokit/auth-token": "^4.0.0",
"@octokit/graphql": "^7.1.0",
@@ -2568,6 +2569,7 @@
"integrity": "sha512-PC0PDZfJg8sP7cmKe6L3QIL8GZwU5aRvUFedqSIpw3B+QjRSUZeeITC2M5XKeMXEzL6wccN196iy3JLwKNvDVA==",
"dev": true,
"license": "MIT",
"peer": true,
"dependencies": {
"@typescript-eslint/scope-manager": "8.48.1",
"@typescript-eslint/types": "8.48.1",
@@ -3162,6 +3164,7 @@
"resolved": "https://registry.npmjs.org/acorn/-/acorn-8.15.0.tgz",
"integrity": "sha512-NZyJarBfL7nWwIq+FDL6Zp/yHEhePMNnnJ0y3qfieCrmNvYct8uvtiV41UvlSe6apAfk0fY1FbWx+NwfmpvtTg==",
"dev": true,
"peer": true,
"bin": {
"acorn": "bin/acorn"
},
@@ -3737,6 +3740,7 @@
}
],
"license": "MIT",
"peer": true,
"dependencies": {
"caniuse-lite": "^1.0.30001669",
"electron-to-chromium": "^1.5.41",
@@ -4590,6 +4594,7 @@
"resolved": "https://registry.npmjs.org/eslint/-/eslint-8.57.1.tgz",
"integrity": "sha512-ypowyDxpVSYpkXr9WPv2PAZCtNip1Mv5KTW0SCurXv/9iOpcrH9PaqUElksqEB6pChqHGDRCFTyrZlGhnLNGiA==",
"dev": true,
"peer": true,
"dependencies": {
"@eslint-community/eslint-utils": "^4.2.0",
"@eslint-community/regexpp": "^4.6.1",
@@ -4644,6 +4649,7 @@
"version": "8.3.0",
"dev": true,
"license": "MIT",
"peer": true,
"bin": {
"eslint-config-prettier": "bin/cli.js"
},
@@ -4915,6 +4921,7 @@
"resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.29.1.tgz",
"integrity": "sha512-BbPC0cuExzhiMo4Ff1BTVwHpjjv28C5R+btTOGaCRC7UEz801up0JadwkeSk5Ued6TG34uaczuVuH6qyy5YUxw==",
"dev": true,
"peer": true,
"dependencies": {
"array-includes": "^3.1.7",
"array.prototype.findlastindex": "^1.2.3",
@@ -7350,6 +7357,7 @@
"integrity": "sha512-G+YdqtITVZmOJje6QkXQWzl3fSfMxFwm1tjTyo9exhkmWSqC4Yhd1+lug++IlR2mvRVAxEDDWYkQdeSztajqgg==",
"dev": true,
"license": "MIT",
"peer": true,
"bin": {
"prettier": "bin/prettier.cjs"
},
@@ -8343,6 +8351,7 @@
"integrity": "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==",
"dev": true,
"license": "MIT",
"peer": true,
"engines": {
"node": ">=12"
},
@@ -8551,6 +8560,7 @@
"integrity": "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==",
"dev": true,
"license": "Apache-2.0",
"peer": true,
"bin": {
"tsc": "bin/tsc",
"tsserver": "bin/tsserver"
@@ -8624,6 +8634,7 @@
"resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-8.17.0.tgz",
"integrity": "sha512-Drp39TXuUlD49F7ilHHCG7TTg8IkA+hxCuULdmzWYICxGXvDXmDmWEjJYZQYgf6l/TFfYNE167m7isnc3xlIEg==",
"dev": true,
"peer": true,
"dependencies": {
"@typescript-eslint/scope-manager": "8.17.0",
"@typescript-eslint/types": "8.17.0",

View File

@@ -1,6 +1,6 @@
{
"name": "codeql",
"version": "4.31.9",
"version": "4.31.10",
"private": true,
"description": "CodeQL action",
"scripts": {

View File

@@ -20,7 +20,10 @@ import { runAutobuild } from "./autobuild";
import { getTotalCacheSize, shouldStoreCache } from "./caching-utils";
import { getCodeQL } from "./codeql";
import { Config, getConfig } from "./config-utils";
import { cleanupAndUploadDatabases } from "./database-upload";
import {
cleanupAndUploadDatabases,
DatabaseUploadResult,
} from "./database-upload";
import {
DependencyCacheUploadStatusReport,
uploadDependencyCaches,
@@ -54,15 +57,13 @@ interface AnalysisStatusReport
extends uploadLib.UploadStatusReport,
QueriesStatusReport {}
interface DependencyCachingUploadStatusReport {
dependency_caching_upload_results?: DependencyCacheUploadStatusReport;
}
interface FinishStatusReport
extends StatusReportBase,
DatabaseCreationTimings,
AnalysisStatusReport,
DependencyCachingUploadStatusReport {}
AnalysisStatusReport {
dependency_caching_upload_results?: DependencyCacheUploadStatusReport;
database_upload_results: DatabaseUploadResult[];
}
interface FinishWithTrapUploadStatusReport extends FinishStatusReport {
/** Size of TRAP caches that we uploaded, in bytes. */
@@ -81,6 +82,7 @@ async function sendStatusReport(
didUploadTrapCaches: boolean,
trapCacheCleanup: TrapCacheCleanupStatusReport | undefined,
dependencyCacheResults: DependencyCacheUploadStatusReport | undefined,
databaseUploadResults: DatabaseUploadResult[],
logger: Logger,
) {
const status = getActionsStatus(error, stats?.analyze_failure_language);
@@ -101,6 +103,7 @@ async function sendStatusReport(
...(dbCreationTimings || {}),
...(trapCacheCleanup || {}),
dependency_caching_upload_results: dependencyCacheResults,
database_upload_results: databaseUploadResults,
};
if (config && didUploadTrapCaches) {
const trapCacheUploadStatusReport: FinishWithTrapUploadStatusReport = {
@@ -218,6 +221,7 @@ async function run() {
let dbCreationTimings: DatabaseCreationTimings | undefined = undefined;
let didUploadTrapCaches = false;
let dependencyCacheResults: DependencyCacheUploadStatusReport | undefined;
let databaseUploadResults: DatabaseUploadResult[] = [];
util.initializeEnvironment(actionsUtil.getActionVersion());
// Make inputs accessible in the `post` step, details at
@@ -389,7 +393,7 @@ async function run() {
// Possibly upload the database bundles for remote queries.
// Note: Take care with the ordering of this call since databases may be cleaned up
// at the `overlay` or `clear` level.
await cleanupAndUploadDatabases(
databaseUploadResults = await cleanupAndUploadDatabases(
repositoryNwo,
codeql,
config,
@@ -461,6 +465,7 @@ async function run() {
didUploadTrapCaches,
trapCacheCleanupTelemetry,
dependencyCacheResults,
databaseUploadResults,
logger,
);
return;
@@ -483,6 +488,7 @@ async function run() {
didUploadTrapCaches,
trapCacheCleanupTelemetry,
dependencyCacheResults,
databaseUploadResults,
logger,
);
} else if (runStats !== undefined) {
@@ -496,6 +502,7 @@ async function run() {
didUploadTrapCaches,
trapCacheCleanupTelemetry,
dependencyCacheResults,
databaseUploadResults,
logger,
);
} else {
@@ -509,6 +516,7 @@ async function run() {
didUploadTrapCaches,
trapCacheCleanupTelemetry,
dependencyCacheResults,
databaseUploadResults,
logger,
);
}

View File

@@ -95,14 +95,14 @@ test("getGitHubVersion for different domain", async (t) => {
t.deepEqual({ type: util.GitHubVariant.DOTCOM }, v3);
});
test("getGitHubVersion for GHE_DOTCOM", async (t) => {
test("getGitHubVersion for GHEC-DR", async (t) => {
mockGetMetaVersionHeader("ghe.com");
const gheDotcom = await api.getGitHubVersionFromApi(api.getApiClient(), {
auth: "",
url: "https://foo.ghe.com",
apiURL: undefined,
});
t.deepEqual({ type: util.GitHubVariant.GHE_DOTCOM }, gheDotcom);
t.deepEqual({ type: util.GitHubVariant.GHEC_DR }, gheDotcom);
});
test("wrapApiConfigurationError correctly wraps specific configuration errors", (t) => {

View File

@@ -125,7 +125,7 @@ export async function getGitHubVersionFromApi(
}
if (response.headers[GITHUB_ENTERPRISE_VERSION_HEADER] === "ghe.com") {
return { type: GitHubVariant.GHE_DOTCOM };
return { type: GitHubVariant.GHEC_DR };
}
const version = response.headers[GITHUB_ENTERPRISE_VERSION_HEADER] as string;

View File

@@ -231,7 +231,7 @@ test("Don't crash if uploading a database fails", async (t) => {
(v) =>
v.type === "warning" &&
v.message ===
"Failed to upload database for javascript: Error: some error message",
"Failed to upload database for javascript: some error message",
) !== undefined,
);
});

View File

@@ -13,6 +13,20 @@ import { RepositoryNwo } from "./repository";
import * as util from "./util";
import { bundleDb, CleanupLevel, parseGitHubUrl } from "./util";
/** Information about a database upload. */
export interface DatabaseUploadResult {
/** Language of the database. */
language: string;
/** Size of the zipped database in bytes. */
zipped_upload_size_bytes?: number;
/** Whether the uploaded database is an overlay base. */
is_overlay_base?: boolean;
/** Time taken to upload database in milliseconds. */
upload_duration_ms?: number;
/** If there was an error during database upload, this is its message. */
error?: string;
}
export async function cleanupAndUploadDatabases(
repositoryNwo: RepositoryNwo,
codeql: CodeQL,
@@ -20,44 +34,46 @@ export async function cleanupAndUploadDatabases(
apiDetails: GitHubApiDetails,
features: FeatureEnablement,
logger: Logger,
): Promise<void> {
): Promise<DatabaseUploadResult[]> {
if (actionsUtil.getRequiredInput("upload-database") !== "true") {
logger.debug("Database upload disabled in workflow. Skipping upload.");
return;
return [];
}
if (!config.analysisKinds.includes(AnalysisKind.CodeScanning)) {
logger.debug(
`Not uploading database because 'analysis-kinds: ${AnalysisKind.CodeScanning}' is not enabled.`,
);
return;
return [];
}
if (util.isInTestMode()) {
logger.debug("In test mode. Skipping database upload.");
return;
return [];
}
// Do nothing when not running against github.com
if (
config.gitHubVersion.type !== util.GitHubVariant.DOTCOM &&
config.gitHubVersion.type !== util.GitHubVariant.GHE_DOTCOM
config.gitHubVersion.type !== util.GitHubVariant.GHEC_DR
) {
logger.debug("Not running against github.com or GHEC-DR. Skipping upload.");
return;
return [];
}
if (!(await gitUtils.isAnalyzingDefaultBranch())) {
// We only want to upload a database if we are analyzing the default branch.
logger.debug("Not analyzing default branch. Skipping upload.");
return;
return [];
}
const cleanupLevel =
// If config.overlayDatabaseMode is OverlayBase, then we have overlay base databases for all languages.
const shouldUploadOverlayBase =
config.overlayDatabaseMode === OverlayDatabaseMode.OverlayBase &&
(await features.getValue(Feature.UploadOverlayDbToApi))
? CleanupLevel.Overlay
: CleanupLevel.Clear;
(await features.getValue(Feature.UploadOverlayDbToApi));
const cleanupLevel = shouldUploadOverlayBase
? CleanupLevel.Overlay
: CleanupLevel.Clear;
// Clean up the database, since intermediate results may still be written to the
// database if there is high RAM pressure.
@@ -77,6 +93,7 @@ export async function cleanupAndUploadDatabases(
uploadsBaseUrl = uploadsBaseUrl.slice(0, -1);
}
const reports: DatabaseUploadResult[] = [];
for (const language of config.languages) {
try {
// Upload the database bundle.
@@ -90,6 +107,7 @@ export async function cleanupAndUploadDatabases(
actionsUtil.getRequiredInput("checkout_path"),
);
try {
const startTime = performance.now();
await client.request(
`POST /repos/:owner/:repo/code-scanning/codeql/databases/:language?name=:name&commit_oid=:commit_oid`,
{
@@ -107,13 +125,27 @@ export async function cleanupAndUploadDatabases(
},
},
);
const endTime = performance.now();
reports.push({
language,
zipped_upload_size_bytes: bundledDbSize,
is_overlay_base: shouldUploadOverlayBase,
upload_duration_ms: endTime - startTime,
});
logger.debug(`Successfully uploaded database for ${language}`);
} finally {
bundledDbReadStream.close();
}
} catch (e) {
// Log a warning but don't fail the workflow
logger.warning(`Failed to upload database for ${language}: ${e}`);
logger.warning(
`Failed to upload database for ${language}: ${util.getErrorMessage(e)}`,
);
reports.push({
language,
error: util.getErrorMessage(e),
});
}
}
return reports;
}

View File

@@ -603,28 +603,6 @@ test("getFeaturePrefix - returns empty string if no features are enabled", async
}
});
test("getFeaturePrefix - Java - returns 'minify-' if JavaMinimizeDependencyJars is enabled", async (t) => {
const codeql = createStubCodeQL({});
const features = createFeatures([Feature.JavaMinimizeDependencyJars]);
const result = await getFeaturePrefix(codeql, features, KnownLanguage.java);
t.deepEqual(result, "minify-");
});
test("getFeaturePrefix - non-Java - returns '' if JavaMinimizeDependencyJars is enabled", async (t) => {
const codeql = createStubCodeQL({});
const features = createFeatures([Feature.JavaMinimizeDependencyJars]);
for (const knownLanguage of Object.values(KnownLanguage)) {
// Skip Java since we expect a result for it, which is tested in the previous test.
if (knownLanguage === KnownLanguage.java) {
continue;
}
const result = await getFeaturePrefix(codeql, features, knownLanguage);
t.deepEqual(result, "", `Expected no feature prefix for ${knownLanguage}`);
}
});
test("getFeaturePrefix - C# - returns prefix if CsharpNewCacheKey is enabled", async (t) => {
const codeql = createStubCodeQL({});
const features = createFeatures([Feature.CsharpNewCacheKey]);

View File

@@ -541,18 +541,7 @@ export async function getFeaturePrefix(
}
};
if (language === KnownLanguage.java) {
// To ensure a safe rollout of JAR minimization, we change the key when the feature is enabled.
const minimizeJavaJars = await features.getValue(
Feature.JavaMinimizeDependencyJars,
codeql,
);
// To maintain backwards compatibility with this, we return "minify-" instead of a hash.
if (minimizeJavaJars) {
return "minify-";
}
} else if (language === KnownLanguage.csharp) {
if (language === KnownLanguage.csharp) {
await addFeatureIfEnabled(Feature.CsharpNewCacheKey);
await addFeatureIfEnabled(Feature.CsharpCacheBuildModeNone);
}
@@ -593,14 +582,8 @@ async function cachePrefix(
// experimental features that affect the cache contents.
const featurePrefix = await getFeaturePrefix(codeql, features, language);
// Assemble the cache key. For backwards compatibility with the JAR minification experiment's existing
// feature prefix usage, we add that feature prefix at the start. Other feature prefixes are inserted
// after the general CodeQL dependency cache prefix.
if (featurePrefix === "minify-") {
return `${featurePrefix}${prefix}-${CODEQL_DEPENDENCY_CACHE_VERSION}-${runnerOs}-${language}-`;
} else {
return `${prefix}-${featurePrefix}${CODEQL_DEPENDENCY_CACHE_VERSION}-${runnerOs}-${language}-`;
}
// Assemble the cache key.
return `${prefix}-${featurePrefix}${CODEQL_DEPENDENCY_CACHE_VERSION}-${runnerOs}-${language}-`;
}
/** Represents information about our overall cache usage for CodeQL dependency caches. */

View File

@@ -62,13 +62,13 @@ test(`All features are disabled if running against GHES`, async (t) => {
});
});
test(`Feature flags are requested in Proxima`, async (t) => {
test(`Feature flags are requested in GHEC-DR`, async (t) => {
await withTmpDir(async (tmpDir) => {
const loggedMessages = [];
const features = setUpFeatureFlagTests(
tmpDir,
getRecordingLogger(loggedMessages),
{ type: GitHubVariant.GHE_DOTCOM },
{ type: GitHubVariant.GHEC_DR },
);
mockFeatureFlagApiEndpoint(200, initializeFeatures(true));
@@ -436,97 +436,79 @@ test(`selects CLI from defaults.json on GHES`, async (t) => {
});
});
test("selects CLI v2.20.1 on Dotcom when feature flags enable v2.20.0 and v2.20.1", async (t) => {
await withTmpDir(async (tmpDir) => {
const features = setUpFeatureFlagTests(tmpDir);
const expectedFeatureEnablement = initializeFeatures(true);
expectedFeatureEnablement["default_codeql_version_2_20_0_enabled"] = true;
expectedFeatureEnablement["default_codeql_version_2_20_1_enabled"] = true;
expectedFeatureEnablement["default_codeql_version_2_20_2_enabled"] = false;
expectedFeatureEnablement["default_codeql_version_2_20_3_enabled"] = false;
expectedFeatureEnablement["default_codeql_version_2_20_4_enabled"] = false;
expectedFeatureEnablement["default_codeql_version_2_20_5_enabled"] = false;
mockFeatureFlagApiEndpoint(200, expectedFeatureEnablement);
for (const variant of [GitHubVariant.DOTCOM, GitHubVariant.GHEC_DR]) {
test(`selects CLI v2.20.1 on ${variant} when feature flags enable v2.20.0 and v2.20.1`, async (t) => {
await withTmpDir(async (tmpDir) => {
const features = setUpFeatureFlagTests(tmpDir);
const expectedFeatureEnablement = initializeFeatures(true);
expectedFeatureEnablement["default_codeql_version_2_20_0_enabled"] = true;
expectedFeatureEnablement["default_codeql_version_2_20_1_enabled"] = true;
expectedFeatureEnablement["default_codeql_version_2_20_2_enabled"] =
false;
expectedFeatureEnablement["default_codeql_version_2_20_3_enabled"] =
false;
expectedFeatureEnablement["default_codeql_version_2_20_4_enabled"] =
false;
expectedFeatureEnablement["default_codeql_version_2_20_5_enabled"] =
false;
mockFeatureFlagApiEndpoint(200, expectedFeatureEnablement);
const defaultCliVersion = await features.getDefaultCliVersion(
GitHubVariant.DOTCOM,
);
t.deepEqual(defaultCliVersion, {
cliVersion: "2.20.1",
tagName: "codeql-bundle-v2.20.1",
toolsFeatureFlagsValid: true,
const defaultCliVersion = await features.getDefaultCliVersion(variant);
t.deepEqual(defaultCliVersion, {
cliVersion: "2.20.1",
tagName: "codeql-bundle-v2.20.1",
toolsFeatureFlagsValid: true,
});
});
});
});
test("includes tag name", async (t) => {
await withTmpDir(async (tmpDir) => {
const features = setUpFeatureFlagTests(tmpDir);
const expectedFeatureEnablement = initializeFeatures(true);
expectedFeatureEnablement["default_codeql_version_2_20_0_enabled"] = true;
mockFeatureFlagApiEndpoint(200, expectedFeatureEnablement);
test(`selects CLI from defaults.json on ${variant} when no default version feature flags are enabled`, async (t) => {
await withTmpDir(async (tmpDir) => {
const features = setUpFeatureFlagTests(tmpDir);
const expectedFeatureEnablement = initializeFeatures(true);
mockFeatureFlagApiEndpoint(200, expectedFeatureEnablement);
const defaultCliVersion = await features.getDefaultCliVersion(
GitHubVariant.DOTCOM,
);
t.deepEqual(defaultCliVersion, {
cliVersion: "2.20.0",
tagName: "codeql-bundle-v2.20.0",
toolsFeatureFlagsValid: true,
const defaultCliVersion = await features.getDefaultCliVersion(variant);
t.deepEqual(defaultCliVersion, {
cliVersion: defaults.cliVersion,
tagName: defaults.bundleVersion,
toolsFeatureFlagsValid: false,
});
});
});
});
test(`selects CLI from defaults.json on Dotcom when no default version feature flags are enabled`, async (t) => {
await withTmpDir(async (tmpDir) => {
const features = setUpFeatureFlagTests(tmpDir);
const expectedFeatureEnablement = initializeFeatures(true);
mockFeatureFlagApiEndpoint(200, expectedFeatureEnablement);
test(`ignores invalid version numbers in default version feature flags on ${variant}`, async (t) => {
await withTmpDir(async (tmpDir) => {
const loggedMessages = [];
const features = setUpFeatureFlagTests(
tmpDir,
getRecordingLogger(loggedMessages),
);
const expectedFeatureEnablement = initializeFeatures(true);
expectedFeatureEnablement["default_codeql_version_2_20_0_enabled"] = true;
expectedFeatureEnablement["default_codeql_version_2_20_1_enabled"] = true;
expectedFeatureEnablement["default_codeql_version_2_20_invalid_enabled"] =
true;
mockFeatureFlagApiEndpoint(200, expectedFeatureEnablement);
const defaultCliVersion = await features.getDefaultCliVersion(
GitHubVariant.DOTCOM,
);
t.deepEqual(defaultCliVersion, {
cliVersion: defaults.cliVersion,
tagName: defaults.bundleVersion,
toolsFeatureFlagsValid: false,
const defaultCliVersion = await features.getDefaultCliVersion(variant);
t.deepEqual(defaultCliVersion, {
cliVersion: "2.20.1",
tagName: "codeql-bundle-v2.20.1",
toolsFeatureFlagsValid: true,
});
t.assert(
loggedMessages.find(
(v: LoggedMessage) =>
v.type === "warning" &&
v.message ===
"Ignoring feature flag default_codeql_version_2_20_invalid_enabled as it does not specify a valid CodeQL version.",
) !== undefined,
);
});
});
});
test("ignores invalid version numbers in default version feature flags", async (t) => {
await withTmpDir(async (tmpDir) => {
const loggedMessages = [];
const features = setUpFeatureFlagTests(
tmpDir,
getRecordingLogger(loggedMessages),
);
const expectedFeatureEnablement = initializeFeatures(true);
expectedFeatureEnablement["default_codeql_version_2_20_0_enabled"] = true;
expectedFeatureEnablement["default_codeql_version_2_20_1_enabled"] = true;
expectedFeatureEnablement["default_codeql_version_2_20_invalid_enabled"] =
true;
mockFeatureFlagApiEndpoint(200, expectedFeatureEnablement);
const defaultCliVersion = await features.getDefaultCliVersion(
GitHubVariant.DOTCOM,
);
t.deepEqual(defaultCliVersion, {
cliVersion: "2.20.1",
tagName: "codeql-bundle-v2.20.1",
toolsFeatureFlagsValid: true,
});
t.assert(
loggedMessages.find(
(v: LoggedMessage) =>
v.type === "warning" &&
v.message ===
"Ignoring feature flag default_codeql_version_2_20_invalid_enabled as it does not specify a valid CodeQL version.",
) !== undefined,
);
});
});
}
test("legacy feature flags should end with _enabled", async (t) => {
for (const [feature, config] of Object.entries(featureConfig)) {

View File

@@ -53,7 +53,6 @@ export enum Feature {
DisableJavaBuildlessEnabled = "disable_java_buildless_enabled",
DisableKotlinAnalysisEnabled = "disable_kotlin_analysis_enabled",
ExportDiagnosticsEnabled = "export_diagnostics_enabled",
JavaMinimizeDependencyJars = "java_minimize_dependency_jars",
OverlayAnalysis = "overlay_analysis",
OverlayAnalysisActions = "overlay_analysis_actions",
OverlayAnalysisCodeScanningActions = "overlay_analysis_code_scanning_actions",
@@ -168,11 +167,6 @@ export const featureConfig: Record<
legacyApi: true,
minimumVersion: undefined,
},
[Feature.JavaMinimizeDependencyJars]: {
defaultValue: false,
envVar: "CODEQL_ACTION_JAVA_MINIMIZE_DEPENDENCY_JARS",
minimumVersion: "2.23.0",
},
[Feature.OverlayAnalysis]: {
defaultValue: false,
envVar: "CODEQL_ACTION_OVERLAY_ANALYSIS",
@@ -492,8 +486,8 @@ class GitHubFeatureFlags {
async getDefaultCliVersion(
variant: util.GitHubVariant,
): Promise<CodeQLDefaultVersionInfo> {
if (variant === util.GitHubVariant.DOTCOM) {
return await this.getDefaultDotcomCliVersion();
if (supportsFeatureFlags(variant)) {
return await this.getDefaultCliVersionFromFlags();
}
return {
cliVersion: defaults.cliVersion,
@@ -501,7 +495,7 @@ class GitHubFeatureFlags {
};
}
async getDefaultDotcomCliVersion(): Promise<CodeQLDefaultVersionInfo> {
async getDefaultCliVersionFromFlags(): Promise<CodeQLDefaultVersionInfo> {
const response = await this.getAllFeatures();
const enabledFeatureFlagCliVersions = Object.entries(response)
@@ -627,10 +621,7 @@ class GitHubFeatureFlags {
private async loadApiResponse(): Promise<GitHubFeatureFlagsApiResponse> {
// Do nothing when not running against github.com
if (
this.gitHubVersion.type !== util.GitHubVariant.DOTCOM &&
this.gitHubVersion.type !== util.GitHubVariant.GHE_DOTCOM
) {
if (!supportsFeatureFlags(this.gitHubVersion.type)) {
this.logger.debug(
"Not running against github.com. Disabling all toggleable features.",
);
@@ -696,3 +687,10 @@ class GitHubFeatureFlags {
}
}
}
function supportsFeatureFlags(githubVariant: util.GitHubVariant): boolean {
return (
githubVariant === util.GitHubVariant.DOTCOM ||
githubVariant === util.GitHubVariant.GHEC_DR
);
}

View File

@@ -88,6 +88,13 @@ import {
} from "./util";
import { checkWorkflow } from "./workflow";
/**
* First version of CodeQL where the Java extractor safely supports the option to minimize
* dependency jars. Note: some earlier versions of the extractor will respond to the corresponding
* option, but may rewrite jars in ways that lead to extraction errors.
*/
export const CODEQL_VERSION_JAR_MINIMIZATION = "2.23.0";
/**
* Sends a status report indicating that the `init` Action is starting.
*
@@ -638,18 +645,20 @@ async function run() {
}
}
// If the feature flag to minimize Java dependency jars is enabled, and we are doing a Java
// `build-mode: none` analysis (i.e. the flag is relevant), then set the environment variable
// that enables the corresponding option in the Java extractor. We also only do this if
// dependency caching is enabled, since the option is intended to reduce the size of
// dependency caches, but the jar-rewriting does have a performance cost that we'd like to avoid
// when caching is not being used.
// If we are doing a Java `build-mode: none` analysis, then set the environment variable that
// enables the option in the Java extractor to minimize dependency jars. We also only do this if
// dependency caching is enabled, since the option is intended to reduce the size of dependency
// caches, but the jar-rewriting does have a performance cost that we'd like to avoid when
// caching is not being used.
// TODO: Remove this language-specific mechanism and replace it with a more general one that
// tells extractors when dependency caching is enabled, and then the Java extractor can make its
// own decision about whether to rewrite jars.
if (process.env[EnvVar.JAVA_EXTRACTOR_MINIMIZE_DEPENDENCY_JARS]) {
logger.debug(
`${EnvVar.JAVA_EXTRACTOR_MINIMIZE_DEPENDENCY_JARS} is already set to '${process.env[EnvVar.JAVA_EXTRACTOR_MINIMIZE_DEPENDENCY_JARS]}', so the Action will not override it.`,
);
} else if (
(await features.getValue(Feature.JavaMinimizeDependencyJars, codeql)) &&
(await codeQlVersionAtLeast(codeql, CODEQL_VERSION_JAR_MINIMIZATION)) &&
config.dependencyCachingEnabled &&
config.buildMode === BuildMode.None &&
config.languages.includes(KnownLanguage.java)

View File

@@ -511,7 +511,7 @@ export async function getCodeQLSource(
// different version to save download time if the version hasn't been
// specified explicitly (in which case we always honor it).
if (
variant !== util.GitHubVariant.DOTCOM &&
variant === util.GitHubVariant.GHES &&
!forceShippedTools &&
!toolsInput
) {

View File

@@ -433,8 +433,8 @@ function formatGitHubVersion(version: util.GitHubVersion): string {
switch (version.type) {
case util.GitHubVariant.DOTCOM:
return "dotcom";
case util.GitHubVariant.GHE_DOTCOM:
return "GHE dotcom";
case util.GitHubVariant.GHEC_DR:
return "GHEC-DR";
case util.GitHubVariant.GHES:
return `GHES ${version.version}`;
default:
@@ -445,12 +445,12 @@ function formatGitHubVersion(version: util.GitHubVersion): string {
const CHECK_ACTION_VERSION_TESTS: Array<[string, util.GitHubVersion, boolean]> =
[
["2.2.1", { type: util.GitHubVariant.DOTCOM }, true],
["2.2.1", { type: util.GitHubVariant.GHE_DOTCOM }, true],
["2.2.1", { type: util.GitHubVariant.GHEC_DR }, true],
["2.2.1", { type: util.GitHubVariant.GHES, version: "3.10" }, false],
["2.2.1", { type: util.GitHubVariant.GHES, version: "3.11" }, false],
["2.2.1", { type: util.GitHubVariant.GHES, version: "3.12" }, false],
["3.2.1", { type: util.GitHubVariant.DOTCOM }, true],
["3.2.1", { type: util.GitHubVariant.GHE_DOTCOM }, true],
["3.2.1", { type: util.GitHubVariant.GHEC_DR }, true],
["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.12" }, false],
@@ -458,7 +458,7 @@ const CHECK_ACTION_VERSION_TESTS: Array<[string, util.GitHubVersion, boolean]> =
["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.GHEC_DR }, 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],

View File

@@ -556,13 +556,17 @@ const CODEQL_ACTION_WARNED_ABOUT_VERSION_ENV_VAR =
let hasBeenWarnedAboutVersion = false;
export enum GitHubVariant {
DOTCOM,
GHES,
GHE_DOTCOM,
/** [GitHub.com](https://github.com) */
DOTCOM = "GitHub.com",
/** [GitHub Enterprise Server](https://docs.github.com/en/enterprise-server@latest/admin/overview/about-github-enterprise-server) */
GHES = "GitHub Enterprise Server",
/** [GitHub Enterprise Cloud with data residency](https://docs.github.com/en/enterprise-cloud@latest/admin/data-residency/about-github-enterprise-cloud-with-data-residency) */
GHEC_DR = "GitHub Enterprise Cloud with data residency",
}
export type GitHubVersion =
| { type: GitHubVariant.DOTCOM }
| { type: GitHubVariant.GHE_DOTCOM }
| { type: GitHubVariant.GHEC_DR }
| { type: GitHubVariant.GHES; version: string };
export function checkGitHubVersionInRange(
@@ -1105,7 +1109,7 @@ export function checkActionVersion(
// and should update to CodeQL Action v4.
if (
githubVersion.type === GitHubVariant.DOTCOM ||
githubVersion.type === GitHubVariant.GHE_DOTCOM ||
githubVersion.type === GitHubVariant.GHEC_DR ||
(githubVersion.type === GitHubVariant.GHES &&
semver.satisfies(
semver.coerce(githubVersion.version) ?? "0.0.0",