Remove logging of any SAS tokens in Actions/Cache and Actions/Artifact by salmanmkc · Pull Request #1982 · actions/toolkit

Issue

Currently you are able to see the SAS token for downloading and uploading files when debugging.

This is not secure as technically anyone with access to the logs can use the SAS token to download or upload files.

Fix

Fix: masking the SAS token, so that you are unable to see it anymore, it will show three stars: , e.g. sig= in the URL

The code handles malformed URLs as well, encoding the raw, encoded & decoded URL in-case. Code also checks for nested parameters and for any sig fields, in the case where for some reason signature_upload_url or the keys in the object could change.

Examples now changed approach to just mask the signature part:

Cache

Cache uploading
Cache uploading with masked SAS

Cache downloading
Cache downloading with masked SAS

Artifact

Artifact uploading
image

Artifact downloading
image

### Cache _(old approach)_

Cache uploading (old approach)
image

Cache downloading (old approach)
image

Artifact (old approach)

Uploading to artifact (old approach)
image

Downloading from artifact (old approach)
image

Questions

Discussion outcome was to have duplicate code rather than using a shared utility function in Core, which was the previous approach as indicated via previous commits.

This PR will need a release of: