@@ -2921,7 +2921,7 @@ function restoreCacheV2(paths, primaryKey, restoreKeys, options, enableCrossOsAr
2921
2921
};
2922
2922
const response = yield twirpClient.GetCacheEntryDownloadURL(request);
2923
2923
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(', ')}`);
2925
2925
return undefined;
2926
2926
}
2927
2927
core.info(`Cache hit for: ${request.key}`);
@@ -4905,6 +4905,7 @@ const cacheUtils_1 = __nccwpck_require__(1518);
4905
4905
const auth_1 = __nccwpck_require__(5526);
4906
4906
const http_client_1 = __nccwpck_require__(6255);
4907
4907
const cache_twirp_client_1 = __nccwpck_require__(2655);
4908
+ const util_1 = __nccwpck_require__(1953);
4908
4909
/**
4909
4910
* This class is a wrapper around the CacheServiceClientJSON class generated by Twirp.
4910
4911
*
@@ -4964,6 +4965,7 @@ class CacheServiceClient {
4964
4965
(0, core_1.debug)(`[Response] - ${response.message.statusCode}`);
4965
4966
(0, core_1.debug)(`Headers: ${JSON.stringify(response.message.headers, null, 2)}`);
4966
4967
const body = JSON.parse(rawBody);
4968
+ (0, util_1.maskSecretUrls)(body);
4967
4969
(0, core_1.debug)(`Body: ${JSON.stringify(body, null, 2)}`);
4968
4970
if (this.isSuccessStatusCode(statusCode)) {
4969
4971
return { response, body };
@@ -5145,6 +5147,87 @@ exports.getUserAgentString = getUserAgentString;
5145
5147
5146
5148
/***/ }),
5147
5149
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
+
5148
5231
/***/ 6490:
5149
5232
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
5150
5233
@@ -96703,7 +96786,7 @@ module.exports = parseParams
96703
96786
/***/ ((module) => {
96704
96787
96705
96788
"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"}}');
96707
96790
96708
96791
/***/ }),
96709
96792
0 commit comments