From ecbd0137957b4afd4cdd94c0209998228fd70e99 Mon Sep 17 00:00:00 2001 From: Jordan Liggitt Date: Mon, 20 Aug 2018 15:36:39 -0400 Subject: [PATCH] limit forbidden error to details of what was forbidden --- .../src/k8s.io/apiserver/pkg/endpoints/filters/authorization.go | 2 +- .../src/k8s.io/apiserver/pkg/endpoints/filters/impersonation.go | 2 +- test/integration/master/synthetic_master_test.go | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/staging/src/k8s.io/apiserver/pkg/endpoints/filters/authorization.go b/staging/src/k8s.io/apiserver/pkg/endpoints/filters/authorization.go index 4c9f140ca30..998c05bcf73 100644 --- a/staging/src/k8s.io/apiserver/pkg/endpoints/filters/authorization.go +++ b/staging/src/k8s.io/apiserver/pkg/endpoints/filters/authorization.go @@ -73,7 +73,7 @@ func WithAuthorization(handler http.Handler, a authorizer.Authorizer, s runtime. glog.V(4).Infof("Forbidden: %#v, Reason: %q", req.RequestURI, reason) audit.LogAnnotation(ae, decisionAnnotationKey, decisionForbid) audit.LogAnnotation(ae, reasonAnnotationKey, reason) - responsewriters.Forbidden(ctx, attributes, w, req, reason, s) + responsewriters.Forbidden(ctx, attributes, w, req, "", s) }) } diff --git a/staging/src/k8s.io/apiserver/pkg/endpoints/filters/impersonation.go b/staging/src/k8s.io/apiserver/pkg/endpoints/filters/impersonation.go index 726cbe4d565..38414a6afa7 100644 --- a/staging/src/k8s.io/apiserver/pkg/endpoints/filters/impersonation.go +++ b/staging/src/k8s.io/apiserver/pkg/endpoints/filters/impersonation.go @@ -110,7 +110,7 @@ func WithImpersonation(handler http.Handler, a authorizer.Authorizer, s runtime. decision, reason, err := a.Authorize(actingAsAttributes) if err != nil || decision != authorizer.DecisionAllow { glog.V(4).Infof("Forbidden: %#v, Reason: %s, Error: %v", req.RequestURI, reason, err) - responsewriters.Forbidden(ctx, actingAsAttributes, w, req, reason, s) + responsewriters.Forbidden(ctx, actingAsAttributes, w, req, "", s) return } } diff --git a/test/integration/master/synthetic_master_test.go b/test/integration/master/synthetic_master_test.go index a4ef671983a..d0190830dff 100644 --- a/test/integration/master/synthetic_master_test.go +++ b/test/integration/master/synthetic_master_test.go @@ -175,7 +175,7 @@ func TestStatus(t *testing.T) { statusCode: http.StatusForbidden, reqPath: "/apis", reason: "Forbidden", - message: `forbidden: User "" cannot get path "/apis": Everything is forbidden.`, + message: `forbidden: User "" cannot get path "/apis"`, }, { name: "401",