Propagate (original) request ID to webhook requests

Technically the webhook request is a new request, so maybe the
`X-Request-ID` should not be set to the value of the original
request? But then the original request ID should be propageted
in the webhook request body, or using a different header.

The way the request ID is used in this functionality is actually
more like a tracing ID, so that may be an option too.
This commit is contained in:
Herman Slatman 2023-09-19 13:48:43 +02:00
parent 70533f55a4
commit f3229d3e3c
No known key found for this signature in database
GPG Key ID: F4D8A44EA0A75A4F

View File

@ -15,6 +15,7 @@ import (
"time"
"github.com/pkg/errors"
"github.com/smallstep/certificates/logging"
"github.com/smallstep/certificates/templates"
"github.com/smallstep/certificates/webhook"
"go.step.sm/linkedca"
@ -169,6 +170,11 @@ retry:
return nil, err
}
requestID, ok := logging.GetRequestID(ctx)
if ok {
req.Header.Set("X-Request-ID", requestID)
}
secret, err := base64.StdEncoding.DecodeString(w.Secret)
if err != nil {
return nil, err