Fix accidental debug logging in the OCSP helper client (#28450)

* Fix accidental debug logging in the OCSP helper client

* changelog
This commit is contained in:
Scott Miller 2024-09-23 13:17:11 -05:00 committed by GitHub
parent 6acfc8e212
commit 4515a016f7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 11 additions and 6 deletions

3
changelog/28450.txt Normal file
View file

@ -0,0 +1,3 @@
```release-note:bug
auth/cert: During certificate validation, OCSP requests are debug logged even if Vault's log level is above DEBUG.
```

View file

@ -612,6 +612,7 @@ func (c *Client) GetRevocationStatus(ctx context.Context, subject, issuer *x509.
timeout := defaultOCSPResponderTimeout
ocspClient := retryablehttp.NewClient()
ocspClient.Logger = c.Logger()
ocspClient.RetryMax = conf.OcspMaxRetries
ocspClient.HTTPClient.Timeout = timeout
ocspClient.HTTPClient.Transport = newInsecureOcspTransport(conf.ExtraCas)

View file

@ -50,15 +50,16 @@ func TestOCSP(t *testing.T) {
for _, tgt := range targetURL {
c.ocspResponseCache, _ = lru.New2Q(10)
for _, tr := range transports {
c := &http.Client{
Transport: tr,
Timeout: 30 * time.Second,
}
req, err := http.NewRequest("GET", tgt, bytes.NewReader(nil))
ocspClient := retryablehttp.NewClient()
ocspClient.Logger = c.Logger()
ocspClient.RetryMax = conf.OcspMaxRetries
ocspClient.HTTPClient.Timeout = 30 * time.Second
ocspClient.HTTPClient.Transport = tr
req, err := retryablehttp.NewRequest("GET", tgt, bytes.NewReader(nil))
if err != nil {
t.Fatalf("fail to create a request. err: %v", err)
}
res, err := c.Do(req)
res, err := ocspClient.Do(req)
if err != nil {
t.Fatalf("failed to GET contents. err: %v", err)
}