File tree Expand file tree Collapse file tree
cmd/notification-sentinel Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -40,7 +40,8 @@ var logger hclog.Logger = hclog.New(&hclog.LoggerOptions{
4040})
4141
4242func (s * SentinelPlugin ) getAuthorizationHeader (now string , length int , name string ) (string , error ) {
43- xHeaders := "X-Ms-Date:" + now
43+ // Azure calculates HMAC with this header in lower-case
44+ xHeaders := "x-ms-date:" + now
4445
4546 cfg := s .PluginConfigByName [name ]
4647
@@ -94,7 +95,9 @@ func (s *SentinelPlugin) Notify(ctx context.Context, notification *protobufs.Not
9495 req .Header .Set ("Content-Type" , "application/json" )
9596 req .Header .Set ("Log-Type" , cfg .LogType )
9697 req .Header .Set ("Authorization" , authorization )
97- req .Header .Set ("X-Ms-Date" , now )
98+ // to match lower-case header in HMAC calculation it must not be auto-Canonicalized
99+ // https://pkg.go.dev/net/http#Header.Set
100+ req .Header ["x-ms-date" ] = []string {now }
98101
99102 client := & http.Client {}
100103
You can’t perform that action at this time.
0 commit comments