Skip to content
This repository was archived by the owner on Mar 26, 2021. It is now read-only.

Commit 7a9f4ac

Browse files
author
Kubernetes Submit Queue
authored
Merge pull request #47019 from jessfraz/allowPrivilegeEscalation
Automatic merge from submit-queue (batch tested with PRs 49651, 49707, 49662, 47019, 49747) Add support for `no_new_privs` via AllowPrivilegeEscalation **What this PR does / why we need it**: Implements kubernetes/community#639 Fixes #38417 Adds `AllowPrivilegeEscalation` and `DefaultAllowPrivilegeEscalation` to `PodSecurityPolicy`. Adds `AllowPrivilegeEscalation` to container `SecurityContext`. Adds the proposed behavior to `kuberuntime`, `dockershim`, and `rkt`. Adds a bunch of unit tests to ensure the desired default behavior and that when `DefaultAllowPrivilegeEscalation` is explicitly set. Tests pass locally with docker and rkt runtimes. There are also a few integration tests with a `setuid` binary for sanity. **Release note**: ```release-note Adds AllowPrivilegeEscalation to control whether a process can gain more privileges than it's parent process ```
2 parents e65464d + 2803333 commit 7a9f4ac

File tree

3 files changed

+15
-0
lines changed

3 files changed

+15
-0
lines changed

apis/openapi-spec/swagger.json

+4
Original file line numberDiff line numberDiff line change
@@ -11676,6 +11676,10 @@
1167611676
"io.k8s.api.core.v1.SecurityContext": {
1167711677
"description": "SecurityContext holds security configuration that will be applied to a container. Some fields are present in both SecurityContext and PodSecurityContext. When both are set, the values in SecurityContext take precedence.",
1167811678
"properties": {
11679+
"allowPrivilegeEscalation": {
11680+
"description": "AllowPrivilegeEscalation controls whether a process can gain more privileges than it's parent process. This bool directly controls if the no_new_privs flag will be set on the container process. AllowPrivilegeEscalation is true always when the container is: 1) run as Privileged 2) has CAP_SYS_ADMIN",
11681+
"type": "boolean"
11682+
},
1167911683
"capabilities": {
1168011684
"description": "The capabilities to add/drop when running containers. Defaults to the default set of capabilities granted by the container runtime.",
1168111685
"$ref": "#/definitions/io.k8s.api.core.v1.Capabilities"

apis/swagger-spec/extensions_v1beta1.json

+4
Original file line numberDiff line numberDiff line change
@@ -6556,6 +6556,10 @@
65566556
"readOnlyRootFilesystem": {
65576557
"type": "boolean",
65586558
"description": "Whether this container has a read-only root filesystem. Default is false."
6559+
},
6560+
"allowPrivilegeEscalation": {
6561+
"type": "boolean",
6562+
"description": "AllowPrivilegeEscalation controls whether a process can gain more privileges than it's parent process. This bool directly controls if the no_new_privs flag will be set on the container process. AllowPrivilegeEscalation is true always when the container is: 1) run as Privileged 2) has CAP_SYS_ADMIN"
65596563
}
65606564
}
65616565
},

docs/api-reference/extensions/v1beta1/definitions.html

+7
Original file line numberDiff line numberDiff line change
@@ -6452,6 +6452,13 @@ <h3 id="_v1_securitycontext">v1.SecurityContext</h3>
64526452
<td class="tableblock halign-left valign-top"><p class="tableblock">boolean</p></td>
64536453
<td class="tableblock halign-left valign-top"><p class="tableblock">false</p></td>
64546454
</tr>
6455+
<tr>
6456+
<td class="tableblock halign-left valign-top"><p class="tableblock">allowPrivilegeEscalation</p></td>
6457+
<td class="tableblock halign-left valign-top"><p class="tableblock">AllowPrivilegeEscalation controls whether a process can gain more privileges than it&#8217;s parent process. This bool directly controls if the no_new_privs flag will be set on the container process. AllowPrivilegeEscalation is true always when the container is: 1) run as Privileged 2) has CAP_SYS_ADMIN</p></td>
6458+
<td class="tableblock halign-left valign-top"><p class="tableblock">false</p></td>
6459+
<td class="tableblock halign-left valign-top"><p class="tableblock">boolean</p></td>
6460+
<td class="tableblock halign-left valign-top"><p class="tableblock">false</p></td>
6461+
</tr>
64556462
</tbody>
64566463
</table>
64576464

0 commit comments

Comments
 (0)