Skip to content

Commit 3f5cad6

Browse files
author
OpenShift Bot
authored
Merge pull request #11549 from liggitt/rsh-error
Merged by openshift-bot
2 parents 30a00dc + 892d38c commit 3f5cad6

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

pkg/security/admission/scc_exec.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package admission
22

33
import (
4+
"fmt"
45
"io"
56

67
oadmission "github.com/openshift/origin/pkg/cmd/server/admission"
@@ -48,7 +49,7 @@ func (d *sccExecRestrictions) Admit(a kadmission.Attributes) (err error) {
4849
// we're allowed to use the SA the pod is using. Otherwise, user-A creates pod and user-B (who can't use the SA) can exec into it.
4950
createAttributes := kadmission.NewAttributesRecord(pod, pod, kapi.Kind("Pod").WithVersion(""), a.GetNamespace(), a.GetName(), a.GetResource(), "", kadmission.Create, a.GetUserInfo())
5051
if err := d.constraintAdmission.Admit(createAttributes); err != nil {
51-
return kadmission.NewForbidden(a, err)
52+
return kadmission.NewForbidden(a, fmt.Errorf("%s operation is not allowed because the pod's security context exceeds your permissions: %v", a.GetSubresource(), err))
5253
}
5354

5455
return nil

0 commit comments

Comments
 (0)