Skip to content
This repository was archived by the owner on Aug 28, 2025. It is now read-only.

Commit 1b809b8

Browse files
committed
chore: skip sars with impersonation
1 parent 6f9822c commit 1b809b8

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

gateway/gateway.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -604,15 +604,17 @@ func (i *impersonation) RoundTrip(req *http.Request) (*http.Response, error) {
604604
return i.delegate.RoundTrip(req)
605605
}
606606

607+
if strings.Contains(req.URL.Path, "authorization.k8s.io") { // skip impersonation for subjectaccessreviews
608+
return i.delegate.RoundTrip(req)
609+
}
610+
607611
user, ok := GetUserFromContext(req.Context())
608612
if !ok || user == "" {
609613
return i.delegate.RoundTrip(req)
610614
}
611615

612616
slog.Debug("impersonating request", "user", user)
613617

614-
fmt.Println("impersonating", user)
615-
616618
req = utilnet.CloneRequest(req)
617619
req.Header.Set(transport.ImpersonateUserHeader, user)
618620

0 commit comments

Comments
 (0)