diff --git a/dist/main/index.js b/dist/main/index.js index 6ca2529..a586e38 100644 --- a/dist/main/index.js +++ b/dist/main/index.js @@ -3324,8 +3324,8 @@ var require_data_url = __commonJS({ return input.slice(start, position.position); } function stringPercentDecode(input) { - const bytes = encoder.encode(input); - return percentDecode(bytes); + const bytes2 = encoder.encode(input); + return percentDecode(bytes2); } function isHexCharByte(byte) { return byte >= 48 && byte <= 57 || byte >= 65 && byte <= 70 || byte >= 97 && byte <= 102; @@ -4308,7 +4308,7 @@ var require_util2 = __commonJS({ return false; } } - function bytesMatch(bytes, metadataList) { + function bytesMatch(bytes2, metadataList) { if (crypto7 === void 0) { return true; } @@ -4324,7 +4324,7 @@ var require_util2 = __commonJS({ for (const item of metadata2) { const algorithm = item.algo; const expectedValue = item.hash; - let actualValue = crypto7.createHash(algorithm).update(bytes).digest("base64"); + let actualValue = crypto7.createHash(algorithm).update(bytes2).digest("base64"); if (actualValue[actualValue.length - 1] === "=") { if (actualValue[actualValue.length - 2] === "=") { actualValue = actualValue.slice(0, -2); @@ -4602,17 +4602,17 @@ var require_util2 = __commonJS({ return input; } async function readAllBytes(reader) { - const bytes = []; + const bytes2 = []; let byteLength = 0; while (true) { const { done, value: chunk } = await reader.read(); if (done) { - return Buffer.concat(bytes, byteLength); + return Buffer.concat(bytes2, byteLength); } if (!isUint8Array(chunk)) { throw new TypeError("Received non-Uint8Array chunk"); } - bytes.push(chunk); + bytes2.push(chunk); byteLength += chunk.length; } } @@ -5566,19 +5566,19 @@ Content-Type: ${value.type || "application/octet-stream"}\r function bodyMixinMethods(instance) { const methods = { blob() { - return consumeBody(this, (bytes) => { + return consumeBody(this, (bytes2) => { let mimeType = bodyMimeType(this); if (mimeType === null) { mimeType = ""; } else if (mimeType) { mimeType = serializeAMimeType(mimeType); } - return new Blob2([bytes], { type: mimeType }); + return new Blob2([bytes2], { type: mimeType }); }, instance); }, arrayBuffer() { - return consumeBody(this, (bytes) => { - return new Uint8Array(bytes).buffer; + return consumeBody(this, (bytes2) => { + return new Uint8Array(bytes2).buffer; }, instance); }, text() { @@ -5617,8 +5617,8 @@ Content-Type: ${value.type || "application/octet-stream"}\r }, instance); }, bytes() { - return consumeBody(this, (bytes) => { - return new Uint8Array(bytes); + return consumeBody(this, (bytes2) => { + return new Uint8Array(bytes2); }, instance); } }; @@ -5653,8 +5653,8 @@ Content-Type: ${value.type || "application/octet-stream"}\r const body2 = object[kState].body; return body2 != null && (body2.stream.locked || util5.isDisturbed(body2.stream)); } - function parseJSONFromBytes(bytes) { - return JSON.parse(utf8DecodeBytes(bytes)); + function parseJSONFromBytes(bytes2) { + return JSON.parse(utf8DecodeBytes(bytes2)); } function bodyMimeType(requestOrResponse) { const headers = requestOrResponse[kState].headersList; @@ -12292,10 +12292,10 @@ var require_response = __commonJS({ if (init !== null) { init = webidl.converters.ResponseInit(init); } - const bytes = textEncoder.encode( + const bytes2 = textEncoder.encode( serializeJavascriptValueToJSONString(data) ); - const body2 = extractBody(bytes); + const body2 = extractBody(bytes2); const responseObject = fromInnerResponse(makeResponse({}), "response"); initializeResponse(responseObject, init, { body: body2[0], type: "application/json" }); return responseObject; @@ -13752,12 +13752,12 @@ var require_fetch = __commonJS({ processBodyError(response.error); return; } - const processBody = (bytes) => { - if (!bytesMatch(bytes, request2.integrity)) { + const processBody = (bytes2) => { + if (!bytesMatch(bytes2, request2.integrity)) { processBodyError("integrity mismatch"); return; } - response.body = safelyExtractBody(bytes)[0]; + response.body = safelyExtractBody(bytes2)[0]; fetchFinale(fetchParams, response); }; await fullyReadBody(response.body, processBody, processBodyError); @@ -14170,12 +14170,12 @@ var require_fetch = __commonJS({ if (request2.body == null && fetchParams.processRequestEndOfBody) { queueMicrotask(() => fetchParams.processRequestEndOfBody()); } else if (request2.body != null) { - const processBodyChunk = async function* (bytes) { + const processBodyChunk = async function* (bytes2) { if (isCancelled(fetchParams)) { return; } - yield bytes; - fetchParams.processRequestBodyChunkLength?.(bytes.byteLength); + yield bytes2; + fetchParams.processRequestBodyChunkLength?.(bytes2.byteLength); }; const processEndOfBody = () => { if (isCancelled(fetchParams)) { @@ -14197,8 +14197,8 @@ var require_fetch = __commonJS({ }; requestBody = (async function* () { try { - for await (const bytes of request2.body.stream) { - yield* processBodyChunk(bytes); + for await (const bytes2 of request2.body.stream) { + yield* processBodyChunk(bytes2); } processEndOfBody(); } catch (err) { @@ -14249,33 +14249,33 @@ var require_fetch = __commonJS({ fetchParams.controller.on("terminated", onAborted); fetchParams.controller.resume = async () => { while (true) { - let bytes; + let bytes2; let isFailure; try { const { done, value } = await fetchParams.controller.next(); if (isAborted(fetchParams)) { break; } - bytes = done ? void 0 : value; + bytes2 = done ? void 0 : value; } catch (err) { if (fetchParams.controller.ended && !timingInfo.encodedBodySize) { - bytes = void 0; + bytes2 = void 0; } else { - bytes = err; + bytes2 = err; isFailure = true; } } - if (bytes === void 0) { + if (bytes2 === void 0) { readableStreamClose(fetchParams.controller.controller); finalizeResponse(fetchParams, response); return; } - timingInfo.decodedBodySize += bytes?.byteLength ?? 0; + timingInfo.decodedBodySize += bytes2?.byteLength ?? 0; if (isFailure) { - fetchParams.controller.terminate(bytes); + fetchParams.controller.terminate(bytes2); return; } - const buffer3 = new Uint8Array(bytes); + const buffer3 = new Uint8Array(bytes2); if (buffer3.byteLength) { fetchParams.controller.controller.enqueue(buffer3); } @@ -14401,9 +14401,9 @@ var require_fetch = __commonJS({ if (fetchParams.controller.dump) { return; } - const bytes = chunk; - timingInfo.encodedBodySize += bytes.byteLength; - return this.body.push(bytes); + const bytes2 = chunk; + timingInfo.encodedBodySize += bytes2.byteLength; + return this.body.push(bytes2); }, onComplete() { if (this.abort) { @@ -14852,7 +14852,7 @@ var require_util4 = __commonJS({ fr[kError] = null; const stream2 = blob.stream(); const reader = stream2.getReader(); - const bytes = []; + const bytes2 = []; let chunkPromise = reader.read(); let isFirstChunk = true; (async () => { @@ -14866,7 +14866,7 @@ var require_util4 = __commonJS({ } isFirstChunk = false; if (!done && types.isUint8Array(value)) { - bytes.push(value); + bytes2.push(value); if ((fr[kLastProgressEventFired] === void 0 || Date.now() - fr[kLastProgressEventFired] >= 50) && !fr[kAborted]) { fr[kLastProgressEventFired] = Date.now(); queueMicrotask(() => { @@ -14878,7 +14878,7 @@ var require_util4 = __commonJS({ queueMicrotask(() => { fr[kState] = "done"; try { - const result = packageData(bytes, type, blob.type, encodingName); + const result = packageData(bytes2, type, blob.type, encodingName); if (fr[kAborted]) { return; } @@ -14918,7 +14918,7 @@ var require_util4 = __commonJS({ }); reader.dispatchEvent(event); } - function packageData(bytes, type, mimeType, encodingName) { + function packageData(bytes2, type, mimeType, encodingName) { switch (type) { case "DataURL": { let dataURL = "data:"; @@ -14928,7 +14928,7 @@ var require_util4 = __commonJS({ } dataURL += ";base64,"; const decoder = new StringDecoder2("latin1"); - for (const chunk of bytes) { + for (const chunk of bytes2) { dataURL += btoa2(decoder.write(chunk)); } dataURL += btoa2(decoder.end()); @@ -14948,16 +14948,16 @@ var require_util4 = __commonJS({ if (encoding === "failure") { encoding = "UTF-8"; } - return decode(bytes, encoding); + return decode(bytes2, encoding); } case "ArrayBuffer": { - const sequence = combineByteSequences(bytes); + const sequence = combineByteSequences(bytes2); return sequence.buffer; } case "BinaryString": { let binaryString = ""; const decoder = new StringDecoder2("latin1"); - for (const chunk of bytes) { + for (const chunk of bytes2) { binaryString += decoder.write(chunk); } binaryString += decoder.end(); @@ -14966,14 +14966,14 @@ var require_util4 = __commonJS({ } } function decode(ioQueue, encoding) { - const bytes = combineByteSequences(ioQueue); - const BOMEncoding = BOMSniffing(bytes); + const bytes2 = combineByteSequences(ioQueue); + const BOMEncoding = BOMSniffing(bytes2); let slice = 0; if (BOMEncoding !== null) { encoding = BOMEncoding; slice = BOMEncoding === "UTF-8" ? 3 : 2; } - const sliced = bytes.slice(slice); + const sliced = bytes2.slice(slice); return new TextDecoder(encoding).decode(sliced); } function BOMSniffing(ioQueue) { @@ -15526,9 +15526,9 @@ var require_cache = __commonJS({ // 16. }; operations.push(operation); - const bytes = await bodyReadPromise.promise; + const bytes2 = await bodyReadPromise.promise; if (clonedResponse.body != null) { - clonedResponse.body.source = bytes; + clonedResponse.body.source = bytes2; } const cacheJobPromise = createDeferredPromise(); let errorData = null; @@ -23083,7 +23083,7 @@ var require_package = __commonJS({ "node_modules/@actions/cache/package.json"(exports2, module) { module.exports = { name: "@actions/cache", - version: "6.1.0", + version: "6.2.0", description: "Actions cache lib", keywords: [ "github", @@ -23200,7 +23200,7 @@ var require_base64 = __commonJS({ es -= 2; else if (base64Str[base64Str.length - 1] == "=") es -= 1; - let bytes = new Uint8Array(es), bytePos = 0, groupPos = 0, b, p = 0; + let bytes2 = new Uint8Array(es), bytePos = 0, groupPos = 0, b, p = 0; for (let i = 0; i < base64Str.length; i++) { b = decTable[base64Str.charCodeAt(i)]; if (b === void 0) { @@ -23224,30 +23224,30 @@ var require_base64 = __commonJS({ groupPos = 1; break; case 1: - bytes[bytePos++] = p << 2 | (b & 48) >> 4; + bytes2[bytePos++] = p << 2 | (b & 48) >> 4; p = b; groupPos = 2; break; case 2: - bytes[bytePos++] = (p & 15) << 4 | (b & 60) >> 2; + bytes2[bytePos++] = (p & 15) << 4 | (b & 60) >> 2; p = b; groupPos = 3; break; case 3: - bytes[bytePos++] = (p & 3) << 6 | b; + bytes2[bytePos++] = (p & 3) << 6 | b; groupPos = 0; break; } } if (groupPos == 1) throw Error(`invalid base64 string.`); - return bytes.subarray(0, bytePos); + return bytes2.subarray(0, bytePos); } exports2.base64decode = base64decode; - function base64encode2(bytes) { + function base64encode2(bytes2) { let base64 = "", groupPos = 0, b, p = 0; - for (let i = 0; i < bytes.length; i++) { - b = bytes[i]; + for (let i = 0; i < bytes2.length; i++) { + b = bytes2[i]; switch (groupPos) { case 0: base64 += encTable[b >> 2]; @@ -23285,23 +23285,23 @@ var require_protobufjs_utf8 = __commonJS({ Object.defineProperty(exports2, "__esModule", { value: true }); exports2.utf8read = void 0; var fromCharCodes = (chunk) => String.fromCharCode.apply(String, chunk); - function utf8read(bytes) { - if (bytes.length < 1) + function utf8read(bytes2) { + if (bytes2.length < 1) return ""; let pos = 0, parts = [], chunk = [], i = 0, t; - let len = bytes.length; + let len = bytes2.length; while (pos < len) { - t = bytes[pos++]; + t = bytes2[pos++]; if (t < 128) chunk[i++] = t; else if (t > 191 && t < 224) - chunk[i++] = (t & 31) << 6 | bytes[pos++] & 63; + chunk[i++] = (t & 31) << 6 | bytes2[pos++] & 63; else if (t > 239 && t < 365) { - t = ((t & 7) << 18 | (bytes[pos++] & 63) << 12 | (bytes[pos++] & 63) << 6 | bytes[pos++] & 63) - 65536; + t = ((t & 7) << 18 | (bytes2[pos++] & 63) << 12 | (bytes2[pos++] & 63) << 6 | bytes2[pos++] & 63) - 65536; chunk[i++] = 55296 + (t >> 10); chunk[i++] = 56320 + (t & 1023); } else - chunk[i++] = (t & 15) << 12 | (bytes[pos++] & 63) << 6 | bytes[pos++] & 63; + chunk[i++] = (t & 15) << 12 | (bytes2[pos++] & 63) << 6 | bytes2[pos++] & 63; if (i > 8191) { parts.push(fromCharCodes(chunk)); i = 0; @@ -23396,19 +23396,19 @@ var require_goog_varint = __commonJS({ throw new Error("invalid varint"); } exports2.varint64read = varint64read; - function varint64write(lo, hi, bytes) { + function varint64write(lo, hi, bytes2) { for (let i = 0; i < 28; i = i + 7) { const shift = lo >>> i; const hasNext = !(shift >>> 7 == 0 && hi == 0); const byte = (hasNext ? shift | 128 : shift) & 255; - bytes.push(byte); + bytes2.push(byte); if (!hasNext) { return; } } const splitBits = lo >>> 28 & 15 | (hi & 7) << 4; const hasMoreBits = !(hi >> 3 == 0); - bytes.push((hasMoreBits ? splitBits | 128 : splitBits) & 255); + bytes2.push((hasMoreBits ? splitBits | 128 : splitBits) & 255); if (!hasMoreBits) { return; } @@ -23416,12 +23416,12 @@ var require_goog_varint = __commonJS({ const shift = hi >>> i; const hasNext = !(shift >>> 7 == 0); const byte = (hasNext ? shift | 128 : shift) & 255; - bytes.push(byte); + bytes2.push(byte); if (!hasNext) { return; } } - bytes.push(hi >>> 31 & 1); + bytes2.push(hi >>> 31 & 1); } exports2.varint64write = varint64write; var TWO_PWR_32_DBL = (1 << 16) * (1 << 16); @@ -23491,19 +23491,19 @@ var require_goog_varint = __commonJS({ ); } exports2.int64toString = int64toString; - function varint32write(value, bytes) { + function varint32write(value, bytes2) { if (value >= 0) { while (value > 127) { - bytes.push(value & 127 | 128); + bytes2.push(value & 127 | 128); value = value >>> 7; } - bytes.push(value); + bytes2.push(value); } else { for (let i = 0; i < 9; i++) { - bytes.push(value & 127 | 128); + bytes2.push(value & 127 | 128); value = value >> 7; } - bytes.push(1); + bytes2.push(1); } } exports2.varint32write = varint32write; @@ -23774,7 +23774,7 @@ var require_binary_reader = __commonJS({ var goog_varint_1 = require_goog_varint(); var defaultsRead = { readUnknownField: true, - readerFactory: (bytes) => new BinaryReader(bytes) + readerFactory: (bytes2) => new BinaryReader(bytes2) }; function binaryReadOptions(options) { return options ? Object.assign(Object.assign({}, defaultsRead), options) : defaultsRead; @@ -24019,14 +24019,14 @@ var require_binary_writer = __commonJS({ let len = 0; for (let i = 0; i < this.chunks.length; i++) len += this.chunks[i].length; - let bytes = new Uint8Array(len); + let bytes2 = new Uint8Array(len); let offset = 0; for (let i = 0; i < this.chunks.length; i++) { - bytes.set(this.chunks[i], offset); + bytes2.set(this.chunks[i], offset); offset += this.chunks[i].length; } this.chunks = []; - return bytes; + return bytes2; } /** * Start a new fork for length-delimited data like a message @@ -31443,6 +31443,7 @@ var SystemTarPathOnWindows = `${process.env["SYSTEMDRIVE"]}\\Windows\\System32\\ var TarFilename = "cache.tar"; var ManifestFilename = "manifest.txt"; var CacheFileSizeLimit = 10 * Math.pow(1024, 3); +var CacheReadDeniedMessagePrefix = "cache read denied:"; // node_modules/@actions/cache/lib/internal/cacheUtils.js var __awaiter12 = function(thisArg, _arguments, P, generator) { @@ -59154,11 +59155,11 @@ var AvroParser = class _AvroParser { * @param options - */ static async readFixedBytes(stream2, length, options = {}) { - const bytes = await stream2.read(length, { abortSignal: options.abortSignal }); - if (bytes.length !== length) { + const bytes2 = await stream2.read(length, { abortSignal: options.abortSignal }); + if (bytes2.length !== length) { throw new Error("Hit stream end."); } - return bytes; + return bytes2; } /** * Reads a single byte from the stream. @@ -64154,6 +64155,20 @@ function getCacheServiceVersion() { return "v1"; return process.env["ACTIONS_CACHE_SERVICE_V2"] ? "v2" : "v1"; } +var KNOWN_CACHE_MODES = ["none", "read", "write", "write-only"]; +function getCacheMode() { + return (process.env["ACTIONS_CACHE_MODE"] || "").trim().toLowerCase(); +} +function isCacheReadable(mode) { + if (!KNOWN_CACHE_MODES.includes(mode)) + return true; + return mode === "read" || mode === "write"; +} +function isCacheWritable(mode) { + if (!KNOWN_CACHE_MODES.includes(mode)) + return true; + return mode === "write" || mode === "write-only"; +} function getCacheServiceURL() { const version3 = getCacheServiceVersion(); switch (version3) { @@ -64227,6 +64242,7 @@ function createHttpClient() { } function getCacheEntry(keys, paths, options) { return __awaiter16(this, void 0, void 0, function* () { + var _a; const httpClient2 = createHttpClient(); const version3 = getCacheVersion(paths, options === null || options === void 0 ? void 0 : options.compressionMethod, options === null || options === void 0 ? void 0 : options.enableCrossOsArchive); const resource = `cache?keys=${encodeURIComponent(keys.join(","))}&version=${version3}`; @@ -64240,6 +64256,10 @@ function getCacheEntry(keys, paths, options) { return null; } if (!isSuccessStatusCode(response.statusCode)) { + const errorMessage = (_a = response.error) === null || _a === void 0 ? void 0 : _a.message; + if (errorMessage === null || errorMessage === void 0 ? void 0 : errorMessage.includes(CacheReadDeniedMessagePrefix)) { + throw new Error(errorMessage); + } throw new Error(`Cache service responded with ${response.statusCode}`); } const cacheResult = response.result; @@ -65488,6 +65508,14 @@ var CacheWriteDeniedError = class _CacheWriteDeniedError extends ReserveCacheErr Object.setPrototypeOf(this, _CacheWriteDeniedError.prototype); } }; +var CACHE_READ_DENIED_PREFIX = CacheReadDeniedMessagePrefix; +var CacheReadDeniedError = class _CacheReadDeniedError extends Error { + constructor(message) { + super(message); + this.name = "CacheReadDeniedError"; + Object.setPrototypeOf(this, _CacheReadDeniedError.prototype); + } +}; var FinalizeCacheError = class _FinalizeCacheError extends Error { constructor(message) { super(message); @@ -65514,6 +65542,12 @@ function restoreCache(paths_1, primaryKey_1, restoreKeys_1, options_1) { const cacheServiceVersion = getCacheServiceVersion(); debug(`Cache service version: ${cacheServiceVersion}`); checkPaths(paths); + const cacheMode = getCacheMode(); + if (!isCacheReadable(cacheMode)) { + info(`Cache restore skipped: the effective cache-mode '${cacheMode}' does not permit reads.`); + debug(`Skipped restore for paths [${paths.join(", ")}] with primary key '${primaryKey}'.`); + return void 0; + } switch (cacheServiceVersion) { case "v2": return yield restoreCacheV2(paths, primaryKey, restoreKeys, options, enableCrossOsArchive); @@ -65525,6 +65559,7 @@ function restoreCache(paths_1, primaryKey_1, restoreKeys_1, options_1) { } function restoreCacheV1(paths_1, primaryKey_1, restoreKeys_1, options_1) { return __awaiter19(this, arguments, void 0, function* (paths, primaryKey, restoreKeys, options, enableCrossOsArchive = false) { + var _a; restoreKeys = restoreKeys || []; const keys = [primaryKey, ...restoreKeys]; debug("Resolved Keys:"); @@ -65538,10 +65573,19 @@ function restoreCacheV1(paths_1, primaryKey_1, restoreKeys_1, options_1) { const compressionMethod = yield getCompressionMethod(); let archivePath = ""; try { - const cacheEntry = yield getCacheEntry(keys, paths, { - compressionMethod, - enableCrossOsArchive - }); + let cacheEntry; + try { + cacheEntry = yield getCacheEntry(keys, paths, { + compressionMethod, + enableCrossOsArchive + }); + } catch (error2) { + const errorMessage = (_a = error2 === null || error2 === void 0 ? void 0 : error2.message) !== null && _a !== void 0 ? _a : ""; + if (errorMessage.includes(CACHE_READ_DENIED_PREFIX)) { + throw new CacheReadDeniedError(errorMessage); + } + throw error2; + } if (!(cacheEntry === null || cacheEntry === void 0 ? void 0 : cacheEntry.archiveLocation)) { return void 0; } @@ -65583,6 +65627,7 @@ function restoreCacheV1(paths_1, primaryKey_1, restoreKeys_1, options_1) { } function restoreCacheV2(paths_1, primaryKey_1, restoreKeys_1, options_1) { return __awaiter19(this, arguments, void 0, function* (paths, primaryKey, restoreKeys, options, enableCrossOsArchive = false) { + var _a; options = Object.assign(Object.assign({}, options), { useAzureSdk: true }); restoreKeys = restoreKeys || []; const keys = [primaryKey, ...restoreKeys]; @@ -65603,7 +65648,16 @@ function restoreCacheV2(paths_1, primaryKey_1, restoreKeys_1, options_1) { restoreKeys, version: getCacheVersion(paths, compressionMethod, enableCrossOsArchive) }; - const response = yield twirpClient.GetCacheEntryDownloadURL(request2); + let response; + try { + response = yield twirpClient.GetCacheEntryDownloadURL(request2); + } catch (error2) { + const errorMessage = (_a = error2 === null || error2 === void 0 ? void 0 : error2.message) !== null && _a !== void 0 ? _a : ""; + if (errorMessage.includes(CACHE_READ_DENIED_PREFIX)) { + throw new CacheReadDeniedError(errorMessage); + } + throw error2; + } if (!response.ok) { debug(`Cache not found for version ${request2.version} of keys: ${keys.join(", ")}`); return void 0; @@ -65659,6 +65713,12 @@ function saveCache2(paths_1, key_1, options_1) { debug(`Cache service version: ${cacheServiceVersion}`); checkPaths(paths); checkKey(key); + const cacheMode = getCacheMode(); + if (!isCacheWritable(cacheMode)) { + info(`Cache save skipped: the effective cache-mode '${cacheMode}' does not permit writes.`); + debug(`Skipped save for paths [${paths.join(", ")}] with key '${key}'.`); + return -1; + } switch (cacheServiceVersion) { case "v2": return yield saveCacheV2(paths, key, options, enableCrossOsArchive); @@ -65716,8 +65776,6 @@ function saveCacheV1(paths_1, key_1, options_1) { const typedError = error2; if (typedError.name === ValidationError.name) { throw error2; - } else if (typedError.name === CacheWriteDeniedError.name) { - warning(`Failed to save: ${typedError.message}`); } else if (typedError.name === ReserveCacheError.name) { info(`Failed to save: ${typedError.message}`); } else { @@ -65805,8 +65863,6 @@ function saveCacheV2(paths_1, key_1, options_1) { const typedError = error2; if (typedError.name === ValidationError.name) { throw error2; - } else if (typedError.name === CacheWriteDeniedError.name) { - warning(`Failed to save: ${typedError.message}`); } else if (typedError.name === ReserveCacheError.name) { info(`Failed to save: ${typedError.message}`); } else if (typedError.name === FinalizeCacheError.name) { @@ -70014,6 +70070,11 @@ function getZigCachePath() { import * as crypto5 from "node:crypto"; import * as fs10 from "node:fs"; import { pipeline as pipeline2 } from "node:stream/promises"; +function bytes(b) { + const out = new Uint8Array(b.byteLength); + out.set(b); + return out; +} async function parseKey(key_str) { const key_info = Buffer.from(key_str, "base64"); const id = key_info.subarray(2, 10); @@ -70075,11 +70136,11 @@ async function verifySignatureStream(pubkey, signature, tarball_path) { } else { return false; } - if (!await crypto5.subtle.verify("Ed25519", pubkey.key, signature.signature, signed_content)) { + if (!await crypto5.subtle.verify("Ed25519", pubkey.key, bytes(signature.signature), bytes(signed_content))) { return false; } const global_signed = Buffer.concat([signature.signature, signature.trusted_comment]); - return await crypto5.subtle.verify("Ed25519", pubkey.key, signature.global_signature, global_signed); + return await crypto5.subtle.verify("Ed25519", pubkey.key, bytes(signature.global_signature), bytes(global_signed)); } // src/race.ts diff --git a/dist/post/index.js b/dist/post/index.js index e9a1ae2..5deeff1 100644 --- a/dist/post/index.js +++ b/dist/post/index.js @@ -23986,7 +23986,7 @@ var require_package = __commonJS({ "node_modules/@actions/cache/package.json"(exports2, module) { module.exports = { name: "@actions/cache", - version: "6.1.0", + version: "6.2.0", description: "Actions cache lib", keywords: [ "github", @@ -66978,6 +66978,15 @@ function getCacheServiceVersion() { return "v1"; return process.env["ACTIONS_CACHE_SERVICE_V2"] ? "v2" : "v1"; } +var KNOWN_CACHE_MODES = ["none", "read", "write", "write-only"]; +function getCacheMode() { + return (process.env["ACTIONS_CACHE_MODE"] || "").trim().toLowerCase(); +} +function isCacheWritable(mode) { + if (!KNOWN_CACHE_MODES.includes(mode)) + return true; + return mode === "write" || mode === "write-only"; +} function getCacheServiceURL() { const version3 = getCacheServiceVersion(); switch (version3) { @@ -68267,6 +68276,12 @@ function saveCache2(paths_1, key_1, options_1) { debug(`Cache service version: ${cacheServiceVersion}`); checkPaths(paths); checkKey(key); + const cacheMode = getCacheMode(); + if (!isCacheWritable(cacheMode)) { + info(`Cache save skipped: the effective cache-mode '${cacheMode}' does not permit writes.`); + debug(`Skipped save for paths [${paths.join(", ")}] with key '${key}'.`); + return -1; + } switch (cacheServiceVersion) { case "v2": return yield saveCacheV2(paths, key, options, enableCrossOsArchive); @@ -68324,8 +68339,6 @@ function saveCacheV1(paths_1, key_1, options_1) { const typedError = error2; if (typedError.name === ValidationError.name) { throw error2; - } else if (typedError.name === CacheWriteDeniedError.name) { - warning(`Failed to save: ${typedError.message}`); } else if (typedError.name === ReserveCacheError.name) { info(`Failed to save: ${typedError.message}`); } else { @@ -68413,8 +68426,6 @@ function saveCacheV2(paths_1, key_1, options_1) { const typedError = error2; if (typedError.name === ValidationError.name) { throw error2; - } else if (typedError.name === CacheWriteDeniedError.name) { - warning(`Failed to save: ${typedError.message}`); } else if (typedError.name === ReserveCacheError.name) { info(`Failed to save: ${typedError.message}`); } else if (typedError.name === FinalizeCacheError.name) { diff --git a/package-lock.json b/package-lock.json index d0f3dfc..92fc8e0 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,16 +9,16 @@ "version": "1.0.2", "license": "MIT", "dependencies": { - "@actions/cache": "^6.1.0", + "@actions/cache": "^6.2.0", "@actions/core": "^3.0.1", "@actions/exec": "^3.0.0", "@actions/github": "^9.1.1", "@actions/tool-cache": "^4.0.0" }, "devDependencies": { - "@types/node": "^24.0.0", - "@typescript/native-preview": "^7.0.0-dev.20260527.2", - "esbuild": "^0.28.1", + "@types/node": "^26.2.0", + "@typescript/native-preview": "^7.0.0-dev.20260707.2", + "esbuild": "^0.28.2", "typescript": "^7.0.2" }, "engines": { @@ -26,9 +26,9 @@ } }, "node_modules/@actions/cache": { - "version": "6.1.0", - "resolved": "https://registry.npmjs.org/@actions/cache/-/cache-6.1.0.tgz", - "integrity": "sha512-LVqybSbzhBp2uAETOQ3HnVjXA4AcjavgMH+LCr+cjgO+PZfciv/1QAgoW+esXBaAhvDid+vXeV70GGJpAh4V5Q==", + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/@actions/cache/-/cache-6.2.0.tgz", + "integrity": "sha512-Nv0xWRmbxfDbAn/70flO/F6tj2Nv4XTYMAsQHiDFSojCDfso/Zni+fRKa14ToI9hnmOW/rQcY1WYb6wsM7Pgwg==", "license": "MIT", "dependencies": { "@actions/core": "^3.0.1", @@ -328,9 +328,9 @@ } }, "node_modules/@esbuild/aix-ppc64": { - "version": "0.28.1", - "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.28.1.tgz", - "integrity": "sha512-Svl7tq8k/08+p6CXPpRjQ1fKX+1odH/BQbb48fV6fj3CWHhsoIOoY87w1oHXm0qEpkIK3ZfVgp0hed3XBXzXMQ==", + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.28.2.tgz", + "integrity": "sha512-XExcO+dvLKvVtNTibSTBej1NCAbaGhWn9Ww1ZPx80qsahhPFe/8jgWP0IchNe0F3HwkU7n8ejhH8bjonqht8mQ==", "cpu": [ "ppc64" ], @@ -345,9 +345,9 @@ } }, "node_modules/@esbuild/android-arm": { - "version": "0.28.1", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.28.1.tgz", - "integrity": "sha512-0k2F129Xdio1TdJfzJ8sy1Q47vUD2NnwdhiAf7drUN1EBTfPf4hsFCtmMgu/6m8JSzsBrlmVjudMBQqOfG8usQ==", + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.28.2.tgz", + "integrity": "sha512-kXXoiPVVGQcnIYGOeaovwOURpniDBpSq4A03qkQ+BMQqtGG6HYap3xne9C1O1yo4TR3qxlCX5IqqmX6fFo2Lqg==", "cpu": [ "arm" ], @@ -362,9 +362,9 @@ } }, "node_modules/@esbuild/android-arm64": { - "version": "0.28.1", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.28.1.tgz", - "integrity": "sha512-34EGEbCIAgosYz6goLcopX6Mo7NyGv9tfwEM2/7Ce2VcVRk568iSvniGWcUXIy7wEDR1wzolcxcriFVrWYcwBg==", + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.28.2.tgz", + "integrity": "sha512-5YfKeeI8qWfBZIX+u2xZC3Zlb3Os/gLS2sbEKM+I4ZOcsWmHS2WLysCcQZDAFRslDUU5Oiq44gf6PYN1vGwG5A==", "cpu": [ "arm64" ], @@ -379,9 +379,9 @@ } }, "node_modules/@esbuild/android-x64": { - "version": "0.28.1", - "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.28.1.tgz", - "integrity": "sha512-dbwY7ltSMDWsRatcRpCnES4F+im88OCUgGZjy52shC7GqHRE/cYlxNbB4Z4UpJswpcc4Qxd2oE/ufM0p61IKng==", + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.28.2.tgz", + "integrity": "sha512-O387ite7SzUyCcy3JQX4P4bLtEA7bLLkx+esve5JHnyYfNTxcVpXZo9jhdB0lTKN44gztELTdU7nS8Nr16Fs1Q==", "cpu": [ "x64" ], @@ -396,9 +396,9 @@ } }, "node_modules/@esbuild/darwin-arm64": { - "version": "0.28.1", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.28.1.tgz", - "integrity": "sha512-TZbWkQY7kvTAXbXUT7uVACR5cMHsDiSz9z7ZKAX/RTq/WJEk3QyRr0wZpNhBDX+/0CtdqUIJlOiodQcta6tY3Q==", + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.28.2.tgz", + "integrity": "sha512-n4KqkOQrraxHJcgjM1RvwbigfQKIKJVpM7xp+KsxiyUSrRdIXnt73VhrPAx0fV44hgfmIVKjxMN9J1t5jySVkw==", "cpu": [ "arm64" ], @@ -413,9 +413,9 @@ } }, "node_modules/@esbuild/darwin-x64": { - "version": "0.28.1", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.28.1.tgz", - "integrity": "sha512-zfdzgK9ACBNZLI/CyHTOx81SyNbM6YXn7rxSgX97VjyiPl9W1i4Ka4fgKECEoFCKGpvBj5qArWIGgQjOwkgskQ==", + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.28.2.tgz", + "integrity": "sha512-uq6suIWYP37qzGddBKPw5QEQPi6HiLGsO7UmkpfyaYNQ3D+rN6w6WfwH+nuqcGXWvawGwxOEroO4YGnFh95azw==", "cpu": [ "x64" ], @@ -430,9 +430,9 @@ } }, "node_modules/@esbuild/freebsd-arm64": { - "version": "0.28.1", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.28.1.tgz", - "integrity": "sha512-wG2EA8ENdEI0qhkSZMjfqrdY+ziCYCPMmtZjjIwOmXFjmyzEHn+UUxk5of+SYsjtfs3VpnlC7QLzSI5hY/rOAw==", + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.28.2.tgz", + "integrity": "sha512-n+I0BTSRIoy+d6RPKnEVwql5UwBJolytvY4mAOIEJorKlqgPII8ix6slVVrfZ5Tnj7glIZvloylbB/EJPMWEXw==", "cpu": [ "arm64" ], @@ -447,9 +447,9 @@ } }, "node_modules/@esbuild/freebsd-x64": { - "version": "0.28.1", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.28.1.tgz", - "integrity": "sha512-i7dZ9vQgnvSCzi/rYCXNgtF/U+eKZNJBzu3eTQbRgHnM7tNSizLOkRFAl3qzVc/Op/u5YkHHa4pf/3DOYHthLQ==", + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.28.2.tgz", + "integrity": "sha512-78XJTJkvPs0kz2w61301PJjXl4g7q3JqiYMZ/M/yVI73EHBrCRTgkhu9oqG7vPqq+a/yadEW8aD+agKlk5xrmg==", "cpu": [ "x64" ], @@ -464,9 +464,9 @@ } }, "node_modules/@esbuild/linux-arm": { - "version": "0.28.1", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.28.1.tgz", - "integrity": "sha512-qVXBOHQS+d5Y722GwJzJUtOLlX7km3CraOaGormF1pDtPd2C/l1SHRPgjLunLGe51Sh5YYWKMFDyV4SxgMQYTQ==", + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.28.2.tgz", + "integrity": "sha512-XlDnu2q5yoqems+xay6wSAcg9DDD7K9RLKZEBOMZm3ckNpJBvOX20tSfby8KfrrhINDyv9V2YVZKY/SpoGJI8w==", "cpu": [ "arm" ], @@ -481,9 +481,9 @@ } }, "node_modules/@esbuild/linux-arm64": { - "version": "0.28.1", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.28.1.tgz", - "integrity": "sha512-yHs+0uc8+nvEAfAfxrWQKK5peSNzBc4PegcMO0EJ2hT71uA7vB8Ihg2e77R2P7SG5uYjPbHlLLmve4LLLRCf0g==", + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.28.2.tgz", + "integrity": "sha512-pW4AC0P3it8c7do9MVM4p51FzHzdM/TZrerurgRcHJ2WTa1VQ1CIq18xncfpBJw4ojkiZZrKW2yIBWBP92j6Ug==", "cpu": [ "arm64" ], @@ -498,9 +498,9 @@ } }, "node_modules/@esbuild/linux-ia32": { - "version": "0.28.1", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.28.1.tgz", - "integrity": "sha512-d1z4ZuP0ajrfz/FhGT4vv278rX8KnPPJx8i5+AtK7TYbx9Le9F1hyzurZpkEyjkGa9dUGhQow4C1NmeGvqxN2w==", + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.28.2.tgz", + "integrity": "sha512-CYbnj78HsIeA+DhgUKgFCfvNsTHFhMMrinUrMZpDXJXKN8T3XViTZ/+wtHeVxEWY8ewSzTFN+nRmSwO2tZaLUQ==", "cpu": [ "ia32" ], @@ -515,9 +515,9 @@ } }, "node_modules/@esbuild/linux-loong64": { - "version": "0.28.1", - "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.28.1.tgz", - "integrity": "sha512-M5sRjUVZrkm1OAPR3dlOYzNmN+loZKGVi1VUQGrwuqLcbR6qeAz+famMhjASeH3YVKvZz+zT1jlh/keC3Rj/lg==", + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.28.2.tgz", + "integrity": "sha512-buwkd8nsph4R+ajRvw0qM5Hja/TXQow3ptzWO2EbG/cqcIkHloRrdlBtQlshyYGTNFvfkfJ5tpPLVkY4DtsPfQ==", "cpu": [ "loong64" ], @@ -532,9 +532,9 @@ } }, "node_modules/@esbuild/linux-mips64el": { - "version": "0.28.1", - "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.28.1.tgz", - "integrity": "sha512-mRObBZeHh2OxcBFPWE/FjylkRgZdYuiTR3vaTozquCGOH14iP9oN4x4Ge81CoIDYQrXmIxpFumJBu5MtZpnQJQ==", + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.28.2.tgz", + "integrity": "sha512-ZVykbDyk7519VwiNb9Lcj9m8XM6v5V9uKPvrEMkkEedVewf+0itkhahp4HDpgERXhwLRpWFypsGbG/J8s0QjJA==", "cpu": [ "mips64el" ], @@ -549,9 +549,9 @@ } }, "node_modules/@esbuild/linux-ppc64": { - "version": "0.28.1", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.28.1.tgz", - "integrity": "sha512-slScBsMAb3GFDcdrCgLwZtPYRoH2H/youv10QiZyRjmsP48fznoveWytSgCI/R0ZcUgpc0ZhIUEx6LHts8yrfQ==", + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.28.2.tgz", + "integrity": "sha512-CAXl+Dtd9UUuJd8pKKdwh6MLm3MUMiqMPmhZ3tTSXPqfyQ3vDl6R5hZdZ/kYojK4ofXtdfSv1tFq8XzWx3heNQ==", "cpu": [ "ppc64" ], @@ -566,9 +566,9 @@ } }, "node_modules/@esbuild/linux-riscv64": { - "version": "0.28.1", - "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.28.1.tgz", - "integrity": "sha512-kw0owk1o0GFETUJyW0jc0G4Yzs0BHZn0JDZ8JRT088vjJYX777BAs1fDGxAC+q831qOs2DTC96mNsG2opdfyyQ==", + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.28.2.tgz", + "integrity": "sha512-GeXCej4IQtU1B+QlDV8W/RRvbzI3O/Stss+/bCXv4lZls5WGRtu2a+3JkA3i4qIUlMXpcHebWpF8AkJhATowuA==", "cpu": [ "riscv64" ], @@ -583,9 +583,9 @@ } }, "node_modules/@esbuild/linux-s390x": { - "version": "0.28.1", - "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.28.1.tgz", - "integrity": "sha512-/lAIjX8aYFRByhh6L5rYtPEDRqa9de/4V/juOXcta5frjvzXO4/sqEtyytse0g3zZFuWu5cDN0MkLz2qRDD2Ag==", + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.28.2.tgz", + "integrity": "sha512-3H1weTYZPxt/WOhByszQZybS9w5lKzUn1FDMsgEChbHWQwHYQQRfBxgCcZvPhjHfKyJjIievvMmEUawJrdY9Dg==", "cpu": [ "s390x" ], @@ -600,9 +600,9 @@ } }, "node_modules/@esbuild/linux-x64": { - "version": "0.28.1", - "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.28.1.tgz", - "integrity": "sha512-u/anNYF2mmVOEDwLtnQ1wOr3EZ9sTNGLWrsYGYwHWzGA3Si84IOkHXlbWTD1NB+9/1lcnweYKO54uhxZydNzfA==", + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.28.2.tgz", + "integrity": "sha512-4xTZr1FUmSoQW4XIWmit3tzQrUTZM+N3P0XV8xROKYF50XfI7xeO90+1bZvNwxIufQ9hDQVRJH5YhgPVF8A/HQ==", "cpu": [ "x64" ], @@ -617,9 +617,9 @@ } }, "node_modules/@esbuild/netbsd-arm64": { - "version": "0.28.1", - "resolved": "https://registry.npmjs.org/@esbuild/netbsd-arm64/-/netbsd-arm64-0.28.1.tgz", - "integrity": "sha512-oks0DYbLwWMmaakTsCb+zL4E+aHRVLom9IJZOAthMQEPiQmydXHkziYEsGYRx0uNV/IjEKGAV941JzH02pflqw==", + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-arm64/-/netbsd-arm64-0.28.2.tgz", + "integrity": "sha512-sSATRjPeDBg3pdgHoQfoYBob11Kk1FGa9lui5RIHZCoCkJa9QKlvl3/vKz2usCmYYjs7ymJR/2Nnsqe+Hjt5nw==", "cpu": [ "arm64" ], @@ -634,9 +634,9 @@ } }, "node_modules/@esbuild/netbsd-x64": { - "version": "0.28.1", - "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.28.1.tgz", - "integrity": "sha512-aeL6lAnN89Hz43Mlh1G8ARasbuoYvSITDEx0tHh5b7jJnHcssqgjy9Yx430GDpmCa6OyrKoS0aNRjKundRizGg==", + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.28.2.tgz", + "integrity": "sha512-lqnzCV+mM0gIADaKihiCg6ifgfU2L3h5E33rNQBN1Y4MaVGnzryzmvvf7UHxprpQdE8hpqLolJ9Rl+SkIRDpyw==", "cpu": [ "x64" ], @@ -651,9 +651,9 @@ } }, "node_modules/@esbuild/openbsd-arm64": { - "version": "0.28.1", - "resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.28.1.tgz", - "integrity": "sha512-MEFJe5C3R8pwXdZ5Y21oo6m7ePiS0d9pWucn99O/wvyJZChoIQKrQDxKrGeW8F5+T0okTHesAmDeiHDTIq0V/Q==", + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.28.2.tgz", + "integrity": "sha512-AL2qJILH7lNjrDmCQDvdxMfAUIv8KMNZOvrwAQ8i8//ntL9FflhOyMJ8OZSMBb8/AWXe3/5v5S20y3zCoZWKoQ==", "cpu": [ "arm64" ], @@ -668,9 +668,9 @@ } }, "node_modules/@esbuild/openbsd-x64": { - "version": "0.28.1", - "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.28.1.tgz", - "integrity": "sha512-i/ZLIOafE0Z8cI/XANJAixoJL/uRAoS2xOA3rb0xN+KK0K177cMAsQYkzHtBrtMXAKuAc7HGgcWiZ/sRC1Nxgw==", + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.28.2.tgz", + "integrity": "sha512-QtiuPytchRyC4rwUKhexJdQKvDuZ6hWloi3igqPQNUJCS1/v9EiO3UTOXR6A3FoMo4fnAKbWJdqaIwhOzh8qEw==", "cpu": [ "x64" ], @@ -685,9 +685,9 @@ } }, "node_modules/@esbuild/openharmony-arm64": { - "version": "0.28.1", - "resolved": "https://registry.npmjs.org/@esbuild/openharmony-arm64/-/openharmony-arm64-0.28.1.tgz", - "integrity": "sha512-ge+Z7EXFNt2BO1oAMsVpiQ8EwndV9i1xXerAeTIK7AtPs3bKFXQM7nlRxDSIUIMeueR1CNXxqztLzdNeReKBJg==", + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/openharmony-arm64/-/openharmony-arm64-0.28.2.tgz", + "integrity": "sha512-WkhYDmpTjLvGlScA1rwjRUmhl4k8oXR3cIbtqWmELgU/dFeHHlEllxDvdWcNJV9rbzCexB5vz8gtNewWLgCT7Q==", "cpu": [ "arm64" ], @@ -702,9 +702,9 @@ } }, "node_modules/@esbuild/sunos-x64": { - "version": "0.28.1", - "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.28.1.tgz", - "integrity": "sha512-BEjgtECkL3vY+SaSQ6nzVfiALUeFxpawyp8Jmf5PtYhf1Ug40N1h/hxlhts+f1FvSvarEigdxS3BlSMI2PJLcQ==", + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.28.2.tgz", + "integrity": "sha512-GPMSkTOtMnv2U2F8gxe4Io6qmVs+YKyp832Etqqxr0hFngmXQ3rzwytelm3GIn7T4VviRUlf3sOgBOiTdvaf7g==", "cpu": [ "x64" ], @@ -719,9 +719,9 @@ } }, "node_modules/@esbuild/win32-arm64": { - "version": "0.28.1", - "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.28.1.tgz", - "integrity": "sha512-lCv9eK/H6ZJWbE7bh2nw54CZ9M2nupBxJcTsdk/QQnWkdSjKGuxmmH8/GWrlT1eMmZfn4dGcCjRte397WqfQXA==", + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.28.2.tgz", + "integrity": "sha512-PIhhEkE9uPBleRBrQEJpUn7MBnibZzbGzYWPmY3x+YoVg/95zbjB4CxPPOQ8l5tYYM4mMaCthF8/1DIfBQQyWQ==", "cpu": [ "arm64" ], @@ -736,9 +736,9 @@ } }, "node_modules/@esbuild/win32-ia32": { - "version": "0.28.1", - "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.28.1.tgz", - "integrity": "sha512-zvb/mB2bSCoJOpoCBgYKKpX6YM6mJBlBUVUtVj41DlZJVEB6/0CKlRYxP5wWl1C1ILiCoAU5wZZ4q1P3qeS6Eg==", + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.28.2.tgz", + "integrity": "sha512-YmJbfTlvU7Sdn9BB+4PRES4oB6pxgS37MAONj+hBr/cpXS1aBPKXxNnDbu+QCWPj0o9dgyxeq79g6c5P8KeuYA==", "cpu": [ "ia32" ], @@ -753,9 +753,9 @@ } }, "node_modules/@esbuild/win32-x64": { - "version": "0.28.1", - "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.28.1.tgz", - "integrity": "sha512-bm4Mowrv+GXMlpWX++EcXw/iLyd1o3+bJkC2DkWXYVvgZCqD/bSj9ctZeAMC3cIxgjRVR2Dufaiu4YPxr5gW1A==", + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.28.2.tgz", + "integrity": "sha512-5ebpxr3nWMzrL/rnUI755Jkuee0bHL/Gq0WTF9lvcpv73wAp5eu8MfBUgWK9bhWvZjj7yX8etf/8tI8Ney695g==", "cpu": [ "x64" ], @@ -925,41 +925,41 @@ } }, "node_modules/@types/node": { - "version": "24.12.4", - "resolved": "https://registry.npmjs.org/@types/node/-/node-24.12.4.tgz", - "integrity": "sha512-GUUEShf+PBCGW2KaXwcIt3Yk+e3pkKwWKb9GSyM9WQVE+ep2jzmHdGsHzu4wgcZy5fN9FBdVzjpBQsYlpfpgLA==", + "version": "26.2.0", + "resolved": "https://registry.npmjs.org/@types/node/-/node-26.2.0.tgz", + "integrity": "sha512-5IviulTZeRNp2vAJ514cc/HUlY5nZ9fCbq9DMyC52BrhFZACo3nI0R7qBxhQmo/d27NFe96ur/b7Wwxklda+kg==", "dev": true, "license": "MIT", "dependencies": { - "undici-types": "~7.16.0" + "undici-types": "~8.3.0" } }, "node_modules/@typescript/native-preview": { - "version": "7.0.0-dev.20260527.2", - "resolved": "https://registry.npmjs.org/@typescript/native-preview/-/native-preview-7.0.0-dev.20260527.2.tgz", - "integrity": "sha512-piqkDwikVeizCFqA1lcwI5F4wOAtBdxuliWe77ApBNRyBPPvfCJB+u/HYi9/8t5nd0sWvFs6/qt/AzJ1CCoykQ==", + "version": "7.0.0-dev.20260707.2", + "resolved": "https://registry.npmjs.org/@typescript/native-preview/-/native-preview-7.0.0-dev.20260707.2.tgz", + "integrity": "sha512-oUGp+Rep/hqMhPunyinsALUwSlzHINSxitifPiSaeqoKOKD2OlR9NE3TaPqwsl4NlGslsOSUXI1JotWQzpYCPg==", "dev": true, "license": "Apache-2.0", "bin": { - "tsgo": "bin/tsgo.js" + "tsgo": "bin/tsgo" }, "engines": { "node": ">=16.20.0" }, "optionalDependencies": { - "@typescript/native-preview-darwin-arm64": "7.0.0-dev.20260527.2", - "@typescript/native-preview-darwin-x64": "7.0.0-dev.20260527.2", - "@typescript/native-preview-linux-arm": "7.0.0-dev.20260527.2", - "@typescript/native-preview-linux-arm64": "7.0.0-dev.20260527.2", - "@typescript/native-preview-linux-x64": "7.0.0-dev.20260527.2", - "@typescript/native-preview-win32-arm64": "7.0.0-dev.20260527.2", - "@typescript/native-preview-win32-x64": "7.0.0-dev.20260527.2" + "@typescript/native-preview-darwin-arm64": "7.0.0-dev.20260707.2", + "@typescript/native-preview-darwin-x64": "7.0.0-dev.20260707.2", + "@typescript/native-preview-linux-arm": "7.0.0-dev.20260707.2", + "@typescript/native-preview-linux-arm64": "7.0.0-dev.20260707.2", + "@typescript/native-preview-linux-x64": "7.0.0-dev.20260707.2", + "@typescript/native-preview-win32-arm64": "7.0.0-dev.20260707.2", + "@typescript/native-preview-win32-x64": "7.0.0-dev.20260707.2" } }, "node_modules/@typescript/native-preview-darwin-arm64": { - "version": "7.0.0-dev.20260527.2", - "resolved": "https://registry.npmjs.org/@typescript/native-preview-darwin-arm64/-/native-preview-darwin-arm64-7.0.0-dev.20260527.2.tgz", - "integrity": "sha512-3LqSu4DlxkEfeC/Z/29QMCJn5jjkDtXI7LYuxfmjdmAatS6umDKqm8J17fnP/7fyrZUMBTIYRwSDpChGV3G1ew==", + "version": "7.0.0-dev.20260707.2", + "resolved": "https://registry.npmjs.org/@typescript/native-preview-darwin-arm64/-/native-preview-darwin-arm64-7.0.0-dev.20260707.2.tgz", + "integrity": "sha512-wny2pgKjGbiZtnOIHVa3tXC1UfDqxNEFzyPGmiqybedG8hipG2Nfp0l5UxbaKCjkLacUpH/W5bP2hBOMVhCOzg==", "cpu": [ "arm64" ], @@ -974,9 +974,9 @@ } }, "node_modules/@typescript/native-preview-darwin-x64": { - "version": "7.0.0-dev.20260527.2", - "resolved": "https://registry.npmjs.org/@typescript/native-preview-darwin-x64/-/native-preview-darwin-x64-7.0.0-dev.20260527.2.tgz", - "integrity": "sha512-H4+sxE9qaBbLF83wMdWE0FsgfK0Pom+/O+/oxqyGzhVkDJlNt3vfpgQZMit48/Gm44AacGfBggJ9Dhbi3aeSFw==", + "version": "7.0.0-dev.20260707.2", + "resolved": "https://registry.npmjs.org/@typescript/native-preview-darwin-x64/-/native-preview-darwin-x64-7.0.0-dev.20260707.2.tgz", + "integrity": "sha512-Afc7M5zOwo+GpfcYwz5Z8HMB2tPVsui7nNIqEuuFB73MPdVqNn/Wmpe4tP4MRri0AtJnJknoHBaTJ/VDAp/Jhw==", "cpu": [ "x64" ], @@ -991,9 +991,9 @@ } }, "node_modules/@typescript/native-preview-linux-arm": { - "version": "7.0.0-dev.20260527.2", - "resolved": "https://registry.npmjs.org/@typescript/native-preview-linux-arm/-/native-preview-linux-arm-7.0.0-dev.20260527.2.tgz", - "integrity": "sha512-6I9Cv9ozwfS9zB9vRQDPIYseLX3artEO9jl3yVgLj4ishwlSF4cWAbIsjl5IztPaEgHv8coej/6tX1D0uaBzXg==", + "version": "7.0.0-dev.20260707.2", + "resolved": "https://registry.npmjs.org/@typescript/native-preview-linux-arm/-/native-preview-linux-arm-7.0.0-dev.20260707.2.tgz", + "integrity": "sha512-hJm/UOqZTr9FHmR7uNm8VGX4oKtfWk0Jem0zPeJFNC8ckGUfSBueyiEYMZB+XmRc1aG4x1E46y3CplP4CLHvGQ==", "cpu": [ "arm" ], @@ -1008,9 +1008,9 @@ } }, "node_modules/@typescript/native-preview-linux-arm64": { - "version": "7.0.0-dev.20260527.2", - "resolved": "https://registry.npmjs.org/@typescript/native-preview-linux-arm64/-/native-preview-linux-arm64-7.0.0-dev.20260527.2.tgz", - "integrity": "sha512-BGUDMjC2Z3TTdZRkGGwhBLelkP5UYgO2rbep8aF4dS3fu7T5lFPPrnfS6EgqJgie+cF5Fsev7xEq8wWyBDM+lg==", + "version": "7.0.0-dev.20260707.2", + "resolved": "https://registry.npmjs.org/@typescript/native-preview-linux-arm64/-/native-preview-linux-arm64-7.0.0-dev.20260707.2.tgz", + "integrity": "sha512-iITBa2WjjTI5N9t5l7Z4KoOSI+2zBlhbvFzsD/f8qX8QoKjz/Y4DPyBDgezYi8nkqjjksbgSOJ3/ykzhwrB9cg==", "cpu": [ "arm64" ], @@ -1025,9 +1025,9 @@ } }, "node_modules/@typescript/native-preview-linux-x64": { - "version": "7.0.0-dev.20260527.2", - "resolved": "https://registry.npmjs.org/@typescript/native-preview-linux-x64/-/native-preview-linux-x64-7.0.0-dev.20260527.2.tgz", - "integrity": "sha512-vpazOu+ozlxBo8U57YJMzsOPuxAV8H7fu36KJ8ea8At/D8pdGmOAy5TuB+9OBQV9JDe0OXJMy2kmbhOpmkTAmA==", + "version": "7.0.0-dev.20260707.2", + "resolved": "https://registry.npmjs.org/@typescript/native-preview-linux-x64/-/native-preview-linux-x64-7.0.0-dev.20260707.2.tgz", + "integrity": "sha512-du0dzi6y97Po5vDNdPJTyyijHCpaS22JLRnKZEJXBDaO9gCIymOv/5QQokFRuOlQm0bWl3i9PF4OVdGP6uAOQA==", "cpu": [ "x64" ], @@ -1042,9 +1042,9 @@ } }, "node_modules/@typescript/native-preview-win32-arm64": { - "version": "7.0.0-dev.20260527.2", - "resolved": "https://registry.npmjs.org/@typescript/native-preview-win32-arm64/-/native-preview-win32-arm64-7.0.0-dev.20260527.2.tgz", - "integrity": "sha512-DBFnFE3V6AITkPO1K1VxXf3yEZKjU2FwtXlNwRqhzDu0rrL2SsJHOSrBDX+OacTxQFzZMxFcpiuhV8jHZALPEg==", + "version": "7.0.0-dev.20260707.2", + "resolved": "https://registry.npmjs.org/@typescript/native-preview-win32-arm64/-/native-preview-win32-arm64-7.0.0-dev.20260707.2.tgz", + "integrity": "sha512-SsAwfhyHJ1akgBc+99z4+hwdbHsdWaKB8EwCNIMA6JfSLMeUjffrYvxu+vfMyxVtOVOz7RrRXRoiDiu4a2sCtg==", "cpu": [ "arm64" ], @@ -1059,9 +1059,9 @@ } }, "node_modules/@typescript/native-preview-win32-x64": { - "version": "7.0.0-dev.20260527.2", - "resolved": "https://registry.npmjs.org/@typescript/native-preview-win32-x64/-/native-preview-win32-x64-7.0.0-dev.20260527.2.tgz", - "integrity": "sha512-1tBlErMvQgcMqqYwsx4tytupcjCJcOUXD3vBn1Wb/kAvus1FzWQAFE0fcKBvLfcqLQfTiiEwKKEtbLjGmakqqg==", + "version": "7.0.0-dev.20260707.2", + "resolved": "https://registry.npmjs.org/@typescript/native-preview-win32-x64/-/native-preview-win32-x64-7.0.0-dev.20260707.2.tgz", + "integrity": "sha512-DL4u27stv0fo71sVhOzHSwE+YMZsbBijVI+kg5dLDLilSH79WFTJ8RSQ46vJrCMt+Gjlv/JOZP1PuLJDfioYeQ==", "cpu": [ "x64" ], @@ -1497,9 +1497,9 @@ } }, "node_modules/esbuild": { - "version": "0.28.1", - "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.28.1.tgz", - "integrity": "sha512-HrJrvZv5ayxBzPfwphOoNzkzOIIlifzk0KJrGK2c8R4+LKpMtpYLQeUdjnwjWv/LZlkH2laZk+4w78pi99D4Vw==", + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.28.2.tgz", + "integrity": "sha512-HKVLS8dvII+xoKW9kmqxbRKrnWEXfJJr/FZhhJmiqIB0e053QNYFqOBouTMO/k5sID4MvCiUCvv8b9M4h32wIA==", "dev": true, "hasInstallScript": true, "license": "MIT", @@ -1510,32 +1510,32 @@ "node": ">=18" }, "optionalDependencies": { - "@esbuild/aix-ppc64": "0.28.1", - "@esbuild/android-arm": "0.28.1", - "@esbuild/android-arm64": "0.28.1", - "@esbuild/android-x64": "0.28.1", - "@esbuild/darwin-arm64": "0.28.1", - "@esbuild/darwin-x64": "0.28.1", - "@esbuild/freebsd-arm64": "0.28.1", - "@esbuild/freebsd-x64": "0.28.1", - "@esbuild/linux-arm": "0.28.1", - "@esbuild/linux-arm64": "0.28.1", - "@esbuild/linux-ia32": "0.28.1", - "@esbuild/linux-loong64": "0.28.1", - "@esbuild/linux-mips64el": "0.28.1", - "@esbuild/linux-ppc64": "0.28.1", - "@esbuild/linux-riscv64": "0.28.1", - "@esbuild/linux-s390x": "0.28.1", - "@esbuild/linux-x64": "0.28.1", - "@esbuild/netbsd-arm64": "0.28.1", - "@esbuild/netbsd-x64": "0.28.1", - "@esbuild/openbsd-arm64": "0.28.1", - "@esbuild/openbsd-x64": "0.28.1", - "@esbuild/openharmony-arm64": "0.28.1", - "@esbuild/sunos-x64": "0.28.1", - "@esbuild/win32-arm64": "0.28.1", - "@esbuild/win32-ia32": "0.28.1", - "@esbuild/win32-x64": "0.28.1" + "@esbuild/aix-ppc64": "0.28.2", + "@esbuild/android-arm": "0.28.2", + "@esbuild/android-arm64": "0.28.2", + "@esbuild/android-x64": "0.28.2", + "@esbuild/darwin-arm64": "0.28.2", + "@esbuild/darwin-x64": "0.28.2", + "@esbuild/freebsd-arm64": "0.28.2", + "@esbuild/freebsd-x64": "0.28.2", + "@esbuild/linux-arm": "0.28.2", + "@esbuild/linux-arm64": "0.28.2", + "@esbuild/linux-ia32": "0.28.2", + "@esbuild/linux-loong64": "0.28.2", + "@esbuild/linux-mips64el": "0.28.2", + "@esbuild/linux-ppc64": "0.28.2", + "@esbuild/linux-riscv64": "0.28.2", + "@esbuild/linux-s390x": "0.28.2", + "@esbuild/linux-x64": "0.28.2", + "@esbuild/netbsd-arm64": "0.28.2", + "@esbuild/netbsd-x64": "0.28.2", + "@esbuild/openbsd-arm64": "0.28.2", + "@esbuild/openbsd-x64": "0.28.2", + "@esbuild/openharmony-arm64": "0.28.2", + "@esbuild/sunos-x64": "0.28.2", + "@esbuild/win32-arm64": "0.28.2", + "@esbuild/win32-ia32": "0.28.2", + "@esbuild/win32-x64": "0.28.2" } }, "node_modules/events": { @@ -1734,9 +1734,9 @@ } }, "node_modules/undici-types": { - "version": "7.16.0", - "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-7.16.0.tgz", - "integrity": "sha512-Zz+aZWSj8LE6zoxD+xrjh4VfkIG8Ya6LvYkZqtUQGJPZjYl53ypCaUwWqo7eI0x66KBGeRo+mlBEkMSeSZ38Nw==", + "version": "8.3.0", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-8.3.0.tgz", + "integrity": "sha512-j375ScV60dom+YkPFIfTLcOiPxkN/buHz5GobjLhixFuANaNs3C9l4GmrWqejgXWJ7BbJcFYpTEUkS1Ge8bpZQ==", "dev": true, "license": "MIT" }, diff --git a/package.json b/package.json index 80917da..2be1499 100644 --- a/package.json +++ b/package.json @@ -33,16 +33,16 @@ "minisign" ], "dependencies": { - "@actions/cache": "^6.1.0", + "@actions/cache": "^6.2.0", "@actions/core": "^3.0.1", "@actions/exec": "^3.0.0", "@actions/github": "^9.1.1", "@actions/tool-cache": "^4.0.0" }, "devDependencies": { - "@types/node": "^24.0.0", - "@typescript/native-preview": "^7.0.0-dev.20260527.2", - "esbuild": "^0.28.1", + "@types/node": "^26.2.0", + "@typescript/native-preview": "^7.0.0-dev.20260707.2", + "esbuild": "^0.28.2", "typescript": "^7.0.2" } } diff --git a/src/minisign.ts b/src/minisign.ts index 107d823..b5c01de 100644 --- a/src/minisign.ts +++ b/src/minisign.ts @@ -2,6 +2,17 @@ import * as crypto from 'node:crypto'; import * as fs from 'node:fs'; import { pipeline } from 'node:stream/promises'; +// Node's Buffer is typed `Buffer`, but Web Crypto's +// `BufferSource` wants an ArrayBuffer-backed view (ArrayBufferLike also +// admits SharedArrayBuffer). Present our buffers as a plain Uint8Array so +// the crypto calls type-check under strict @types/node. The copy is tiny — +// signatures, digests and trusted comments are all a few dozen bytes. +function bytes(b: Buffer): Uint8Array { + const out = new Uint8Array(b.byteLength); + out.set(b); + return out; +} + export interface ParsedKey { id: Buffer; key: crypto.webcrypto.CryptoKey; @@ -93,12 +104,12 @@ export async function verifySignatureStream( return false; } - if (!await crypto.subtle.verify('Ed25519', pubkey.key, signature.signature, signed_content)) { + if (!await crypto.subtle.verify('Ed25519', pubkey.key, bytes(signature.signature), bytes(signed_content))) { return false; } const global_signed = Buffer.concat([signature.signature, signature.trusted_comment]); - return await crypto.subtle.verify('Ed25519', pubkey.key, signature.global_signature, global_signed); + return await crypto.subtle.verify('Ed25519', pubkey.key, bytes(signature.global_signature), bytes(global_signed)); } // In-memory verification, kept for tests against small fixtures. @@ -120,10 +131,10 @@ export async function verifySignature( return false; } - if (!await crypto.subtle.verify('Ed25519', pubkey.key, signature.signature, signed_content)) { + if (!await crypto.subtle.verify('Ed25519', pubkey.key, bytes(signature.signature), bytes(signed_content))) { return false; } const global_signed = Buffer.concat([signature.signature, signature.trusted_comment]); - return await crypto.subtle.verify('Ed25519', pubkey.key, signature.global_signature, global_signed); + return await crypto.subtle.verify('Ed25519', pubkey.key, bytes(signature.global_signature), bytes(global_signed)); }