mirror of
				https://github.com/actions/cache.git
				synced 2025-10-31 02:14:19 +08:00 
			
		
		
		
	updates
This commit is contained in:
		
							parent
							
								
									edd449b9cf
								
							
						
					
					
						commit
						45cfd0e7ff
					
				
							
								
								
									
										123
									
								
								dist/restore-only/index.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										123
									
								
								dist/restore-only/index.js
									
									
									
									
										vendored
									
									
								
							| @ -8754,7 +8754,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge | |||||||
|     }); |     }); | ||||||
| }; | }; | ||||||
| Object.defineProperty(exports, "__esModule", ({ value: true })); | Object.defineProperty(exports, "__esModule", ({ value: true })); | ||||||
| exports.internalCacheTwirpClient = exports.CacheServiceClient = void 0; | exports.internalCacheTwirpClient = void 0; | ||||||
| const core_1 = __nccwpck_require__(9728); | const core_1 = __nccwpck_require__(9728); | ||||||
| const user_agent_1 = __nccwpck_require__(3909); | const user_agent_1 = __nccwpck_require__(3909); | ||||||
| const errors_1 = __nccwpck_require__(1069); | const errors_1 = __nccwpck_require__(1069); | ||||||
| @ -8899,7 +8899,6 @@ class CacheServiceClient { | |||||||
|         return Math.trunc(Math.random() * (maxTime - minTime) + minTime); |         return Math.trunc(Math.random() * (maxTime - minTime) + minTime); | ||||||
|     } |     } | ||||||
| } | } | ||||||
| exports.CacheServiceClient = CacheServiceClient; |  | ||||||
| function internalCacheTwirpClient(options) { | function internalCacheTwirpClient(options) { | ||||||
|     const client = new CacheServiceClient((0, user_agent_1.getUserAgentString)(), options === null || options === void 0 ? void 0 : options.maxAttempts, options === null || options === void 0 ? void 0 : options.retryIntervalMs, options === null || options === void 0 ? void 0 : options.retryMultiplier); |     const client = new CacheServiceClient((0, user_agent_1.getUserAgentString)(), options === null || options === void 0 ? void 0 : options.maxAttempts, options === null || options === void 0 ? void 0 : options.retryIntervalMs, options === null || options === void 0 ? void 0 : options.retryMultiplier); | ||||||
|     return new cache_twirp_client_1.CacheServiceClientJSON(client); |     return new cache_twirp_client_1.CacheServiceClientJSON(client); | ||||||
| @ -9024,127 +9023,37 @@ function maskSigUrl(url) { | |||||||
|     if (!url) |     if (!url) | ||||||
|         return url; |         return url; | ||||||
|     try { |     try { | ||||||
|         const rawSigRegex = /[?&](sig)=([^&=#]+)/gi; |         const parsedUrl = new URL(url); | ||||||
|         let match; |         const signature = parsedUrl.searchParams.get('sig'); | ||||||
|         while ((match = rawSigRegex.exec(url)) !== null) { |         if (signature) { | ||||||
|             const rawSignature = match[2]; |             (0, core_1.setSecret)(signature); | ||||||
|             if (rawSignature) { |             (0, core_1.setSecret)(encodeURIComponent(signature)); | ||||||
|                 (0, core_1.setSecret)(rawSignature); |             parsedUrl.searchParams.set('sig', '***'); | ||||||
|             } |  | ||||||
|         } |  | ||||||
|         let parsedUrl; |  | ||||||
|         try { |  | ||||||
|             parsedUrl = new URL(url); |  | ||||||
|         } |  | ||||||
|         catch (_a) { |  | ||||||
|             try { |  | ||||||
|                 parsedUrl = new URL(url, 'https://example.com'); |  | ||||||
|             } |  | ||||||
|             catch (error) { |  | ||||||
|                 (0, core_1.debug)(`Failed to parse URL: ${url}`); |  | ||||||
|                 return maskSigWithRegex(url); |  | ||||||
|             } |  | ||||||
|         } |  | ||||||
|         let masked = false; |  | ||||||
|         const paramNames = Array.from(parsedUrl.searchParams.keys()); |  | ||||||
|         for (const paramName of paramNames) { |  | ||||||
|             if (paramName.toLowerCase() === 'sig') { |  | ||||||
|                 const signature = parsedUrl.searchParams.get(paramName); |  | ||||||
|                 if (signature) { |  | ||||||
|                     (0, core_1.setSecret)(signature); |  | ||||||
|                     (0, core_1.setSecret)(encodeURIComponent(signature)); |  | ||||||
|                     parsedUrl.searchParams.set(paramName, '***'); |  | ||||||
|                     masked = true; |  | ||||||
|                 } |  | ||||||
|             } |  | ||||||
|         } |  | ||||||
|         if (masked) { |  | ||||||
|             return parsedUrl.toString(); |             return parsedUrl.toString(); | ||||||
|         } |         } | ||||||
|         if (/([:?&]|^)(sig)=([^&=#]+)/i.test(url)) { |  | ||||||
|             return maskSigWithRegex(url); |  | ||||||
|         } |  | ||||||
|     } |     } | ||||||
|     catch (error) { |     catch (error) { | ||||||
|         (0, core_1.debug)(`Error masking URL: ${error instanceof Error ? error.message : String(error)}`); |         (0, core_1.debug)(`Failed to parse URL: ${url} ${error instanceof Error ? error.message : String(error)}`); | ||||||
|         return maskSigWithRegex(url); |  | ||||||
|     } |     } | ||||||
|     return url; |     return url; | ||||||
| } | } | ||||||
| exports.maskSigUrl = maskSigUrl; | exports.maskSigUrl = maskSigUrl; | ||||||
| /** |  | ||||||
|  * Fallback method to mask signatures using regex when URL parsing fails |  | ||||||
|  */ |  | ||||||
| function maskSigWithRegex(url) { |  | ||||||
|     try { |  | ||||||
|         const regex = /([:?&]|^)(sig)=([^&=#]+)/gi; |  | ||||||
|         return url.replace(regex, (fullMatch, prefix, paramName, value) => { |  | ||||||
|             if (value) { |  | ||||||
|                 (0, core_1.setSecret)(value); |  | ||||||
|                 try { |  | ||||||
|                     (0, core_1.setSecret)(decodeURIComponent(value)); |  | ||||||
|                 } |  | ||||||
|                 catch (_a) { |  | ||||||
|                     // Ignore decoding errors
 |  | ||||||
|                 } |  | ||||||
|                 return `${prefix}${paramName}=***`; |  | ||||||
|             } |  | ||||||
|             return fullMatch; |  | ||||||
|         }); |  | ||||||
|     } |  | ||||||
|     catch (error) { |  | ||||||
|         (0, core_1.debug)(`Error in maskSigWithRegex: ${error instanceof Error ? error.message : String(error)}`); |  | ||||||
|         return url; |  | ||||||
|     } |  | ||||||
| } |  | ||||||
| /** | /** | ||||||
|  * Masks any URLs containing signature parameters in the provided object |  * Masks any URLs containing signature parameters in the provided object | ||||||
|  * Recursively searches through nested objects and arrays |  | ||||||
|  */ |  */ | ||||||
| function maskSecretUrls(body) { | function maskSecretUrls(body) { | ||||||
|     if (typeof body !== 'object' || body === null) { |     if (typeof body !== 'object' || body === null) { | ||||||
|         (0, core_1.debug)('body is not an object or is null'); |         (0, core_1.debug)('body is not an object or is null'); | ||||||
|         return; |         return; | ||||||
|     } |     } | ||||||
|     const processUrl = (url) => { |     if ('signed_upload_url' in body && | ||||||
|         maskSigUrl(url); |         typeof body.signed_upload_url === 'string') { | ||||||
|     }; |         maskSigUrl(body.signed_upload_url); | ||||||
|     const processObject = (obj) => { |     } | ||||||
|         if (typeof obj !== 'object' || obj === null) { |     if ('signed_download_url' in body && | ||||||
|             return; |         typeof body.signed_download_url === 'string') { | ||||||
|         } |         maskSigUrl(body.signed_download_url); | ||||||
|         if (Array.isArray(obj)) { |     } | ||||||
|             for (const item of obj) { |  | ||||||
|                 if (typeof item === 'string') { |  | ||||||
|                     processUrl(item); |  | ||||||
|                 } |  | ||||||
|                 else if (typeof item === 'object' && item !== null) { |  | ||||||
|                     processObject(item); |  | ||||||
|                 } |  | ||||||
|             } |  | ||||||
|             return; |  | ||||||
|         } |  | ||||||
|         if ('signed_upload_url' in obj && |  | ||||||
|             typeof obj.signed_upload_url === 'string') { |  | ||||||
|             maskSigUrl(obj.signed_upload_url); |  | ||||||
|         } |  | ||||||
|         if ('signed_download_url' in obj && |  | ||||||
|             typeof obj.signed_download_url === 'string') { |  | ||||||
|             maskSigUrl(obj.signed_download_url); |  | ||||||
|         } |  | ||||||
|         for (const key in obj) { |  | ||||||
|             const value = obj[key]; |  | ||||||
|             if (typeof value === 'string') { |  | ||||||
|                 if (/([:?&]|^)(sig)=/i.test(value)) { |  | ||||||
|                     maskSigUrl(value); |  | ||||||
|                 } |  | ||||||
|             } |  | ||||||
|             else if (typeof value === 'object' && value !== null) { |  | ||||||
|                 processObject(value); |  | ||||||
|             } |  | ||||||
|         } |  | ||||||
|     }; |  | ||||||
|     processObject(body); |  | ||||||
| } | } | ||||||
| exports.maskSecretUrls = maskSecretUrls; | exports.maskSecretUrls = maskSecretUrls; | ||||||
| //# sourceMappingURL=util.js.map
 | //# sourceMappingURL=util.js.map
 | ||||||
|  | |||||||
							
								
								
									
										123
									
								
								dist/restore/index.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										123
									
								
								dist/restore/index.js
									
									
									
									
										vendored
									
									
								
							| @ -8754,7 +8754,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge | |||||||
|     }); |     }); | ||||||
| }; | }; | ||||||
| Object.defineProperty(exports, "__esModule", ({ value: true })); | Object.defineProperty(exports, "__esModule", ({ value: true })); | ||||||
| exports.internalCacheTwirpClient = exports.CacheServiceClient = void 0; | exports.internalCacheTwirpClient = void 0; | ||||||
| const core_1 = __nccwpck_require__(9728); | const core_1 = __nccwpck_require__(9728); | ||||||
| const user_agent_1 = __nccwpck_require__(3909); | const user_agent_1 = __nccwpck_require__(3909); | ||||||
| const errors_1 = __nccwpck_require__(1069); | const errors_1 = __nccwpck_require__(1069); | ||||||
| @ -8899,7 +8899,6 @@ class CacheServiceClient { | |||||||
|         return Math.trunc(Math.random() * (maxTime - minTime) + minTime); |         return Math.trunc(Math.random() * (maxTime - minTime) + minTime); | ||||||
|     } |     } | ||||||
| } | } | ||||||
| exports.CacheServiceClient = CacheServiceClient; |  | ||||||
| function internalCacheTwirpClient(options) { | function internalCacheTwirpClient(options) { | ||||||
|     const client = new CacheServiceClient((0, user_agent_1.getUserAgentString)(), options === null || options === void 0 ? void 0 : options.maxAttempts, options === null || options === void 0 ? void 0 : options.retryIntervalMs, options === null || options === void 0 ? void 0 : options.retryMultiplier); |     const client = new CacheServiceClient((0, user_agent_1.getUserAgentString)(), options === null || options === void 0 ? void 0 : options.maxAttempts, options === null || options === void 0 ? void 0 : options.retryIntervalMs, options === null || options === void 0 ? void 0 : options.retryMultiplier); | ||||||
|     return new cache_twirp_client_1.CacheServiceClientJSON(client); |     return new cache_twirp_client_1.CacheServiceClientJSON(client); | ||||||
| @ -9024,127 +9023,37 @@ function maskSigUrl(url) { | |||||||
|     if (!url) |     if (!url) | ||||||
|         return url; |         return url; | ||||||
|     try { |     try { | ||||||
|         const rawSigRegex = /[?&](sig)=([^&=#]+)/gi; |         const parsedUrl = new URL(url); | ||||||
|         let match; |         const signature = parsedUrl.searchParams.get('sig'); | ||||||
|         while ((match = rawSigRegex.exec(url)) !== null) { |         if (signature) { | ||||||
|             const rawSignature = match[2]; |             (0, core_1.setSecret)(signature); | ||||||
|             if (rawSignature) { |             (0, core_1.setSecret)(encodeURIComponent(signature)); | ||||||
|                 (0, core_1.setSecret)(rawSignature); |             parsedUrl.searchParams.set('sig', '***'); | ||||||
|             } |  | ||||||
|         } |  | ||||||
|         let parsedUrl; |  | ||||||
|         try { |  | ||||||
|             parsedUrl = new URL(url); |  | ||||||
|         } |  | ||||||
|         catch (_a) { |  | ||||||
|             try { |  | ||||||
|                 parsedUrl = new URL(url, 'https://example.com'); |  | ||||||
|             } |  | ||||||
|             catch (error) { |  | ||||||
|                 (0, core_1.debug)(`Failed to parse URL: ${url}`); |  | ||||||
|                 return maskSigWithRegex(url); |  | ||||||
|             } |  | ||||||
|         } |  | ||||||
|         let masked = false; |  | ||||||
|         const paramNames = Array.from(parsedUrl.searchParams.keys()); |  | ||||||
|         for (const paramName of paramNames) { |  | ||||||
|             if (paramName.toLowerCase() === 'sig') { |  | ||||||
|                 const signature = parsedUrl.searchParams.get(paramName); |  | ||||||
|                 if (signature) { |  | ||||||
|                     (0, core_1.setSecret)(signature); |  | ||||||
|                     (0, core_1.setSecret)(encodeURIComponent(signature)); |  | ||||||
|                     parsedUrl.searchParams.set(paramName, '***'); |  | ||||||
|                     masked = true; |  | ||||||
|                 } |  | ||||||
|             } |  | ||||||
|         } |  | ||||||
|         if (masked) { |  | ||||||
|             return parsedUrl.toString(); |             return parsedUrl.toString(); | ||||||
|         } |         } | ||||||
|         if (/([:?&]|^)(sig)=([^&=#]+)/i.test(url)) { |  | ||||||
|             return maskSigWithRegex(url); |  | ||||||
|         } |  | ||||||
|     } |     } | ||||||
|     catch (error) { |     catch (error) { | ||||||
|         (0, core_1.debug)(`Error masking URL: ${error instanceof Error ? error.message : String(error)}`); |         (0, core_1.debug)(`Failed to parse URL: ${url} ${error instanceof Error ? error.message : String(error)}`); | ||||||
|         return maskSigWithRegex(url); |  | ||||||
|     } |     } | ||||||
|     return url; |     return url; | ||||||
| } | } | ||||||
| exports.maskSigUrl = maskSigUrl; | exports.maskSigUrl = maskSigUrl; | ||||||
| /** |  | ||||||
|  * Fallback method to mask signatures using regex when URL parsing fails |  | ||||||
|  */ |  | ||||||
| function maskSigWithRegex(url) { |  | ||||||
|     try { |  | ||||||
|         const regex = /([:?&]|^)(sig)=([^&=#]+)/gi; |  | ||||||
|         return url.replace(regex, (fullMatch, prefix, paramName, value) => { |  | ||||||
|             if (value) { |  | ||||||
|                 (0, core_1.setSecret)(value); |  | ||||||
|                 try { |  | ||||||
|                     (0, core_1.setSecret)(decodeURIComponent(value)); |  | ||||||
|                 } |  | ||||||
|                 catch (_a) { |  | ||||||
|                     // Ignore decoding errors
 |  | ||||||
|                 } |  | ||||||
|                 return `${prefix}${paramName}=***`; |  | ||||||
|             } |  | ||||||
|             return fullMatch; |  | ||||||
|         }); |  | ||||||
|     } |  | ||||||
|     catch (error) { |  | ||||||
|         (0, core_1.debug)(`Error in maskSigWithRegex: ${error instanceof Error ? error.message : String(error)}`); |  | ||||||
|         return url; |  | ||||||
|     } |  | ||||||
| } |  | ||||||
| /** | /** | ||||||
|  * Masks any URLs containing signature parameters in the provided object |  * Masks any URLs containing signature parameters in the provided object | ||||||
|  * Recursively searches through nested objects and arrays |  | ||||||
|  */ |  */ | ||||||
| function maskSecretUrls(body) { | function maskSecretUrls(body) { | ||||||
|     if (typeof body !== 'object' || body === null) { |     if (typeof body !== 'object' || body === null) { | ||||||
|         (0, core_1.debug)('body is not an object or is null'); |         (0, core_1.debug)('body is not an object or is null'); | ||||||
|         return; |         return; | ||||||
|     } |     } | ||||||
|     const processUrl = (url) => { |     if ('signed_upload_url' in body && | ||||||
|         maskSigUrl(url); |         typeof body.signed_upload_url === 'string') { | ||||||
|     }; |         maskSigUrl(body.signed_upload_url); | ||||||
|     const processObject = (obj) => { |     } | ||||||
|         if (typeof obj !== 'object' || obj === null) { |     if ('signed_download_url' in body && | ||||||
|             return; |         typeof body.signed_download_url === 'string') { | ||||||
|         } |         maskSigUrl(body.signed_download_url); | ||||||
|         if (Array.isArray(obj)) { |     } | ||||||
|             for (const item of obj) { |  | ||||||
|                 if (typeof item === 'string') { |  | ||||||
|                     processUrl(item); |  | ||||||
|                 } |  | ||||||
|                 else if (typeof item === 'object' && item !== null) { |  | ||||||
|                     processObject(item); |  | ||||||
|                 } |  | ||||||
|             } |  | ||||||
|             return; |  | ||||||
|         } |  | ||||||
|         if ('signed_upload_url' in obj && |  | ||||||
|             typeof obj.signed_upload_url === 'string') { |  | ||||||
|             maskSigUrl(obj.signed_upload_url); |  | ||||||
|         } |  | ||||||
|         if ('signed_download_url' in obj && |  | ||||||
|             typeof obj.signed_download_url === 'string') { |  | ||||||
|             maskSigUrl(obj.signed_download_url); |  | ||||||
|         } |  | ||||||
|         for (const key in obj) { |  | ||||||
|             const value = obj[key]; |  | ||||||
|             if (typeof value === 'string') { |  | ||||||
|                 if (/([:?&]|^)(sig)=/i.test(value)) { |  | ||||||
|                     maskSigUrl(value); |  | ||||||
|                 } |  | ||||||
|             } |  | ||||||
|             else if (typeof value === 'object' && value !== null) { |  | ||||||
|                 processObject(value); |  | ||||||
|             } |  | ||||||
|         } |  | ||||||
|     }; |  | ||||||
|     processObject(body); |  | ||||||
| } | } | ||||||
| exports.maskSecretUrls = maskSecretUrls; | exports.maskSecretUrls = maskSecretUrls; | ||||||
| //# sourceMappingURL=util.js.map
 | //# sourceMappingURL=util.js.map
 | ||||||
|  | |||||||
							
								
								
									
										123
									
								
								dist/save-only/index.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										123
									
								
								dist/save-only/index.js
									
									
									
									
										vendored
									
									
								
							| @ -8754,7 +8754,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge | |||||||
|     }); |     }); | ||||||
| }; | }; | ||||||
| Object.defineProperty(exports, "__esModule", ({ value: true })); | Object.defineProperty(exports, "__esModule", ({ value: true })); | ||||||
| exports.internalCacheTwirpClient = exports.CacheServiceClient = void 0; | exports.internalCacheTwirpClient = void 0; | ||||||
| const core_1 = __nccwpck_require__(9728); | const core_1 = __nccwpck_require__(9728); | ||||||
| const user_agent_1 = __nccwpck_require__(3909); | const user_agent_1 = __nccwpck_require__(3909); | ||||||
| const errors_1 = __nccwpck_require__(1069); | const errors_1 = __nccwpck_require__(1069); | ||||||
| @ -8899,7 +8899,6 @@ class CacheServiceClient { | |||||||
|         return Math.trunc(Math.random() * (maxTime - minTime) + minTime); |         return Math.trunc(Math.random() * (maxTime - minTime) + minTime); | ||||||
|     } |     } | ||||||
| } | } | ||||||
| exports.CacheServiceClient = CacheServiceClient; |  | ||||||
| function internalCacheTwirpClient(options) { | function internalCacheTwirpClient(options) { | ||||||
|     const client = new CacheServiceClient((0, user_agent_1.getUserAgentString)(), options === null || options === void 0 ? void 0 : options.maxAttempts, options === null || options === void 0 ? void 0 : options.retryIntervalMs, options === null || options === void 0 ? void 0 : options.retryMultiplier); |     const client = new CacheServiceClient((0, user_agent_1.getUserAgentString)(), options === null || options === void 0 ? void 0 : options.maxAttempts, options === null || options === void 0 ? void 0 : options.retryIntervalMs, options === null || options === void 0 ? void 0 : options.retryMultiplier); | ||||||
|     return new cache_twirp_client_1.CacheServiceClientJSON(client); |     return new cache_twirp_client_1.CacheServiceClientJSON(client); | ||||||
| @ -9024,127 +9023,37 @@ function maskSigUrl(url) { | |||||||
|     if (!url) |     if (!url) | ||||||
|         return url; |         return url; | ||||||
|     try { |     try { | ||||||
|         const rawSigRegex = /[?&](sig)=([^&=#]+)/gi; |         const parsedUrl = new URL(url); | ||||||
|         let match; |         const signature = parsedUrl.searchParams.get('sig'); | ||||||
|         while ((match = rawSigRegex.exec(url)) !== null) { |         if (signature) { | ||||||
|             const rawSignature = match[2]; |             (0, core_1.setSecret)(signature); | ||||||
|             if (rawSignature) { |             (0, core_1.setSecret)(encodeURIComponent(signature)); | ||||||
|                 (0, core_1.setSecret)(rawSignature); |             parsedUrl.searchParams.set('sig', '***'); | ||||||
|             } |  | ||||||
|         } |  | ||||||
|         let parsedUrl; |  | ||||||
|         try { |  | ||||||
|             parsedUrl = new URL(url); |  | ||||||
|         } |  | ||||||
|         catch (_a) { |  | ||||||
|             try { |  | ||||||
|                 parsedUrl = new URL(url, 'https://example.com'); |  | ||||||
|             } |  | ||||||
|             catch (error) { |  | ||||||
|                 (0, core_1.debug)(`Failed to parse URL: ${url}`); |  | ||||||
|                 return maskSigWithRegex(url); |  | ||||||
|             } |  | ||||||
|         } |  | ||||||
|         let masked = false; |  | ||||||
|         const paramNames = Array.from(parsedUrl.searchParams.keys()); |  | ||||||
|         for (const paramName of paramNames) { |  | ||||||
|             if (paramName.toLowerCase() === 'sig') { |  | ||||||
|                 const signature = parsedUrl.searchParams.get(paramName); |  | ||||||
|                 if (signature) { |  | ||||||
|                     (0, core_1.setSecret)(signature); |  | ||||||
|                     (0, core_1.setSecret)(encodeURIComponent(signature)); |  | ||||||
|                     parsedUrl.searchParams.set(paramName, '***'); |  | ||||||
|                     masked = true; |  | ||||||
|                 } |  | ||||||
|             } |  | ||||||
|         } |  | ||||||
|         if (masked) { |  | ||||||
|             return parsedUrl.toString(); |             return parsedUrl.toString(); | ||||||
|         } |         } | ||||||
|         if (/([:?&]|^)(sig)=([^&=#]+)/i.test(url)) { |  | ||||||
|             return maskSigWithRegex(url); |  | ||||||
|         } |  | ||||||
|     } |     } | ||||||
|     catch (error) { |     catch (error) { | ||||||
|         (0, core_1.debug)(`Error masking URL: ${error instanceof Error ? error.message : String(error)}`); |         (0, core_1.debug)(`Failed to parse URL: ${url} ${error instanceof Error ? error.message : String(error)}`); | ||||||
|         return maskSigWithRegex(url); |  | ||||||
|     } |     } | ||||||
|     return url; |     return url; | ||||||
| } | } | ||||||
| exports.maskSigUrl = maskSigUrl; | exports.maskSigUrl = maskSigUrl; | ||||||
| /** |  | ||||||
|  * Fallback method to mask signatures using regex when URL parsing fails |  | ||||||
|  */ |  | ||||||
| function maskSigWithRegex(url) { |  | ||||||
|     try { |  | ||||||
|         const regex = /([:?&]|^)(sig)=([^&=#]+)/gi; |  | ||||||
|         return url.replace(regex, (fullMatch, prefix, paramName, value) => { |  | ||||||
|             if (value) { |  | ||||||
|                 (0, core_1.setSecret)(value); |  | ||||||
|                 try { |  | ||||||
|                     (0, core_1.setSecret)(decodeURIComponent(value)); |  | ||||||
|                 } |  | ||||||
|                 catch (_a) { |  | ||||||
|                     // Ignore decoding errors
 |  | ||||||
|                 } |  | ||||||
|                 return `${prefix}${paramName}=***`; |  | ||||||
|             } |  | ||||||
|             return fullMatch; |  | ||||||
|         }); |  | ||||||
|     } |  | ||||||
|     catch (error) { |  | ||||||
|         (0, core_1.debug)(`Error in maskSigWithRegex: ${error instanceof Error ? error.message : String(error)}`); |  | ||||||
|         return url; |  | ||||||
|     } |  | ||||||
| } |  | ||||||
| /** | /** | ||||||
|  * Masks any URLs containing signature parameters in the provided object |  * Masks any URLs containing signature parameters in the provided object | ||||||
|  * Recursively searches through nested objects and arrays |  | ||||||
|  */ |  */ | ||||||
| function maskSecretUrls(body) { | function maskSecretUrls(body) { | ||||||
|     if (typeof body !== 'object' || body === null) { |     if (typeof body !== 'object' || body === null) { | ||||||
|         (0, core_1.debug)('body is not an object or is null'); |         (0, core_1.debug)('body is not an object or is null'); | ||||||
|         return; |         return; | ||||||
|     } |     } | ||||||
|     const processUrl = (url) => { |     if ('signed_upload_url' in body && | ||||||
|         maskSigUrl(url); |         typeof body.signed_upload_url === 'string') { | ||||||
|     }; |         maskSigUrl(body.signed_upload_url); | ||||||
|     const processObject = (obj) => { |     } | ||||||
|         if (typeof obj !== 'object' || obj === null) { |     if ('signed_download_url' in body && | ||||||
|             return; |         typeof body.signed_download_url === 'string') { | ||||||
|         } |         maskSigUrl(body.signed_download_url); | ||||||
|         if (Array.isArray(obj)) { |     } | ||||||
|             for (const item of obj) { |  | ||||||
|                 if (typeof item === 'string') { |  | ||||||
|                     processUrl(item); |  | ||||||
|                 } |  | ||||||
|                 else if (typeof item === 'object' && item !== null) { |  | ||||||
|                     processObject(item); |  | ||||||
|                 } |  | ||||||
|             } |  | ||||||
|             return; |  | ||||||
|         } |  | ||||||
|         if ('signed_upload_url' in obj && |  | ||||||
|             typeof obj.signed_upload_url === 'string') { |  | ||||||
|             maskSigUrl(obj.signed_upload_url); |  | ||||||
|         } |  | ||||||
|         if ('signed_download_url' in obj && |  | ||||||
|             typeof obj.signed_download_url === 'string') { |  | ||||||
|             maskSigUrl(obj.signed_download_url); |  | ||||||
|         } |  | ||||||
|         for (const key in obj) { |  | ||||||
|             const value = obj[key]; |  | ||||||
|             if (typeof value === 'string') { |  | ||||||
|                 if (/([:?&]|^)(sig)=/i.test(value)) { |  | ||||||
|                     maskSigUrl(value); |  | ||||||
|                 } |  | ||||||
|             } |  | ||||||
|             else if (typeof value === 'object' && value !== null) { |  | ||||||
|                 processObject(value); |  | ||||||
|             } |  | ||||||
|         } |  | ||||||
|     }; |  | ||||||
|     processObject(body); |  | ||||||
| } | } | ||||||
| exports.maskSecretUrls = maskSecretUrls; | exports.maskSecretUrls = maskSecretUrls; | ||||||
| //# sourceMappingURL=util.js.map
 | //# sourceMappingURL=util.js.map
 | ||||||
|  | |||||||
							
								
								
									
										123
									
								
								dist/save/index.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										123
									
								
								dist/save/index.js
									
									
									
									
										vendored
									
									
								
							| @ -8754,7 +8754,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge | |||||||
|     }); |     }); | ||||||
| }; | }; | ||||||
| Object.defineProperty(exports, "__esModule", ({ value: true })); | Object.defineProperty(exports, "__esModule", ({ value: true })); | ||||||
| exports.internalCacheTwirpClient = exports.CacheServiceClient = void 0; | exports.internalCacheTwirpClient = void 0; | ||||||
| const core_1 = __nccwpck_require__(9728); | const core_1 = __nccwpck_require__(9728); | ||||||
| const user_agent_1 = __nccwpck_require__(3909); | const user_agent_1 = __nccwpck_require__(3909); | ||||||
| const errors_1 = __nccwpck_require__(1069); | const errors_1 = __nccwpck_require__(1069); | ||||||
| @ -8899,7 +8899,6 @@ class CacheServiceClient { | |||||||
|         return Math.trunc(Math.random() * (maxTime - minTime) + minTime); |         return Math.trunc(Math.random() * (maxTime - minTime) + minTime); | ||||||
|     } |     } | ||||||
| } | } | ||||||
| exports.CacheServiceClient = CacheServiceClient; |  | ||||||
| function internalCacheTwirpClient(options) { | function internalCacheTwirpClient(options) { | ||||||
|     const client = new CacheServiceClient((0, user_agent_1.getUserAgentString)(), options === null || options === void 0 ? void 0 : options.maxAttempts, options === null || options === void 0 ? void 0 : options.retryIntervalMs, options === null || options === void 0 ? void 0 : options.retryMultiplier); |     const client = new CacheServiceClient((0, user_agent_1.getUserAgentString)(), options === null || options === void 0 ? void 0 : options.maxAttempts, options === null || options === void 0 ? void 0 : options.retryIntervalMs, options === null || options === void 0 ? void 0 : options.retryMultiplier); | ||||||
|     return new cache_twirp_client_1.CacheServiceClientJSON(client); |     return new cache_twirp_client_1.CacheServiceClientJSON(client); | ||||||
| @ -9024,127 +9023,37 @@ function maskSigUrl(url) { | |||||||
|     if (!url) |     if (!url) | ||||||
|         return url; |         return url; | ||||||
|     try { |     try { | ||||||
|         const rawSigRegex = /[?&](sig)=([^&=#]+)/gi; |         const parsedUrl = new URL(url); | ||||||
|         let match; |         const signature = parsedUrl.searchParams.get('sig'); | ||||||
|         while ((match = rawSigRegex.exec(url)) !== null) { |         if (signature) { | ||||||
|             const rawSignature = match[2]; |             (0, core_1.setSecret)(signature); | ||||||
|             if (rawSignature) { |             (0, core_1.setSecret)(encodeURIComponent(signature)); | ||||||
|                 (0, core_1.setSecret)(rawSignature); |             parsedUrl.searchParams.set('sig', '***'); | ||||||
|             } |  | ||||||
|         } |  | ||||||
|         let parsedUrl; |  | ||||||
|         try { |  | ||||||
|             parsedUrl = new URL(url); |  | ||||||
|         } |  | ||||||
|         catch (_a) { |  | ||||||
|             try { |  | ||||||
|                 parsedUrl = new URL(url, 'https://example.com'); |  | ||||||
|             } |  | ||||||
|             catch (error) { |  | ||||||
|                 (0, core_1.debug)(`Failed to parse URL: ${url}`); |  | ||||||
|                 return maskSigWithRegex(url); |  | ||||||
|             } |  | ||||||
|         } |  | ||||||
|         let masked = false; |  | ||||||
|         const paramNames = Array.from(parsedUrl.searchParams.keys()); |  | ||||||
|         for (const paramName of paramNames) { |  | ||||||
|             if (paramName.toLowerCase() === 'sig') { |  | ||||||
|                 const signature = parsedUrl.searchParams.get(paramName); |  | ||||||
|                 if (signature) { |  | ||||||
|                     (0, core_1.setSecret)(signature); |  | ||||||
|                     (0, core_1.setSecret)(encodeURIComponent(signature)); |  | ||||||
|                     parsedUrl.searchParams.set(paramName, '***'); |  | ||||||
|                     masked = true; |  | ||||||
|                 } |  | ||||||
|             } |  | ||||||
|         } |  | ||||||
|         if (masked) { |  | ||||||
|             return parsedUrl.toString(); |             return parsedUrl.toString(); | ||||||
|         } |         } | ||||||
|         if (/([:?&]|^)(sig)=([^&=#]+)/i.test(url)) { |  | ||||||
|             return maskSigWithRegex(url); |  | ||||||
|         } |  | ||||||
|     } |     } | ||||||
|     catch (error) { |     catch (error) { | ||||||
|         (0, core_1.debug)(`Error masking URL: ${error instanceof Error ? error.message : String(error)}`); |         (0, core_1.debug)(`Failed to parse URL: ${url} ${error instanceof Error ? error.message : String(error)}`); | ||||||
|         return maskSigWithRegex(url); |  | ||||||
|     } |     } | ||||||
|     return url; |     return url; | ||||||
| } | } | ||||||
| exports.maskSigUrl = maskSigUrl; | exports.maskSigUrl = maskSigUrl; | ||||||
| /** |  | ||||||
|  * Fallback method to mask signatures using regex when URL parsing fails |  | ||||||
|  */ |  | ||||||
| function maskSigWithRegex(url) { |  | ||||||
|     try { |  | ||||||
|         const regex = /([:?&]|^)(sig)=([^&=#]+)/gi; |  | ||||||
|         return url.replace(regex, (fullMatch, prefix, paramName, value) => { |  | ||||||
|             if (value) { |  | ||||||
|                 (0, core_1.setSecret)(value); |  | ||||||
|                 try { |  | ||||||
|                     (0, core_1.setSecret)(decodeURIComponent(value)); |  | ||||||
|                 } |  | ||||||
|                 catch (_a) { |  | ||||||
|                     // Ignore decoding errors
 |  | ||||||
|                 } |  | ||||||
|                 return `${prefix}${paramName}=***`; |  | ||||||
|             } |  | ||||||
|             return fullMatch; |  | ||||||
|         }); |  | ||||||
|     } |  | ||||||
|     catch (error) { |  | ||||||
|         (0, core_1.debug)(`Error in maskSigWithRegex: ${error instanceof Error ? error.message : String(error)}`); |  | ||||||
|         return url; |  | ||||||
|     } |  | ||||||
| } |  | ||||||
| /** | /** | ||||||
|  * Masks any URLs containing signature parameters in the provided object |  * Masks any URLs containing signature parameters in the provided object | ||||||
|  * Recursively searches through nested objects and arrays |  | ||||||
|  */ |  */ | ||||||
| function maskSecretUrls(body) { | function maskSecretUrls(body) { | ||||||
|     if (typeof body !== 'object' || body === null) { |     if (typeof body !== 'object' || body === null) { | ||||||
|         (0, core_1.debug)('body is not an object or is null'); |         (0, core_1.debug)('body is not an object or is null'); | ||||||
|         return; |         return; | ||||||
|     } |     } | ||||||
|     const processUrl = (url) => { |     if ('signed_upload_url' in body && | ||||||
|         maskSigUrl(url); |         typeof body.signed_upload_url === 'string') { | ||||||
|     }; |         maskSigUrl(body.signed_upload_url); | ||||||
|     const processObject = (obj) => { |     } | ||||||
|         if (typeof obj !== 'object' || obj === null) { |     if ('signed_download_url' in body && | ||||||
|             return; |         typeof body.signed_download_url === 'string') { | ||||||
|         } |         maskSigUrl(body.signed_download_url); | ||||||
|         if (Array.isArray(obj)) { |     } | ||||||
|             for (const item of obj) { |  | ||||||
|                 if (typeof item === 'string') { |  | ||||||
|                     processUrl(item); |  | ||||||
|                 } |  | ||||||
|                 else if (typeof item === 'object' && item !== null) { |  | ||||||
|                     processObject(item); |  | ||||||
|                 } |  | ||||||
|             } |  | ||||||
|             return; |  | ||||||
|         } |  | ||||||
|         if ('signed_upload_url' in obj && |  | ||||||
|             typeof obj.signed_upload_url === 'string') { |  | ||||||
|             maskSigUrl(obj.signed_upload_url); |  | ||||||
|         } |  | ||||||
|         if ('signed_download_url' in obj && |  | ||||||
|             typeof obj.signed_download_url === 'string') { |  | ||||||
|             maskSigUrl(obj.signed_download_url); |  | ||||||
|         } |  | ||||||
|         for (const key in obj) { |  | ||||||
|             const value = obj[key]; |  | ||||||
|             if (typeof value === 'string') { |  | ||||||
|                 if (/([:?&]|^)(sig)=/i.test(value)) { |  | ||||||
|                     maskSigUrl(value); |  | ||||||
|                 } |  | ||||||
|             } |  | ||||||
|             else if (typeof value === 'object' && value !== null) { |  | ||||||
|                 processObject(value); |  | ||||||
|             } |  | ||||||
|         } |  | ||||||
|     }; |  | ||||||
|     processObject(body); |  | ||||||
| } | } | ||||||
| exports.maskSecretUrls = maskSecretUrls; | exports.maskSecretUrls = maskSecretUrls; | ||||||
| //# sourceMappingURL=util.js.map
 | //# sourceMappingURL=util.js.map
 | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Salman Chishti
						Salman Chishti