Skip to content

Commit 816d9db

Browse files
Upgrade @action/cache from 4.0.2 to 4.0.3 (#1233)
1 parent ba23c1c commit 816d9db

File tree

4 files changed

+91
-9
lines changed

4 files changed

+91
-9
lines changed

.licenses/npm/@actions/cache.dep.yml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index.js

Lines changed: 85 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2921,7 +2921,7 @@ function restoreCacheV2(paths, primaryKey, restoreKeys, options, enableCrossOsAr
29212921
};
29222922
const response = yield twirpClient.GetCacheEntryDownloadURL(request);
29232923
if (!response.ok) {
2924-
core.debug(`Cache not found for keys: ${keys.join(', ')}`);
2924+
core.debug(`Cache not found for version ${request.version} of keys: ${keys.join(', ')}`);
29252925
return undefined;
29262926
}
29272927
core.info(`Cache hit for: ${request.key}`);
@@ -4905,6 +4905,7 @@ const cacheUtils_1 = __nccwpck_require__(1518);
49054905
const auth_1 = __nccwpck_require__(5526);
49064906
const http_client_1 = __nccwpck_require__(6255);
49074907
const cache_twirp_client_1 = __nccwpck_require__(2655);
4908+
const util_1 = __nccwpck_require__(1953);
49084909
/**
49094910
* This class is a wrapper around the CacheServiceClientJSON class generated by Twirp.
49104911
*
@@ -4964,6 +4965,7 @@ class CacheServiceClient {
49644965
(0, core_1.debug)(`[Response] - ${response.message.statusCode}`);
49654966
(0, core_1.debug)(`Headers: ${JSON.stringify(response.message.headers, null, 2)}`);
49664967
const body = JSON.parse(rawBody);
4968+
(0, util_1.maskSecretUrls)(body);
49674969
(0, core_1.debug)(`Body: ${JSON.stringify(body, null, 2)}`);
49684970
if (this.isSuccessStatusCode(statusCode)) {
49694971
return { response, body };
@@ -5145,6 +5147,87 @@ exports.getUserAgentString = getUserAgentString;
51455147

51465148
/***/ }),
51475149

5150+
/***/ 1953:
5151+
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
5152+
5153+
"use strict";
5154+
5155+
Object.defineProperty(exports, "__esModule", ({ value: true }));
5156+
exports.maskSecretUrls = exports.maskSigUrl = void 0;
5157+
const core_1 = __nccwpck_require__(2186);
5158+
/**
5159+
* Masks the `sig` parameter in a URL and sets it as a secret.
5160+
*
5161+
* @param url - The URL containing the signature parameter to mask
5162+
* @remarks
5163+
* This function attempts to parse the provided URL and identify the 'sig' query parameter.
5164+
* If found, it registers both the raw and URL-encoded signature values as secrets using
5165+
* the Actions `setSecret` API, which prevents them from being displayed in logs.
5166+
*
5167+
* The function handles errors gracefully if URL parsing fails, logging them as debug messages.
5168+
*
5169+
* @example
5170+
* ```typescript
5171+
* // Mask a signature in an Azure SAS token URL
5172+
* maskSigUrl('https://example.blob.core.windows.net/container/file.txt?sig=abc123&se=2023-01-01');
5173+
* ```
5174+
*/
5175+
function maskSigUrl(url) {
5176+
if (!url)
5177+
return;
5178+
try {
5179+
const parsedUrl = new URL(url);
5180+
const signature = parsedUrl.searchParams.get('sig');
5181+
if (signature) {
5182+
(0, core_1.setSecret)(signature);
5183+
(0, core_1.setSecret)(encodeURIComponent(signature));
5184+
}
5185+
}
5186+
catch (error) {
5187+
(0, core_1.debug)(`Failed to parse URL: ${url} ${error instanceof Error ? error.message : String(error)}`);
5188+
}
5189+
}
5190+
exports.maskSigUrl = maskSigUrl;
5191+
/**
5192+
* Masks sensitive information in URLs containing signature parameters.
5193+
* Currently supports masking 'sig' parameters in the 'signed_upload_url'
5194+
* and 'signed_download_url' properties of the provided object.
5195+
*
5196+
* @param body - The object should contain a signature
5197+
* @remarks
5198+
* This function extracts URLs from the object properties and calls maskSigUrl
5199+
* on each one to redact sensitive signature information. The function doesn't
5200+
* modify the original object; it only marks the signatures as secrets for
5201+
* logging purposes.
5202+
*
5203+
* @example
5204+
* ```typescript
5205+
* const responseBody = {
5206+
* signed_upload_url: 'https://blob.core.windows.net/?sig=abc123',
5207+
* signed_download_url: 'https://blob.core/windows.net/?sig=def456'
5208+
* };
5209+
* maskSecretUrls(responseBody);
5210+
* ```
5211+
*/
5212+
function maskSecretUrls(body) {
5213+
if (typeof body !== 'object' || body === null) {
5214+
(0, core_1.debug)('body is not an object or is null');
5215+
return;
5216+
}
5217+
if ('signed_upload_url' in body &&
5218+
typeof body.signed_upload_url === 'string') {
5219+
maskSigUrl(body.signed_upload_url);
5220+
}
5221+
if ('signed_download_url' in body &&
5222+
typeof body.signed_download_url === 'string') {
5223+
maskSigUrl(body.signed_download_url);
5224+
}
5225+
}
5226+
exports.maskSecretUrls = maskSecretUrls;
5227+
//# sourceMappingURL=util.js.map
5228+
5229+
/***/ }),
5230+
51485231
/***/ 6490:
51495232
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
51505233

@@ -96703,7 +96786,7 @@ module.exports = parseParams
9670396786
/***/ ((module) => {
9670496787

9670596788
"use strict";
96706-
module.exports = JSON.parse('{"name":"@actions/cache","version":"4.0.2","preview":true,"description":"Actions cache lib","keywords":["github","actions","cache"],"homepage":"https://github.com/actions/toolkit/tree/main/packages/cache","license":"MIT","main":"lib/cache.js","types":"lib/cache.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/cache"},"scripts":{"audit-moderate":"npm install && npm audit --json --audit-level=moderate > audit.json","test":"echo \\"Error: run tests from root\\" && exit 1","tsc":"tsc"},"bugs":{"url":"https://github.com/actions/toolkit/issues"},"dependencies":{"@actions/core":"^1.11.1","@actions/exec":"^1.0.1","@actions/glob":"^0.1.0","@actions/http-client":"^2.1.1","@actions/io":"^1.0.1","@azure/abort-controller":"^1.1.0","@azure/ms-rest-js":"^2.6.0","@azure/storage-blob":"^12.13.0","@protobuf-ts/plugin":"^2.9.4","semver":"^6.3.1"},"devDependencies":{"@types/semver":"^6.0.0","typescript":"^5.2.2"}}');
96789+
module.exports = JSON.parse('{"name":"@actions/cache","version":"4.0.3","preview":true,"description":"Actions cache lib","keywords":["github","actions","cache"],"homepage":"https://github.com/actions/toolkit/tree/main/packages/cache","license":"MIT","main":"lib/cache.js","types":"lib/cache.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/cache"},"scripts":{"audit-moderate":"npm install && npm audit --json --audit-level=moderate > audit.json","test":"echo \\"Error: run tests from root\\" && exit 1","tsc":"tsc"},"bugs":{"url":"https://github.com/actions/toolkit/issues"},"dependencies":{"@actions/core":"^1.11.1","@actions/exec":"^1.0.1","@actions/glob":"^0.1.0","@actions/http-client":"^2.1.1","@actions/io":"^1.0.1","@azure/abort-controller":"^1.1.0","@azure/ms-rest-js":"^2.6.0","@azure/storage-blob":"^12.13.0","@protobuf-ts/plugin":"^2.9.4","semver":"^6.3.1"},"devDependencies":{"@types/node":"^22.13.9","@types/semver":"^6.0.0","typescript":"^5.2.2"}}');
9670796790

9670896791
/***/ }),
9670996792

package-lock.json

Lines changed: 4 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
"author": "GitHub",
3838
"license": "MIT",
3939
"dependencies": {
40-
"@actions/cache": "^4.0.2",
40+
"@actions/cache": "^4.0.3",
4141
"@actions/core": "^1.11.1",
4242
"@actions/github": "^5.1.1",
4343
"@octokit/core": "^4.2.0",

0 commit comments

Comments
 (0)