Open
Description
Description of the false positive
The warning is "Clear-text logging of sensitive information", but what is actually logged is the type of the variable which holds the information and not the information itself.
CodeQL correctly determines that a variable potentially holding a piece of sensitive information is referenced in a log.Fatalf()
call, but it misses the fact that the reference is processed using a %T
format specifier which will result in the log receiving the type of the data and not the value of the data:
apiKeyPair, ok := apiKeyPairAny.([]any)
if !ok {
log.Fatalf("Error reading Cloudability API keypair, expected an array, found %T",
apiKeyPairAny)
Possible workaround
I'm hoping that the following will suffice to work around the problem, but it's ugly and really shouldn't be necessary!
log.Fatalf("Error reading Cloudability API keypair, expected an array, found %v",
reflect.TypeOf(apiKeyPairAny).String())