tiup leaks credential through environment printing
Bug Report
- What did you do?
any
tiup clustercommand, e.g.
tiup cluster list
-
What did you expect to see? The command should be safe to run
-
What did you see instead? In ~/.tiup/logs/tiup-cluster-debug-2023-12-09-23-45-09.log and ~/.tiup/storage/cluster/audit/XXXX AWS secrets leaks through ENV var printing
... "AWS_SECRET_ACCESS_KEY=REDACTED", ...
Same information also leak into
- What version of TiUP are you using (
tiup --version)?
tiup --version
1.16.0 tiup
Go Version: go1.21.11
Git Ref: v1.16.0
GitHash: e543145831d44a863366ff8c379d25980730bbd1
I think code is here: https://github.com/pingcap/tiup/blob/c1a14a55118b5c2076497cca7d7b28741ad8ab80/components/cluster/command/root.go#L278 and https://github.com/pingcap/tiup/blob/c1a14a55118b5c2076497cca7d7b28741ad8ab80/components/dm/command/root.go#L235 There is no where in tiup that user can set log level. By default this debug information should not write to file.
I think there are two possible solutions:
- Redact sensitive info from the environment. However it would be easy to miss things that might be company specific etc. So an allowlist might be better than a denylist. This does make this less useful for actual debugging.
- Don't use debug logging in sensitive environments.
Not sure what solution (or combination of solutions) is best.