Add secret and signature masking for cache and artifact packages
This commit is contained in:
1 parent
f8c54ddb00
commit
65a34a096d
1 file changed
+16
+16
@@ -391,3 +391,19 @@ export {toPosixPath, toWin32Path, toPlatformPath} from './path-utils'
|
|||||||
* Platform utilities exports
|
* Platform utilities exports
|
||||||
*/
|
*/
|
||||||
export * as platform from './platform'
|
export * as platform from './platform'
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Masks the `sig` parameter in a URL and sets it as a secret.
|
||||||
|
* @param url The URL containing the `sig` parameter.
|
||||||
|
* @param urlType The type of the URL (e.g., 'signed_upload_url', 'signed_download_url').
|
||||||
|
* @returns The URL with the `sig` parameter masked.
|
||||||
|
*/
|
||||||
|
export function maskSigUrl(url: string, urlType: string): string {
|
||||||
|
const sigMatch = url.match(/[?&]sig=([^&]+)/)
|
||||||
|
if (sigMatch) {
|
||||||
|
setSecret(sigMatch[1])
|
||||||
|
debug(`Masked ${urlType}: ${url.replace(sigMatch[1], '***')}`)
|
||||||
|
return url.replace(sigMatch[1], '***')
|
||||||
|
}
|
||||||
|
return url
|
||||||
|
}
|
||||||
Reference in new issue
Block a user