Skip to content

Commit 107510b

Browse files
Encode headers in base64 after building json blob
1 parent f9bf89c commit 107510b

1 file changed

Lines changed: 3 additions & 5 deletions

File tree

api/auth/aws/aws.go

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import (
88
"crypto/sha256"
99
"encoding/base64"
1010
"encoding/hex"
11+
"encoding/json"
1112
"fmt"
1213
"io"
1314
"net/http"
@@ -166,15 +167,12 @@ func (a *AWSAuth) Login(ctx context.Context, client *api.Client) (*api.Secret, e
166167
return nil, fmt.Errorf("failed to sign STS request: %w", err)
167168
}
168169

169-
headers := make(map[string]string)
170-
for k, v := range req.Header {
171-
headers[k] = base64.StdEncoding.EncodeToString([]byte(strings.Join(v, ",")))
172-
}
170+
headersData, _ := json.Marshal(req.Header)
173171

174172
loginData["iam_http_request_method"] = "POST"
175173
loginData["iam_request_url"] = base64.StdEncoding.EncodeToString([]byte(req.URL.String()))
176174
loginData["iam_request_body"] = base64.StdEncoding.EncodeToString([]byte(iamBody))
177-
loginData["iam_request_headers"] = headers
175+
loginData["iam_request_headers"] = base64.StdEncoding.EncodeToString(headersData)
178176
}
179177

180178
if a.roleName != "" {

0 commit comments

Comments
 (0)