Skip to content

proposal(kagent): correct the pod-security non-goal for Kagent v1.0.x - #50

Open
harshitnub077 wants to merge 3 commits into
kubescape:mainfrom
harshitnub077:proposal/kagent-substrate-nongoal
Open

harshitnub077 wants to merge 3 commits into
kubescape:mainfrom
harshitnub077:proposal/kagent-substrate-nongoal

Conversation

@harshitnub077

@harshitnub077 harshitnub077 commented Dec 4, 2026 •

Copy link
Copy Markdown
Contributor

The "Pod security on Kagent CRs" non-goal says the Kagent controller renders Agent, Harness and SandboxTemplate into a Deployment or Pod that regolibrary already scans. That was the 0.10.x model (manifest_builder.go#L622 at v0.10.1 builds an appsv1.Deployment). On v1.0.x the controller compiles them into a Substrate ActorTemplate, and agents and sandboxes run as Substrate Actors inside the worker pods of the WorkerPool named in spec.substrate.workerPoolRef (sandboxes.md at v1.0.1). So C-0009, C-0016, C-0017 and C-0048 see Substrate's shared worker pods, not any one agent.

The scope doesn't change, only the reasons. I found this while working on kubescape/regolibrary#1011.

Changes

  1. Non-goal. It now gives the v1.0.x reasons for keeping pod security out of scope:
    • the CRs have no pod-shaped fields left;
    • the CRDs reject an image that isn't pinned by sha256 digest;
    • CPU, memory and sandbox class come from the WorkerPool, which C-0312, C-0313 and C-0317 already check (in file scans too);
    • credentials in spec.env are C-0325's.
  2. Motivation paragraph and drift table. The "visible on the Deployment the Kagent controller renders" wording is replaced with how v1.0.x actually runs agents.
  3. Two rejected alternatives.
    • "Cover pod security on the CRs" pointed at the old duplicate-finding reasoning.
    • The ServiceAccount one said serviceAccountName lives in the CR's workload block, but no v1.0.x Kagent CR has that field.
  4. Changelog bullet.

Evidence

All three on kind with the stock kagent 1.0.1 CRDs.

The fields a pod-security control would read, counted on Agent, Harness, SandboxTemplate and AgentTemplate:

$ for r in agents harnesses sandboxtemplates agenttemplates; do printf '%s: ' $r; kubectl explain $r.spec --api-version=api.kagent.dev/v1alpha3 --recursive | grep -c -E '^\s*(serviceAccountName|securityContext|resources|volumes|hostPath|privileged)\b'; done
agents: 0
harnesses: 0
sandboxtemplates: 0
agenttemplates: 0

The same check over all eight CRD files in helm/kagent-crds/templates at v1.0.1, with a few more pod fields:

$ for f in api.kagent.dev_*.yaml; do printf "%s: " "${f#api.kagent.dev_}"; grep -c -E "^\s+(serviceAccountName|securityContext|resources|volumes|hostPath|privileged|hostNetwork|capabilities|nodeSelector|tolerations):" "$f"; done
agents.yaml: 0
agenttemplates.yaml: 0
egresspolicies.yaml: 0
harnesses.yaml: 0
modelconfigs.yaml: 0
modelproviderconfigs.yaml: 0
remotemcpservers.yaml: 0
sandboxtemplates.yaml: 0

What workload actually holds:

$ kubectl explain sandboxtemplates.spec.workload --api-version=api.kagent.dev/v1alpha3
FIELDS:
  image	<string> -required-
    Image is an OCI image reference pinned by sha256 digest.

$ kubectl explain harnesses.spec.workload --api-version=api.kagent.dev/v1alpha3
FIELDS:
  args	<[]string>
    Args overrides the image command arguments when set.

  command	<[]string>
    Command overrides the image entrypoint when set.

  image	<string>
    Image overrides the release's built-in runtime image. BYO requires an image.
    When set, it must be an OCI image reference pinned by sha256 digest.

The CRDs reject an unpinned image at admission:

$ kubectl apply --dry-run=server -f m/tag-image.yaml
The SandboxTemplate "tag-image" is invalid: spec.workload.image: Invalid value: "ghcr.io/example/tools:latest": spec.workload.image in body should match '^[^[:space:]@]+@sha256:[a-f0-9]{64}$'

$ kubectl apply --dry-run=server -f m/digest-image.yaml
sandboxtemplate.api.kagent.dev/digest-image created (server dry run)

Related issues/PRs

Kagent v1.0.x runs agents as Substrate Actors inside WorkerPool worker
pods, not in a Deployment or Pod the controller renders. Give the v1.0.x
reasons for keeping pod security out of scope: the CRs have no pod
fields left, the CRDs enforce digest-pinned images, and the worker
settings are checked on WorkerPool by C-0312, C-0313 and C-0317.

Signed-off-by: Harshit Kudhial <122823756+harshitnub077@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings December 4, 2026 13:07
@coderabbitai

coderabbitai Bot commented Dec 4, 2026 •

Copy link
Copy Markdown

Important

  • Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 5ed424e6-d2f6-4be8-852e-27e5e37f6d2a
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

…ift row checkable

Signed-off-by: Harshit Kudhial <122823756+harshitnub077@users.noreply.github.com>

@matthyx matthyx left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Substrate runtime correction is needed and the v1.0.1 schemas support it. Please correct the two coverage statements in the non-goal so readers can apply the existing seven-control scope accurately. DCO and GitGuardian passed, CodeRabbit skipped, and the reviewed commit has no GitHub Actions runs.

Comment thread proposals/kagent-crd-posture-rules.md Outdated
- **Credentials in `spec.env`** are `C-0325`'s finding.

The dividing line for this proposal is therefore: **a rule earns its place only if
the misconfiguration sits on a Kagent CR field that no existing control reads.** All

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Medium — The field-based scope criterion conflicts with the agreed controls. Shipped C-0327 already reads RemoteMCPServer.spec.headersFrom[].value to decide whether authentication is configured. This proposal assigns the same literal value to C-0325 to detect inline credentials. An inline Authorization header can satisfy C-0327 and still warrant a C-0325 finding. Please define scope by whether an existing control detects the same misconfiguration. Shipped C-0327 predicate, maintainer scope decision

Comment thread proposals/kagent-crd-posture-rules.md Outdated
the misconfiguration sits on a Kagent CR field that no existing control reads.** All
seven rules below meet that test.

There is no separate shift-left gap either. The worker settings live on the

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Medium — Narrow the file-scan coverage claim to WorkerPool settings. A Kagent SandboxTemplate can name a digest-pinned image from a registry outside the configured allowlist while its WorkerPool uses an allowed image. The CRD accepts the digest format, C-0313 reads the worker image, and C-0237 matches Kubernetes workloads and checks signatures. A manifest scan can therefore miss the SandboxTemplate image policy gap even when the WorkerPool checks run. Please acknowledge that gap here and keep additional Kagent image-policy controls out of scope for this proposal. Kagent image schema, C-0313 rule and input fields, C-0237 match metadata

@matthyx matthyx moved this to Waiting on Author in KS PRs tracking Dec 5, 2026
…the CR image gap

Signed-off-by: Harshit Kudhial <122823756+harshitnub077@users.noreply.github.com>
@harshitnub077

Copy link
Copy Markdown
Contributor Author

Thanks! Both fixed in 5f10823. The scope line now goes by whether an existing control detects the same misconfiguration, with C-0327 and C-0325 on headersFrom[].value as the example. The file scan claim is narrowed to the WorkerPool, and the non-goal now says a Kagent SandboxTemplate or Harness workload.image from an unlisted registry isn't covered by C-0313 or C-0237, with Kagent image policy out of scope. I added Harness since it has the same workload.image field.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Waiting on Author

Development

Successfully merging this pull request may close these issues.

3 participants