Skip to content

Commit

Permalink
Propagate (original) request ID to webhook requests
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
hslatman committed Sep 19, 2023
1 parent 70533f5 commit f3229d3
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions authority/provisioner/webhook.go
Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit f3229d3

Please sign in to comment.