From 67d37cd34678091933f0a88cd1bb026171ea20d2 Mon Sep 17 00:00:00 2001 From: bethanyj28 Date: Fri, 23 Feb 2024 16:42:29 -0500 Subject: [PATCH 1/4] Update toolkit --- dist/index.js | 55 +++++++++++++++++++++++++++++++++++++++++++---- package-lock.json | 12 +++++------ 2 files changed, 57 insertions(+), 10 deletions(-) diff --git a/dist/index.js b/dist/index.js index bd49f47..e1ab3b2 100644 --- a/dist/index.js +++ b/dist/index.js @@ -2328,6 +2328,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) { Object.defineProperty(exports, "__esModule", ({ value: true })); exports.downloadArtifactInternal = exports.downloadArtifactPublic = exports.streamExtractExternal = void 0; const promises_1 = __importDefault(__nccwpck_require__(73292)); +const stream = __importStar(__nccwpck_require__(12781)); +const fs_1 = __nccwpck_require__(57147); +const path = __importStar(__nccwpck_require__(71017)); const github = __importStar(__nccwpck_require__(95438)); const core = __importStar(__nccwpck_require__(42186)); const httpClient = __importStar(__nccwpck_require__(96255)); @@ -2368,6 +2371,9 @@ function streamExtract(url, directory) { return; } catch (error) { + if (error.message.includes('Malformed extraction path')) { + throw new Error(`Artifact download failed with unretryable error: ${error.message}`); + } retryCount++; core.debug(`Failed to download artifact after ${retryCount} retries due to ${error.message}. Retrying in 5 seconds...`); // wait 5 seconds before retrying @@ -2390,6 +2396,8 @@ function streamExtractExternal(url, directory) { response.message.destroy(new Error(`Blob storage chunk did not respond in ${timeout}ms`)); }; const timer = setTimeout(timerFn, timeout); + const createdDirectories = new Set(); + createdDirectories.add(directory); response.message .on('data', () => { timer.refresh(); @@ -2399,11 +2407,50 @@ function streamExtractExternal(url, directory) { clearTimeout(timer); reject(error); }) - .pipe(unzip_stream_1.default.Extract({ path: directory })) - .on('close', () => { + .pipe(unzip_stream_1.default.Parse()) + .pipe(new stream.Transform({ + objectMode: true, + transform: (entry, _, callback) => __awaiter(this, void 0, void 0, function* () { + const fullPath = path.normalize(path.join(directory, entry.path)); + if (!directory.endsWith(path.sep)) { + directory += path.sep; + } + if (!fullPath.startsWith(directory)) { + reject(new Error(`Malformed extraction path: ${fullPath}`)); + } + core.debug(`Extracting artifact entry: ${fullPath}`); + if (entry.type === 'Directory') { + if (!createdDirectories.has(fullPath)) { + createdDirectories.add(fullPath); + yield resolveOrCreateDirectory(fullPath).then(() => { + entry.autodrain(); + callback(); + }); + } + else { + entry.autodrain(); + callback(); + } + } + else { + if (!createdDirectories.has(path.dirname(fullPath))) { + createdDirectories.add(path.dirname(fullPath)); + yield resolveOrCreateDirectory(path.dirname(fullPath)).then(() => { + entry.autodrain(); + callback(); + }); + } + const writeStream = (0, fs_1.createWriteStream)(fullPath); + writeStream.on('finish', callback); + writeStream.on('error', reject); + entry.pipe(writeStream); + } + }) + })) + .on('finish', () => __awaiter(this, void 0, void 0, function* () { clearTimeout(timer); resolve(); - }) + })) .on('error', (error) => { reject(error); }); @@ -125221,7 +125268,7 @@ exports.unescape = unescape; /***/ ((module) => { "use strict"; -module.exports = JSON.parse('{"name":"@actions/artifact","version":"2.1.1","preview":true,"description":"Actions artifact lib","keywords":["github","actions","artifact"],"homepage":"https://github.com/actions/toolkit/tree/main/packages/artifact","license":"MIT","main":"lib/artifact.js","types":"lib/artifact.d.ts","directories":{"lib":"lib","test":"__tests__"},"files":["lib","!.DS_Store"],"publishConfig":{"access":"public"},"repository":{"type":"git","url":"git+https://github.com/actions/toolkit.git","directory":"packages/artifact"},"scripts":{"audit-moderate":"npm install && npm audit --json --audit-level=moderate > audit.json","test":"cd ../../ && npm run test ./packages/artifact","bootstrap":"cd ../../ && npm run bootstrap","tsc-run":"tsc","tsc":"npm run bootstrap && npm run tsc-run","gen:docs":"typedoc --plugin typedoc-plugin-markdown --out docs/generated src/artifact.ts --githubPages false --readme none"},"bugs":{"url":"https://github.com/actions/toolkit/issues"},"dependencies":{"@actions/core":"^1.10.0","@actions/github":"^5.1.1","@actions/http-client":"^2.1.0","@azure/storage-blob":"^12.15.0","@octokit/core":"^3.5.1","@octokit/plugin-request-log":"^1.0.4","@octokit/plugin-retry":"^3.0.9","@octokit/request-error":"^5.0.0","@protobuf-ts/plugin":"^2.2.3-alpha.1","archiver":"^5.3.1","crypto":"^1.0.1","jwt-decode":"^3.1.2","twirp-ts":"^2.5.0","unzip-stream":"^0.3.1"},"devDependencies":{"@types/archiver":"^5.3.2","@types/unzip-stream":"^0.3.4","typedoc":"^0.25.4","typedoc-plugin-markdown":"^3.17.1","typescript":"^5.2.2"}}'); +module.exports = JSON.parse('{"name":"@actions/artifact","version":"2.1.2","preview":true,"description":"Actions artifact lib","keywords":["github","actions","artifact"],"homepage":"https://github.com/actions/toolkit/tree/main/packages/artifact","license":"MIT","main":"lib/artifact.js","types":"lib/artifact.d.ts","directories":{"lib":"lib","test":"__tests__"},"files":["lib","!.DS_Store"],"publishConfig":{"access":"public"},"repository":{"type":"git","url":"git+https://github.com/actions/toolkit.git","directory":"packages/artifact"},"scripts":{"audit-moderate":"npm install && npm audit --json --audit-level=moderate > audit.json","test":"cd ../../ && npm run test ./packages/artifact","bootstrap":"cd ../../ && npm run bootstrap","tsc-run":"tsc","tsc":"npm run bootstrap && npm run tsc-run","gen:docs":"typedoc --plugin typedoc-plugin-markdown --out docs/generated src/artifact.ts --githubPages false --readme none"},"bugs":{"url":"https://github.com/actions/toolkit/issues"},"dependencies":{"@actions/core":"^1.10.0","@actions/github":"^5.1.1","@actions/http-client":"^2.1.0","@azure/storage-blob":"^12.15.0","@octokit/core":"^3.5.1","@octokit/plugin-request-log":"^1.0.4","@octokit/plugin-retry":"^3.0.9","@octokit/request-error":"^5.0.0","@protobuf-ts/plugin":"^2.2.3-alpha.1","archiver":"^5.3.1","crypto":"^1.0.1","jwt-decode":"^3.1.2","twirp-ts":"^2.5.0","unzip-stream":"^0.3.1"},"devDependencies":{"@types/archiver":"^5.3.2","@types/unzip-stream":"^0.3.4","typedoc":"^0.25.4","typedoc-plugin-markdown":"^3.17.1","typescript":"^5.2.2"}}'); /***/ }), diff --git a/package-lock.json b/package-lock.json index 6df9b30..929c39f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -36,9 +36,9 @@ } }, "node_modules/@actions/artifact": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/@actions/artifact/-/artifact-2.1.1.tgz", - "integrity": "sha512-xVVwWhrRb4YLiTeYkNxctv9IhwIKUsLwIhqD9CKknXtQaqIksq5HttFN8wXQvMrpjQO4zGJf5xLUs6mKyfN4yQ==", + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/@actions/artifact/-/artifact-2.1.2.tgz", + "integrity": "sha512-JggZCTFze8D+10qFHnv9qnAElXMCXfV7m0IiZKuj9vwGVPrt9ak+vVpS2Iyn7KNXMyuUxXh7/bNugL4e4jfZIg==", "dependencies": { "@actions/core": "^1.10.0", "@actions/github": "^5.1.1", @@ -5862,9 +5862,9 @@ "dev": true }, "@actions/artifact": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/@actions/artifact/-/artifact-2.1.1.tgz", - "integrity": "sha512-xVVwWhrRb4YLiTeYkNxctv9IhwIKUsLwIhqD9CKknXtQaqIksq5HttFN8wXQvMrpjQO4zGJf5xLUs6mKyfN4yQ==", + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/@actions/artifact/-/artifact-2.1.2.tgz", + "integrity": "sha512-JggZCTFze8D+10qFHnv9qnAElXMCXfV7m0IiZKuj9vwGVPrt9ak+vVpS2Iyn7KNXMyuUxXh7/bNugL4e4jfZIg==", "requires": { "@actions/core": "^1.10.0", "@actions/github": "^5.1.1", From 7c63dfde29f42bb9cb0f61b67e54c91106a6586e Mon Sep 17 00:00:00 2001 From: bethanyj28 Date: Fri, 23 Feb 2024 16:49:11 -0500 Subject: [PATCH 2/4] licensed --- .licenses/npm/@actions/artifact.dep.yml | Bin 1233 -> 1315 bytes .licenses/npm/minimatch.dep.yml | Bin 953 -> 0 bytes 2 files changed, 0 insertions(+), 0 deletions(-) delete mode 100644 .licenses/npm/minimatch.dep.yml diff --git a/.licenses/npm/@actions/artifact.dep.yml b/.licenses/npm/@actions/artifact.dep.yml index bc59d55629237ad2732d8ea1f366f599db068394..ad1c39939e6d132a6b1edea5368a6c40e7155c92 100644 GIT binary patch delta 138 zcmXxcF%AMD5Jus~MovL*;v|-I-okd4;4)bT2>e@6c?Iv_2|S875)1qHz0dJwo~Osf zVASAju4?+O%56A%^^lUgi delta 43 xcmZ3?b&+#|wt^v7No7H*l|o)YE?04BZf;^xrIi9#Mt*K;L1H>keB<0U763t~4*388 diff --git a/.licenses/npm/minimatch.dep.yml b/.licenses/npm/minimatch.dep.yml deleted file mode 100644 index 570975500aa77a1afa95a5e097ceee5f5a151647..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 953 zcmY+D%Wm5+5JmU;ia}Q`AiH_2>K!A~76F-bNjgDVbfL&}M8JB0q>>uw$9G62NV}2v zx_8bUQH#YQ>+8;}ptHU0>d>^=i*eo#{R+Mu2xQw{nk6q@cuB+W;1z9_EW~`ra zJv-aR^d3jnH}4a_$`;^<$u-8Wpkf8(ie>=8{0=MlgChXl8epn`YSw3Iu^7gSv(IgS z&&?OOxw^hy++5w<0`qmg)Uraez47zcHKgktD}vrkhPoSzN$#&y<5d}T1wP!x+0O`;t8h|nsBhmsw-wt`UeG8ONuh Date: Fri, 23 Feb 2024 16:51:09 -0500 Subject: [PATCH 3/4] Revert "licensed" This reverts commit 7c63dfde29f42bb9cb0f61b67e54c91106a6586e. --- .licenses/npm/@actions/artifact.dep.yml | Bin 1315 -> 1233 bytes .licenses/npm/minimatch.dep.yml | Bin 0 -> 953 bytes 2 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 .licenses/npm/minimatch.dep.yml diff --git a/.licenses/npm/@actions/artifact.dep.yml b/.licenses/npm/@actions/artifact.dep.yml index ad1c39939e6d132a6b1edea5368a6c40e7155c92..bc59d55629237ad2732d8ea1f366f599db068394 100644 GIT binary patch delta 43 xcmZ3?b&+#|wt^v7No7H*l|o)YE?04BZf;^xrIi9#Mt*K;L1H>keB<0U763t~4*388 delta 138 zcmXxcF%AMD5Jus~MovL*;v|-I-okd4;4)bT2>e@6c?Iv_2|S875)1qHz0dJwo~Osf zVASAju4?+O%56A%^^lUgi diff --git a/.licenses/npm/minimatch.dep.yml b/.licenses/npm/minimatch.dep.yml new file mode 100644 index 0000000000000000000000000000000000000000..570975500aa77a1afa95a5e097ceee5f5a151647 GIT binary patch literal 953 zcmY+D%Wm5+5JmU;ia}Q`AiH_2>K!A~76F-bNjgDVbfL&}M8JB0q>>uw$9G62NV}2v zx_8bUQH#YQ>+8;}ptHU0>d>^=i*eo#{R+Mu2xQw{nk6q@cuB+W;1z9_EW~`ra zJv-aR^d3jnH}4a_$`;^<$u-8Wpkf8(ie>=8{0=MlgChXl8epn`YSw3Iu^7gSv(IgS z&&?OOxw^hy++5w<0`qmg)Uraez47zcHKgktD}vrkhPoSzN$#&y<5d}T1wP!x+0O`;t8h|nsBhmsw-wt`UeG8ONuh Date: Fri, 23 Feb 2024 16:51:43 -0500 Subject: [PATCH 4/4] licensed only artifact --- .licenses/npm/@actions/artifact.dep.yml | Bin 1233 -> 1315 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/.licenses/npm/@actions/artifact.dep.yml b/.licenses/npm/@actions/artifact.dep.yml index bc59d55629237ad2732d8ea1f366f599db068394..ad1c39939e6d132a6b1edea5368a6c40e7155c92 100644 GIT binary patch delta 138 zcmXxcF%AMD5Jus~MovL*;v|-I-okd4;4)bT2>e@6c?Iv_2|S875)1qHz0dJwo~Osf zVASAju4?+O%56A%^^lUgi delta 43 xcmZ3?b&+#|wt^v7No7H*l|o)YE?04BZf;^xrIi9#Mt*K;L1H>keB<0U763t~4*388