Repository navigation
docs: add policy pages for the Agent Sandbox controls #209
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| # Kubescape C-0297: Agent Sandbox runtime isolation | ||
|
|
||
| ## Why this policy is required: | ||
| Agent Sandbox workloads often run untrusted or multi-tenant code. With a standard container runtime, that code shares the host kernel, so a kernel exploit reaches the node. Sandboxed runtimes such as gVisor or Kata Containers add an isolation boundary between the workload and the host kernel. This policy makes Sandbox and SandboxTemplate resources select one of the RuntimeClasses you have approved as hardened. | ||
|
|
||
| ## Severity Level: High | ||
|
|
||
| ## Configuration Parameters: | ||
| * [hardenedSandboxRuntimeClasses](https://kubescape.io/docs/frameworks-and-controls/configuring-controls/#hardenedsandboxruntimeclasses) | ||
|
|
||
| ## Resources this policy could be applied to: | ||
| * Sandbox (`agents.x-k8s.io/v1beta1`) | ||
| * SandboxTemplate (`extensions.agents.x-k8s.io/v1beta1`) | ||
|
|
||
| ## What does this policy do: | ||
| This Policy checks that `spec.podTemplate.spec.runtimeClassName` is one of the names in the `hardenedSandboxRuntimeClasses` parameter. A resource that sets no runtimeClassName, or one outside the list, is denied. | ||
|
|
||
| The policy compares the name only and does not inspect the handler of the referenced RuntimeClass, so the list should contain only RuntimeClasses that use a hardened runtime. When the parameter is missing or empty, the policy allows every resource. | ||
|
|
||
| ## Implementing this policy in the Cluster: | ||
| [Refer here for using the policy in the cluster](https://github.com/kubescape/cel-admission-library#using-the-library) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| # Kubescape C-0309: Agent Sandbox service account token isolation | ||
|
|
||
| ## Why this policy is required: | ||
| Agent Sandbox workloads commonly execute untrusted or model-generated code. Mounting a Kubernetes service account token gives that code an identity it can use against the Kubernetes API. This policy keeps the token out of Agent Sandbox pods unless it is set on purpose. | ||
|
|
||
| ## Severity Level: High | ||
|
|
||
| ## Configuration Parameters: | ||
| * Not Configurable | ||
|
|
||
| ## Resources this policy could be applied to: | ||
| * Sandbox (`agents.x-k8s.io/v1beta1`) | ||
| * SandboxTemplate (`extensions.agents.x-k8s.io/v1beta1`) | ||
|
|
||
| ## What does this policy do: | ||
| This Policy checks `spec.podTemplate.spec.automountServiceAccountToken`: | ||
| * A Sandbox must set it explicitly to `false`. A Sandbox that omits it is denied. | ||
| * A SandboxTemplate may omit it, because the Agent Sandbox template controller defaults it to `false`, but it is denied when it sets the field to `true`. | ||
|
|
||
| ## Implementing this policy in the Cluster: | ||
| [Refer here for using the policy in the cluster](https://github.com/kubescape/cel-admission-library#using-the-library) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| # Kubescape C-0311: Agent Sandbox container resource limits | ||
|
|
||
| ## Why this policy is required: | ||
| An Agent Sandbox container without CPU and memory limits can use as much of the node as it can get. Code running in a sandbox is often untrusted, so a runaway or malicious workload can starve other workloads on the node. Limits bound what each container can consume. | ||
|
|
||
| ## Severity Level: High | ||
|
|
||
| ## Configuration Parameters: | ||
| * Not Configurable | ||
|
|
||
| ## Resources this policy could be applied to: | ||
| * Sandbox (`agents.x-k8s.io/v1beta1`) | ||
| * SandboxTemplate (`extensions.agents.x-k8s.io/v1beta1`) | ||
|
|
||
| ## What does this policy do: | ||
| This Policy checks every container and init container under `spec.podTemplate.spec`. Each one must set both `resources.limits.cpu` and `resources.limits.memory`. A resource with no containers in `spec.podTemplate.spec` is also denied. | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Distinguish an empty container list from a missing field. If
|
||
|
|
||
| ## Implementing this policy in the Cluster: | ||
| [Refer here for using the policy in the cluster](https://github.com/kubescape/cel-admission-library#using-the-library) | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| # Kubescape C-0312: Agent runtime image digest pinning | ||
|
|
||
| ## Why this policy is required: | ||
| A tag such as `:latest` or `:v1` can be moved to point at a different image at any time, so the code an agent runtime runs can change without any change to the resource. Pinning images to an exact SHA-256 digest makes every pod run exactly the image that was reviewed. | ||
|
|
||
| ## Severity Level: High | ||
|
|
||
| ## Configuration Parameters: | ||
| * Not Configurable | ||
|
|
||
| ## Resources this policy could be applied to: | ||
| * Sandbox (`agents.x-k8s.io/v1beta1`) | ||
| * SandboxTemplate (`extensions.agents.x-k8s.io/v1beta1`) | ||
| * WorkerPool (`ate.dev/v1alpha1`) | ||
|
|
||
| ## What does this policy do: | ||
| This Policy requires image references that end in `@sha256:` followed by exactly 64 lowercase hexadecimal characters: | ||
| * For a Sandbox or SandboxTemplate, every container and init container image under `spec.podTemplate.spec`. A resource with no containers there is denied. | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Distinguish an empty container list from a missing field. If
|
||
| * For a WorkerPool, `spec.workerImage`, which must be set. | ||
|
|
||
| ## Implementing this policy in the Cluster: | ||
| [Refer here for using the policy in the cluster](https://github.com/kubescape/cel-admission-library#using-the-library) | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| # Kubescape C-0313: Agent runtime image registries | ||
|
|
||
| ## Why this policy is required: | ||
| Images pulled from an arbitrary registry may not have gone through your scanning, signing or review. Restricting agent runtimes to registries you trust reduces the risk of running a malicious or tampered image. | ||
|
|
||
| ## Severity Level: High | ||
|
|
||
| ## Configuration Parameters: | ||
| * [imageRepositoryAllowList](https://kubescape.io/docs/frameworks-and-controls/configuring-controls/#imagerepositoryallowlist) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Explain how to configure the admission policy's allow list. The linked page describes Kubescape scan configuration only. It covers Add a short section to this page. The section must state that the admission policy reads
|
||
|
|
||
| ## Resources this policy could be applied to: | ||
| * Sandbox (`agents.x-k8s.io/v1beta1`) | ||
| * SandboxTemplate (`extensions.agents.x-k8s.io/v1beta1`) | ||
| * WorkerPool (`ate.dev/v1alpha1`) | ||
|
|
||
| ## What does this policy do: | ||
| This Policy checks that each image comes from a registry in the `imageRepositoryAllowList` parameter: | ||
| * For a Sandbox or SandboxTemplate, every container and init container image under `spec.podTemplate.spec`. | ||
| * For a WorkerPool, `spec.workerImage`. | ||
|
|
||
| An image matches an entry when it starts with that entry followed by `/`. The entry `docker.io` also matches images that name no registry, such as `nginx` or `library/nginx`. When the parameter is missing or empty, the policy allows every resource. | ||
|
|
||
| ## Implementing this policy in the Cluster: | ||
| [Refer here for using the policy in the cluster](https://github.com/kubescape/cel-admission-library#using-the-library) | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| # Kubescape C-0314: Agent Sandbox managed network policy | ||
|
|
||
| ## Why this policy is required: | ||
| With managed networking, the Agent Sandbox controller creates the network policy for each sandbox, which blocks private and internal destinations. Turning management off leaves the sandbox's network access up to whatever other policies exist, so untrusted code may reach internal services. | ||
|
|
||
| ## Severity Level: High | ||
|
|
||
| ## Configuration Parameters: | ||
| * Not Configurable | ||
|
|
||
| ## Resources this policy could be applied to: | ||
| * SandboxTemplate (`extensions.agents.x-k8s.io/v1beta1`) | ||
|
|
||
| ## What does this policy do: | ||
| This Policy denies a SandboxTemplate whose `spec.networkPolicyManagement` is set to anything other than `Managed`. Omitting the field is allowed, since `Managed` is the API default. | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Include the null exception. The policy also allows
|
||
|
|
||
| The managed default still permits traffic to the public internet; it is not a strict default-deny egress policy. | ||
|
|
||
| ## Implementing this policy in the Cluster: | ||
| [Refer here for using the policy in the cluster](https://github.com/kubescape/cel-admission-library#using-the-library) | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Link to an existing parameter reference.
The configuration page has no
hardenedSandboxRuntimeClassessection, so this link does not reach a parameter reference. The C-0297 policy page uses the same link. Add the reference or link to documentation that contains it. (kubescape.io)