R82: req discovery endpoints, single-use code retry

This commit is contained in:
2026-08-13 18:39:02 +01:00
parent 820d7969e3
commit 3c41fa717a
5 changed files with 191 additions and 8 deletions
+3 -1
View File
@@ -186,7 +186,9 @@ func (t *TraefikOidc) exchangeTokens(ctx context.Context, grantType string, code
}
var tokenResponse TokenResponse
if err := json.NewDecoder(resp.Body).Decode(&tokenResponse); err != nil {
// Cap the decoded body so a corrupted or malicious oversized 200-body cannot
// drive an unbounded read/allocation. Token responses are small (a few KB).
if err := json.NewDecoder(io.LimitReader(resp.Body, 1<<20)).Decode(&tokenResponse); err != nil {
return nil, fmt.Errorf("failed to decode token response: %w", err)
}