Add SCC.AllowPrivilegeEscalation (aka no-new-privs)#18398
Add SCC.AllowPrivilegeEscalation (aka no-new-privs)#18398php-coder wants to merge 5 commits intoopenshift:masterfrom
Conversation
pkg/api/serialization_test.go
Outdated
| scc.Volumes = []securityapi.FSType{volumeTypes[c.Rand.Intn(len(volumeTypes))]} | ||
|
|
||
| // match to the defaulting logic that is used to be backward compatible | ||
| scc.AllowPrivilegeEscalation = true |
There was a problem hiding this comment.
This looks off. Why doesn't false roundtrip?
There was a problem hiding this comment.
I suspect that to the original object were applied defaults that always set this value to true? But I'm not sure. I just know that it works :(
pkg/api/serialization_test.go
Outdated
|
|
||
| // match to the defaulting logic that is used to be backward compatible | ||
| scc.AllowPrivilegeEscalation = true | ||
| scc.DefaultAllowPrivilegeEscalation = nil |
There was a problem hiding this comment.
This looks weird. Why can't it roundtrip for a value?
There was a problem hiding this comment.
Probably because this field has omitempty and after roundtrip it's always nil.
|
I (still) stuck on This means that defaults don't get applied to |
|
@deads2k any advice would be appreciated! |
795b807 to
1e496e1
Compare
|
/retest |
|
@php-coder see php-coder#3 to get your tests passing correctly. |
e17205f to
b0880f4
Compare
|
Rebased on top of #19624 |
|
/hold cancel |
9c5674e to
fb8505d
Compare
|
|
||
| // now add DefaultAllowPrivilegeEscalation to the SecurityContextConstraints | ||
| scc.DefaultAllowPrivilegeEscalation = &yes | ||
| scc.AllowPrivilegeEscalation = &no |
There was a problem hiding this comment.
Given 5ca1e18#diff-0d673702b8c4f7d9b631d3bae9cc2d90R136, isn't this an invalid SCC?
There was a problem hiding this comment.
|
Thank you @php-coder for fixing the test cases. |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: php-coder, stlaz Assign the PR to them by writing The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
42075fc to
82cadc2
Compare
|
New changes are detected. LGTM label has been removed. |
82cadc2 to
2a9b2d7
Compare
2a9b2d7 to
0014ceb
Compare
|
Currently it fails with: |
…ions for controlling no-new-privs flag. This commit adds two new members to SecurityContextConstraints: * AllowPrivilegeEscalation -- controls whether a container may request privilege escalation or not (by setting SecurityContext.AllowPrivilegeEscalation: true). When SCC doesn't define this member, it defaulted to "true" for backward/Kubernetes compatibility reasons. * DefaultAllowPrivilegeEscalation -- sets default value for container's SecurityContext.AllowPrivilegeEscalation field when it wasn't explicitly specified.
8b48ad5 to
dcf5568
Compare
This issue should be resolved now. Thanks to @liggitt : |
|
this is being handled in #20152 |
|
@php-coder: The following tests failed, say
Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here. |
This PR adds two new members to
SecurityContextConstraints:AllowPrivilegeEscalation-- controls whether a container may request privilege escalation or not (by settingSecurityContext.AllowPrivilegeEscalation: true). When SCC doesn't define this member, it defaulted totruefor backward/Kubernetes compatibility reasons.DefaultAllowPrivilegeEscalation-- sets default value for container'sSecurityContext.AllowPrivilegeEscalationfield when it wasn't explicitly specified.Kubernetes already has such support for their PodSecurityPolicy (kubernetes/kubernetes#47019) and, with that PR, OpenShift cluster admins will also have ability to deny execution of SUID-binaries.
Trello: https://trello.com/c/slL9l4pw/29-3-no-new-privs