googleapis / googleapis/google-cloud-node
Remove `access_token` from logs
- Dominant language
- TypeScript
- Stars
- 3.2k
- Forks
- 712
- Avg merge
- 2d 3h
- Merged PRs (30d)
- 99
Description
Currently, if you enable `GOOGLE_SDK_NODE_LOGGING` to get extra logging, both [the instance request](https://github.com/googleapis/gcp-metadata/blob/d8a868e5f487dcc3dd4bfd2d59d8c331fcf2895b/src/index.ts#L172) and [the instance metadata](https://github.com/googleapis/gcp-metadata/blob/d8a868e5f487dcc3dd4bfd2d59d8c331fcf2895b/src/index.ts#L175) are logged.
Unfortunately, the latter includes an access_token in it, which is rather dangerous to log.
I can imagine two solutions:
* Remove the access_token from the log, and maybe introduce another env var like `INCLUDE_ACCESS_TOKEN_IN_LOG` if someone really wants it
* Split the logger into two subloggers (request/response?) which would allow the user to configure which one they want with `GOOGLE_SDK_NODE_LOGGING` https://github.com/googleapis/gax-nodejs/tree/main/logging-utils#logging
Contributor guide
Assessment
This issue has not been assessed yet.