File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed
staging/src/k8s.io/apiserver/plugin/pkg/authorizer/webhook Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -200,7 +200,7 @@ func (w *WebhookAuthorizer) Authorize(attr authorizer.Attributes) (decision auth
200
200
if r .Status .Allowed {
201
201
w .responseCache .Add (string (key ), r .Status , w .authorizedTTL )
202
202
} else {
203
- if len ( key ) <= maxUnauthorizedCachedKeySize {
203
+ if callerControlledAttributeSize ( attr ) < maxUnauthorizedCachedKeySize {
204
204
w .responseCache .Add (string (key ), r .Status , w .unauthorizedTTL )
205
205
}
206
206
}
@@ -268,3 +268,14 @@ func (t *subjectAccessReviewClient) Create(subjectAccessReview *authorization.Su
268
268
err := t .w .RestClient .Post ().Body (subjectAccessReview ).Do ().Into (result )
269
269
return result , err
270
270
}
271
+
272
+ func callerControlledAttributeSize (attr authorizer.Attributes ) int64 {
273
+ return int64 (len (attr .GetNamespace ())) +
274
+ int64 (len (attr .GetVerb ())) +
275
+ int64 (len (attr .GetAPIGroup ())) +
276
+ int64 (len (attr .GetAPIVersion ())) +
277
+ int64 (len (attr .GetResource ())) +
278
+ int64 (len (attr .GetSubresource ())) +
279
+ int64 (len (attr .GetName ())) +
280
+ int64 (len (attr .GetPath ()))
281
+ }
You can’t perform that action at this time.
0 commit comments