Skip to content

Commit

Permalink
limit the size of the logged response to 2048 bytes in error cases
Browse files Browse the repository at this point in the history
  • Loading branch information
drakkan committed Apr 25, 2023
1 parent 82f6983 commit 3003d48
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion oidc/oidc.go
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,11 @@ func NewProvider(ctx context.Context, issuer string) (*Provider, error) {
}

if resp.StatusCode != http.StatusOK {
return nil, fmt.Errorf("%s: %s", resp.Status, body)
maxBodySize := len(body)
if maxBodySize > 2048 {
maxBodySize = 2048
}
return nil, fmt.Errorf("%s: %s", resp.Status, body[:maxBodySize])
}

var p providerJSON
Expand Down

0 comments on commit 3003d48

Please sign in to comment.