The vulnerability (GHSA-h5f8-crrq-4pw8) describes a scenario where workload secrets are leaked to logs if the CONTRAST_LOG_LEVEL is set to info (the default) or debug. The affected package is github.com/edgelesssys/contrast, with versions <= 1.8.0 being vulnerable and 1.8.1 being the first patched version.
By comparing the commits between version 1.8.0 (commit 2c24641985716f83f6a228f57fbe92e8538fa2dd) and 1.8.1 (commit f3b9ef837d686781726b4567fec3fcb74779395e), a relevant commit 5041d52fbcdc19380d78fb7a471ef0a1addc55ab with the message "initializer: don't log full response" was identified.
This commit modifies the initializer/main.go file. Specifically, within the run function, the line log.Info("Requesting cert", "response", resp) was changed to log.Debug("Received response", "meshCA", resp.MeshCACert, "rootCA", resp.RootCACert, "certChain", resp.CertChain).
This change directly addresses the vulnerability:
- It changes the log level for this specific message from
Info to Debug. Since the vulnerability occurs when the log level is Info (default) or Debug, changing this specific sensitive log to Debug means it won't appear if the global log level is Info or higher (e.g., Warn, which is the recommended workaround).
- It changes what is logged. Instead of logging the entire
resp object, which presumably contained the workload secret, it now logs specific, less sensitive fields from the response.
Therefore, the run function in initializer/main.go is the vulnerable function because it was responsible for logging the sensitive information (the full response resp) at an inappropriate log level (Info). During exploitation (i.e., when the log level is Info or Debug), this function would be part of the execution path leading to the secret leakage, and its logging action would be the direct cause of the vulnerability.