From 870106f6947a7c1e0525860bccbefee2c957e73c Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 3 Jun 2026 15:56:57 +0000 Subject: [PATCH] Add 1000-page safeguard to Adopt Temurin and Semeru pagination --- dist/setup/index.js | 27 +++++++++++++++++++++----- src/distributions/adopt/installer.ts | 2 +- src/distributions/semeru/installer.ts | 2 +- src/distributions/temurin/installer.ts | 2 +- 4 files changed, 25 insertions(+), 8 deletions(-) diff --git a/dist/setup/index.js b/dist/setup/index.js index 622b4c3e..5dc4a958 100644 --- a/dist/setup/index.js +++ b/dist/setup/index.js @@ -77569,6 +77569,7 @@ const path_1 = __importDefault(__nccwpck_require__(71017)); const semver_1 = __importDefault(__nccwpck_require__(11383)); const base_installer_1 = __nccwpck_require__(59741); const util_1 = __nccwpck_require__(92629); +const MAX_PAGINATION_PAGES = 1000; var AdoptImplementation; (function (AdoptImplementation) { AdoptImplementation["Hotspot"] = "Hotspot"; @@ -77653,10 +77654,12 @@ class AdoptDistribution extends base_installer_1.JavaBase { const requestArguments = `${baseRequestArguments}&page_size=20&page=0`; let availableVersionsUrl = `https://api.adoptopenjdk.net/v3/assets/version/${versionRange}?${requestArguments}`; const availableVersions = []; + let pageCount = 0; if (core.isDebug()) { core.debug(`Gathering available versions from '${availableVersionsUrl}'`); } while (availableVersionsUrl) { + pageCount++; const response = yield this.http.getJson(availableVersionsUrl); const paginationPage = response.result; availableVersionsUrl = (0, util_1.getNextPageUrlFromLinkHeader)(response.headers); @@ -77664,6 +77667,10 @@ class AdoptDistribution extends base_installer_1.JavaBase { break; } availableVersions.push(...paginationPage); + if (pageCount >= MAX_PAGINATION_PAGES) { + core.warning(`Reached pagination safeguard limit (${MAX_PAGINATION_PAGES} pages) while listing Adopt releases.`); + break; + } } if (core.isDebug()) { core.startGroup('Print information about available versions'); @@ -78728,7 +78735,6 @@ const semver_1 = __importDefault(__nccwpck_require__(11383)); const base_installer_1 = __nccwpck_require__(59741); const util_1 = __nccwpck_require__(92629); const http_client_1 = __nccwpck_require__(96255); -const MAX_PAGINATION_PAGES = 1000; class JetBrainsDistribution extends base_installer_1.JavaBase { constructor(installerOptions) { super('JetBrains', installerOptions); @@ -78781,7 +78787,7 @@ class JetBrainsDistribution extends base_installer_1.JavaBase { let page_index = 1; const rawVersions = []; const bearerToken = process.env.GITHUB_TOKEN; - while (page_index <= MAX_PAGINATION_PAGES) { + while (true) { const requestArguments = `per_page=100&page=${page_index}`; const requestHeaders = {}; if (bearerToken) { @@ -78805,9 +78811,6 @@ class JetBrainsDistribution extends base_installer_1.JavaBase { rawVersions.push(...paginationPage); page_index++; } - if (page_index > MAX_PAGINATION_PAGES) { - core.warning(`Reached pagination safeguard limit (${MAX_PAGINATION_PAGES} pages) while listing JetBrains runtime releases.`); - } if (this.stable) { // Add versions not available from the API but are downloadable const hidden = ['11_0_10b1145.115', '11_0_11b1341.60']; @@ -79730,6 +79733,7 @@ const core = __importStar(__nccwpck_require__(42186)); const tc = __importStar(__nccwpck_require__(27784)); const fs_1 = __importDefault(__nccwpck_require__(57147)); const path_1 = __importDefault(__nccwpck_require__(71017)); +const MAX_PAGINATION_PAGES = 1000; const supportedArchitectures = [ 'x64', 'x86', @@ -79828,10 +79832,12 @@ class SemeruDistribution extends base_installer_1.JavaBase { const requestArguments = `${baseRequestArguments}&page_size=20&page=0`; let availableVersionsUrl = `https://api.adoptopenjdk.net/v3/assets/version/${versionRange}?${requestArguments}`; const availableVersions = []; + let pageCount = 0; if (core.isDebug()) { core.debug(`Gathering available versions from '${availableVersionsUrl}'`); } while (availableVersionsUrl) { + pageCount++; const response = yield this.http.getJson(availableVersionsUrl); const paginationPage = response.result; availableVersionsUrl = (0, util_1.getNextPageUrlFromLinkHeader)(response.headers); @@ -79839,6 +79845,10 @@ class SemeruDistribution extends base_installer_1.JavaBase { break; } availableVersions.push(...paginationPage); + if (pageCount >= MAX_PAGINATION_PAGES) { + core.warning(`Reached pagination safeguard limit (${MAX_PAGINATION_PAGES} pages) while listing Semeru releases.`); + break; + } } if (core.isDebug()) { core.startGroup('Print information about available versions'); @@ -79916,6 +79926,7 @@ const path_1 = __importDefault(__nccwpck_require__(71017)); const semver_1 = __importDefault(__nccwpck_require__(11383)); const base_installer_1 = __nccwpck_require__(59741); const util_1 = __nccwpck_require__(92629); +const MAX_PAGINATION_PAGES = 1000; var TemurinImplementation; (function (TemurinImplementation) { TemurinImplementation["Hotspot"] = "Hotspot"; @@ -79998,10 +80009,12 @@ class TemurinDistribution extends base_installer_1.JavaBase { const requestArguments = `${baseRequestArguments}&page_size=20&page=0`; let availableVersionsUrl = `https://api.adoptium.net/v3/assets/version/${versionRange}?${requestArguments}`; const availableVersions = []; + let pageCount = 0; if (core.isDebug()) { core.debug(`Gathering available versions from '${availableVersionsUrl}'`); } while (availableVersionsUrl) { + pageCount++; const response = yield this.http.getJson(availableVersionsUrl); const paginationPage = response.result; availableVersionsUrl = (0, util_1.getNextPageUrlFromLinkHeader)(response.headers); @@ -80009,6 +80022,10 @@ class TemurinDistribution extends base_installer_1.JavaBase { break; } availableVersions.push(...paginationPage); + if (pageCount >= MAX_PAGINATION_PAGES) { + core.warning(`Reached pagination safeguard limit (${MAX_PAGINATION_PAGES} pages) while listing Temurin releases.`); + break; + } } if (core.isDebug()) { core.startGroup('Print information about available versions'); diff --git a/src/distributions/adopt/installer.ts b/src/distributions/adopt/installer.ts index 3827a0c8..3320ed3d 100644 --- a/src/distributions/adopt/installer.ts +++ b/src/distributions/adopt/installer.ts @@ -148,7 +148,7 @@ export class AdoptDistribution extends JavaBase { availableVersions.push(...paginationPage); - if (pageCount >= MAX_PAGINATION_PAGES && availableVersionsUrl) { + if (pageCount >= MAX_PAGINATION_PAGES) { core.warning( `Reached pagination safeguard limit (${MAX_PAGINATION_PAGES} pages) while listing Adopt releases.` ); diff --git a/src/distributions/semeru/installer.ts b/src/distributions/semeru/installer.ts index 4b1317fa..6d469f0a 100644 --- a/src/distributions/semeru/installer.ts +++ b/src/distributions/semeru/installer.ts @@ -179,7 +179,7 @@ export class SemeruDistribution extends JavaBase { availableVersions.push(...paginationPage); - if (pageCount >= MAX_PAGINATION_PAGES && availableVersionsUrl) { + if (pageCount >= MAX_PAGINATION_PAGES) { core.warning( `Reached pagination safeguard limit (${MAX_PAGINATION_PAGES} pages) while listing Semeru releases.` ); diff --git a/src/distributions/temurin/installer.ts b/src/distributions/temurin/installer.ts index 0f566139..b5dfb4e5 100644 --- a/src/distributions/temurin/installer.ts +++ b/src/distributions/temurin/installer.ts @@ -148,7 +148,7 @@ export class TemurinDistribution extends JavaBase { availableVersions.push(...paginationPage); - if (pageCount >= MAX_PAGINATION_PAGES && availableVersionsUrl) { + if (pageCount >= MAX_PAGINATION_PAGES) { core.warning( `Reached pagination safeguard limit (${MAX_PAGINATION_PAGES} pages) while listing Temurin releases.` );