Skip to content

fix(security): RuntimeDefault seccomp for all AI Pod workloads (CCF-18300 FR3) - #294

Open
kbhos-splunk wants to merge 5 commits into
feature/ai-pod-cra-1.1from
kbhos/ccf-18300-fr3-seccomp-all-pods
Open

kbhos-splunk wants to merge 5 commits into
feature/ai-pod-cra-1.1from
kbhos/ccf-18300-fr3-seccomp-all-pods

Conversation

@kbhos-splunk

@kbhos-splunk kbhos-splunk commented Nov 26, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

PSB SEC-RUN-ASLR (CCF-18300), FR3: ASLR must not be disabled.

Depends on #293. This branch starts from #293, so the PR shows both commits until #293 merges. Review only the last commit, 6e0f5b6. Merge #293 first.

#293 set seccompProfile: RuntimeDefault on the Ray pods only. On the splunk-ai lab (2026-11-26), every other pod that the operator creates also ran with no seccomp profile under anyuid. In these pods any process could start a program without ASLR with setarch -R.

Pod Built in Before
SAIA v1, v2, v2 worker, NGINX pkg/ai/features/saia/impl.go anyuid, no profile
Vector DB setup job pkg/ai/features/saia/impl.go anyuid, no profile
SLIM pkg/ai/features/slim/impl.go anyuid, no profile
Weaviate pkg/ai/weaviate.go anyuid, no profile
SECA pkg/ai/features/seca/impl.go not deployed on the lab

Changes

Pods from other operators already use RuntimeDefault: the Splunk AI Operator manager, KubeRay, Splunk standalone and the Splunk Operator.

Test plan

  • go build ./..., go vet ./pkg/ai/..., go test ./pkg/... ./internal/... ./cmd/... pass. New tests check the pod templates of SAIA (all 5), SLIM, SECA, Weaviate and Ray.

  • test_openshift_with_stack.sh: 343 passed, 0 failed.

  • Lab server dry-run of all 10 AI Pod pods without the new SCC: with RuntimeDefault, every pod falls to restricted-v2 with runAsUser: 1000760000. This shows that all of them need the SCC, not only Ray.

  • Lab server dry-run of all 10 AI Pod pods with the SCC (splunk-ai, OCP 4.21, 2026-11-26 12:42 UTC, branch at 6e0f5b6), as the controller that creates each pod (KubeRay, ReplicaSet, StatefulSet and Job controllers): 10 passed, 0 failed. Each pod gets anyuid without a profile and splunk-ai-anyuid-seccomp with RuntimeDefault, with the image UID and the same container security settings. The test SCC was deleted after the test.

  • Full AI Pod deployment on OpenShift (splunk-ai, OCP 4.21, 2026-11-26) with the operator built in the cluster from 6e0f5b6 (fix(security): RuntimeDefault seccomp for all AI Pod workloads (CCF-18300 FR3) #294 on top of fix(security): Ray pods with RuntimeDefault seccomp, pprof off (CCF-18300) #293; PIE build check passed):

    Check Result
    Rollout about 5 min. KubeRay zero-downtime upgrade to a new RayCluster; all 13 Serve apps RUNNING; AIPlatform and both AIServices Ready
    Pods all 9 running AI Pod pods ready under splunk-ai-anyuid-seccomp with RuntimeDefault, UID from the image
    Seccomp in pid 1 Seccomp: 2 in Ray head and workers, SAIA v1, v2, v2 worker, NGINX, SLIM and Weaviate
    personality(ADDR_NO_RANDOMIZE) (setarch -R or Python ctypes) blocked (ENOSYS) in Ray head and workers, SLIM, SAIA v1, v2 and v2 worker. Control: allowed in an old pod with no profile. NGINX and Weaviate images have no tool for this call
    Model call Gemma /gemma4_31b_it/v1/chat/completions from the SAIA v2 pod: HTTP 200, answer Paris, 3.1 s
    Health SAIA v1, SAIA v2, SLIM and Weaviate: HTTP 200
    Splunk standalone still privileged (it adds NET_BIND_SERVICE), not the new SCC
    Operator log only the existing events RBAC errors (the service account cannot create or patch events; also in v1.0). No other errors
    Restarts SAIA v2 worker 1: it started while Weaviate restarted in the same rollout ("Failed to connect to Weaviate"). Not a seccomp error

    Not covered: the SAIA chat flow through Splunk (needs a Splunk JWT), and a re-run of the vector DB setup Job (the operator does not recreate a completed Job; its template is covered by the dry-run and unit tests). After the test the lab was rolled back to v1.0, and the test SCC and build were removed.

🤖 Generated with Claude Code

kbhos-splunk and others added 2 commits November 26, 2026 16:50
…pprof

PSB SEC-RUN-ASLR (CCF-18300), FR3 and FR4.

FR3: ASLR must not be disabled. The Ray head and worker pods ran with no
seccomp profile (Seccomp: 0 on the splunk-ai lab), so any process in them
could start a program without ASLR with "setarch -R"
(personality ADDR_NO_RANDOMIZE). The raybuilder now sets the pod
seccompProfile to RuntimeDefault, which rejects that call.

On OpenShift the built-in anyuid SCC allows no seccomp profile, so these
pods would fall through to restricted-v2 and get a random UID. The
OpenShift installer now creates splunk-ai-anyuid-seccomp, a copy of anyuid
that also allows runtime/default, grants it to the AI namespace, and
removes it in clean-all when it created it. It keeps the anyuid priority
and sorts after anyuid by name, so pods without a seccomp profile still
get anyuid.

FR4: no address leaks.
- Delete internal/controller/debug. No code imports it; it registered the
  net/http/pprof handlers.
- Start Splunk Operator 3.0.0 with --pprof=false. Its --pprof flag
  defaults to true, so removing the flag would not turn pprof off.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
PSB SEC-RUN-ASLR (CCF-18300), FR3: ASLR must not be disabled.

#293 set seccompProfile RuntimeDefault on the Ray pods only. On the
splunk-ai lab every other pod that the operator creates also ran with no
seccomp profile under anyuid: SAIA v1, SAIA v2, SAIA v2 worker, SAIA
NGINX, the vector DB setup job, SLIM and Weaviate. In these pods any
process could start a program without ASLR with "setarch -R".

- New package pkg/ai/podsecurity with RuntimeDefaultSeccomp(). The Ray,
  SAIA, SLIM, SECA and Weaviate pod templates use it. The pod-level
  profile also covers init containers and injected sidecars (KubeRay
  autoscaler, OpenTelemetry collector).
- OpenShift installer: the SCC from #293 now serves all AI workload pods,
  so RAY_SECCOMP_SCC and its helpers become AI_SECCOMP_SCC,
  ai_seccomp_scc_manifest and ensure_ai_seccomp_scc. The SCC name
  splunk-ai-anyuid-seccomp does not change. #293 is not released, so no
  installed cluster has the old ownership keys.
- The OpenShift readme lists the workloads.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@kbhos-splunk
kbhos-splunk marked this pull request as ready for review November 26, 2026 12:43
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 26, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-26T12:44:36.812426Z 6e0f5b6 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@vavarshn vavarshn left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

CCF-18300 code review of the changes added on top of #293.

Comment thread pkg/ai/weaviate.go Outdated
// Propagate imagePullSecrets from AIPlatform spec
sts.Spec.Template.Spec.ImagePullSecrets = instance.Spec.Images.ImagePullSecrets
// PSB SEC-RUN-ASLR: no process in the pod can turn ASLR off.
sts.Spec.Template.Spec.SecurityContext = podsecurity.RuntimeDefaultSeccomp()

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

[P2] Preserve Weaviate's existing pod security settings

This assignment replaces the whole PodSecurityContext. Existing StatefulSets previously kept fields such as fsGroup, run-as IDs, and SELinux settings through reconciliation. In particular, dropping a custom fsGroup can take away Weaviate's write access to a preexisting PVC. Please initialize the context if needed, update only SeccompProfile, and cover preservation of an existing fsGroup in the regression test.

@vvarshney-splunk vvarshney-splunk left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Reposting the CCF-18300 inline findings under my Splunk account.

Comment thread pkg/ai/weaviate.go Outdated
// Propagate imagePullSecrets from AIPlatform spec
sts.Spec.Template.Spec.ImagePullSecrets = instance.Spec.Images.ImagePullSecrets
// PSB SEC-RUN-ASLR: no process in the pod can turn ASLR off.
sts.Spec.Template.Spec.SecurityContext = podsecurity.RuntimeDefaultSeccomp()

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

[P2] Preserve Weaviate's existing pod security settings

This assignment replaces the whole PodSecurityContext. Existing StatefulSets previously kept fields such as fsGroup, run-as IDs, and SELinux settings through reconciliation. In particular, dropping a custom fsGroup can take away Weaviate's write access to a preexisting PVC. Please initialize the context if needed, update only SeccompProfile, and cover preservation of an existing fsGroup in the regression test.

kbhos-splunk and others added 3 commits November 30, 2026 13:45
…ants

Review of #293 (CCF-18300, PSB SEC-RUN-ASLR FR3).

- The installer now creates splunk-ai-anyuid-seccomp-<AI namespace>, one
  SCC for each AI namespace, with the grant inside the SCC. The ownership
  state is per AI namespace, but the SCC had one cluster-wide name, so
  clean-all of one installation deleted an SCC that another installation
  used.
- If the SCC already exists, the installer compares its security settings
  with anyuid plus runtime/default. If they are different, the installer
  stops with an error and does not grant the SCC.
- ensure_owned_scc_group also finds a grant in a ClusterRoleBinding to the
  system:openshift:scc:<scc> role. oc adm policy add-scc-to-group stores
  grants there (seen on the splunk-ai lab, OpenShift 4.21), so the check
  of only .groups marked an administrator's grant as installer owned, and
  clean-all removed it.
- load_config keeps an explicit openshift.grantPrivilegedSCC: false. The
  yq "//" operator also replaces a YAML boolean false, so the documented
  opt-out did not work and the installer still granted the SCCs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…-fr3-seccomp-all-pods

Bring the review fixes of #293 into this branch: one seccomp SCC for
each AI namespace, a settings check for an existing SCC, SCC grants
found through RBAC, and an explicit openshift.grantPrivilegedSCC: false
that is kept. The conflicts are only the names that this branch
changed (AI_SECCOMP_SCC, ensure_ai_seccomp_scc, scc_ai_seccomp_*).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Review of #294 (CCF-18300, PSB SEC-RUN-ASLR FR3).

The operator updates the Weaviate StatefulSet one field at a time, and
it did not set the pod security context before. The PR replaced the
full context, so a reconcile removed values that an administrator set,
for example an fsGroup that gives Weaviate write access to an existing
PVC. The operator now sets only the seccomp profile and keeps the other
fields. A new test sets fsGroup, runAsUser, SELinux options and an
Unconfined profile on an existing StatefulSet: after a reconcile, only
the profile changes, to RuntimeDefault.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants