-
Notifications
You must be signed in to change notification settings - Fork 14.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Default value for Pod.spec.containers.securityContext.allowPrivilegeEscalation #30104
Comments
Moreover the text about allowPrivilegeEscalation is:
Does this mean “1) or 2)” or it means “1) and 2)”? |
/sig auth This might be an API reference generation bug? |
The Kubernetes project currently lacks enough contributors to adequately respond to all issues and PRs. This bot triages issues and PRs according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /lifecycle stale |
The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs. This bot triages issues and PRs according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /lifecycle rotten |
/remove-lifecycle rotten |
I think 1) and 2). See the validation https://github.com/kubernetes/kubernetes/blob/master/pkg/apis/core/validation/validation.go#L6178-L6191 |
Please use “and” / “or” in the documentation, when glueing 1) with 2). |
if above make sense as per https://github.com/kubernetes/kubernetes/blob/4d78db54a58e250b049c4fe17ac484e5c3ec662d/staging/src/k8s.io/pod-security-admission/policy/check_allowPrivilegeEscalation.go and https://github.com/kubernetes/kubernetes/blob/master/pkg/apis/core/validation/validation.go#L6178-L6191 then |
The Kubernetes project currently lacks enough contributors to adequately respond to all issues and PRs. This bot triages issues and PRs according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /lifecycle stale |
/remove-lifecycle stale |
The Kubernetes project currently lacks enough contributors to adequately respond to all issues and PRs. This bot triages issues and PRs according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /lifecycle stale |
/remove-lifecycle stale |
The Kubernetes project currently lacks enough contributors to adequately respond to all issues and PRs. This bot triages issues and PRs according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /lifecycle stale |
The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs. This bot triages issues and PRs according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /lifecycle rotten |
/remove-lifecycle rotten |
I believe this description is not (no longer?) correct, because:
Note however that therefore and confusingly, However, I don't have the full context here. @mk46 Please let me know if I missed anything. See also the description in Datree's documentation:
If my analysis is correct, the following text makes sense:
|
This issue has not been updated in over 1 year, and should be re-triaged. You can:
For more details on the triage process, see https://www.kubernetes.dev/docs/guide/issue-triage/ /remove-triage accepted |
/triage accepted |
@0xbf00 said:
When I read this, I see it as defaulting to // handle the case where the user did not set the default and did not explicitly set allowPrivilegeEscalation
if sc.AllowPrivilegeEscalation == nil {
return false
} This seems like an important security setting to have clarity around the behavior. If there's a consensus that this actually does default to false, I'd be happy to make a PR with the original proposal from @mk46
(I don't know where the text from kubectl explain lives in the code yet, but can dig for it.) As well as the website:
|
@dbowling The code that we both linked to relates to a derived property ( // AddNoNewPrivileges returns if we should add the no_new_privs option.
func AddNoNewPrivileges(sc *v1.SecurityContext) bool {
// ...
// handle the case where the user did not set the default and did not explicitly set allowPrivilegeEscalation
if sc.AllowPrivilegeEscalation == nil {
return false
}
// ...
} negates a negation. After this code, if To be fair, I have not investigated this any more other than reading your comment and checking the linked code, but I cannot help but notice that the points I raised originally all seem to apply to the current implementation which you also referenced. Yet your conclusion is the exact opposite of my conclusion. If you @dbowling or somebody else can let me know what I'm missing I'd be really grateful. If I'm not missing anything this is really, really confusing code that should not exist. |
I'll agree that the code is confusing, for sure.
Ugh, I may be reading things wrong then. The code comment says that when this is true, The more I look at the docs, code, and history of the proposal, the more I realize I am not qualified to determine what is going on here. Before arriving here, I initially reviewed the archived design proposal, which had this table:
Further, the last line of that doc says:
Specifically, I'm calling out I think that gets to some of what is at question. I'm not familiar with the Kubernetes process on if the proposals are ever updated as the code changes, so that coupled with the banner "repository has been archived by the owner on Dec 2, 2021" means it is just background info. I do find it interesting that none of the code I'm looking at from the links in this issue seems to indicate that the I'm just trying to figure out if I need to enforce a setting on this for all the workloads in my cluster, or if I am safe with the defaults, and this just furthers the need to give better guidance in the Kubernetes docs on the issue. In case anyone comes to this issue to figure more out, I'll also point to a resource that went into more depth than others: https://blog.christophetd.fr/stop-worrying-about-allowprivilegeescalation/. The author (@christophetd - a cloud security researcher & advocate at Datadog) claims the default value is He also demonstrates a scenario where |
At https://kubernetes.io/docs/reference/kubernetes-api/workload-resources/pod-v1/#security-context-1 for
it is not described what the default value is (when the container has no CAP_SYS_ADMIN and is not run as privileged)
The text was updated successfully, but these errors were encountered: