Handle missing serial number more gracefully (#27681)

* Handle missing serial number more gracefully

* remove poc code

* changelog
This commit is contained in:
Scott Miller 2024-07-03 16:01:26 -05:00 committed by GitHub
parent a7078102c3
commit 30f457f32b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 6 additions and 1 deletions

View file

@ -361,7 +361,9 @@ func (b *backend) pathFetchRead(ctx context.Context, req *logical.Request, data
contentType = "application/pem-certificate-chain"
}
default:
serial = data.Get("serial").(string)
if ser, ok := data.GetOk("serial"); ok {
serial = ser.(string)
}
pemType = "CERTIFICATE"
}
if len(serial) == 0 {

3
changelog/27681.txt Normal file
View file

@ -0,0 +1,3 @@
```release-note:bug
secrets/pki: fix lack of serial number to a certificate read resulting in a server side error.
```