Repository navigation
fix(security): Ray pods with RuntimeDefault seccomp, pprof off (CCF-18300) - #293
kbhos-splunk wants to merge 2 commits into
Conversation
…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>
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
vavarshn
left a comment
There was a problem hiding this comment.
CCF-18300 code review. The inline findings cover the OpenShift SCC install and cleanup paths.
|
|
||
| ensure_ray_seccomp_scc() { | ||
| local group="system:serviceaccounts:${AI_NS}" manifest | ||
| if oc get scc "${RAY_SECCOMP_SCC}" &>/dev/null; then |
There was a problem hiding this comment.
[P2] Validate an existing SCC before granting it
This branch grants any SCC with this name to every service account in the AI namespace. If an administrator-managed SCC has a different UID strategy or disallows runtime/default, Ray can fail admission or start under an unexpected UID. A more permissive SCC would also be granted as-is. Please compare the existing SCC's security settings with the intended policy before granting it, and fail with a clear error if they differ.
| component_is_owned scc_privileged_ai_operator && oc adm policy remove-scc-from-group privileged "system:serviceaccounts:${ai_operator_ns}" 2>/dev/null || true | ||
| component_is_owned scc_anyuid_ai_namespace && oc adm policy remove-scc-from-group anyuid "system:serviceaccounts:${AI_NS}" 2>/dev/null || true | ||
| component_is_owned scc_ray_seccomp_ai_namespace && oc adm policy remove-scc-from-group "${RAY_SECCOMP_SCC}" "system:serviceaccounts:${AI_NS}" 2>/dev/null || true | ||
| component_is_owned scc_ray_seccomp_created && oc delete scc "${RAY_SECCOMP_SCC}" --ignore-not-found=true 2>/dev/null || true |
There was a problem hiding this comment.
[P2] Preserve shared SCCs and administrator grants during cleanup
The SCC is cluster scoped, but ownership is recorded per AI namespace. If another installation reuses this SCC, cleaning up the original installation deletes the policy that the other namespace still needs. The reuse path also checks only .groups, so an existing grant via RBAC can be marked installer owned. Please track each installation's grant separately and remove only what it created. Keep a shared SCC in place while other consumers depend on it.
| Set `openshift.grantPrivilegedSCC: false` only when a cluster administrator has | ||
| already granted the required SCC access. This setting disables the installer's | ||
| namespace-wide SCC grants; it does not remove the workloads' SCC requirements. | ||
| In this case, the Ray service accounts must have an SCC that allows |
There was a problem hiding this comment.
Honor the documented SCC opt-out
The guide shows grantPrivilegedSCC: false, but the existing yq expression .openshift.grantPrivilegedSCC // "true" returns "true" for a YAML boolean false. Following the documented opt-out can now grant this new SCC along with the existing grants. Please default only when the key is absent and preserve explicit false.
vvarshney-splunk
left a comment
There was a problem hiding this comment.
Reposting the CCF-18300 inline findings under my Splunk account.
|
|
||
| ensure_ray_seccomp_scc() { | ||
| local group="system:serviceaccounts:${AI_NS}" manifest | ||
| if oc get scc "${RAY_SECCOMP_SCC}" &>/dev/null; then |
There was a problem hiding this comment.
[P2] Validate an existing SCC before granting it
This branch grants any SCC with this name to every service account in the AI namespace. If an administrator-managed SCC has a different UID strategy or disallows runtime/default, Ray can fail admission or start under an unexpected UID. A more permissive SCC would also be granted as-is. Please compare the existing SCC's security settings with the intended policy before granting it, and fail with a clear error if they differ.
| component_is_owned scc_privileged_ai_operator && oc adm policy remove-scc-from-group privileged "system:serviceaccounts:${ai_operator_ns}" 2>/dev/null || true | ||
| component_is_owned scc_anyuid_ai_namespace && oc adm policy remove-scc-from-group anyuid "system:serviceaccounts:${AI_NS}" 2>/dev/null || true | ||
| component_is_owned scc_ray_seccomp_ai_namespace && oc adm policy remove-scc-from-group "${RAY_SECCOMP_SCC}" "system:serviceaccounts:${AI_NS}" 2>/dev/null || true | ||
| component_is_owned scc_ray_seccomp_created && oc delete scc "${RAY_SECCOMP_SCC}" --ignore-not-found=true 2>/dev/null || true |
There was a problem hiding this comment.
[P2] Preserve shared SCCs and administrator grants during cleanup
The SCC is cluster scoped, but ownership is recorded per AI namespace. If another installation reuses this SCC, cleaning up the original installation deletes the policy that the other namespace still needs. The reuse path also checks only .groups, so an existing grant via RBAC can be marked installer owned. Please track each installation's grant separately and remove only what it created. Keep a shared SCC in place while other consumers depend on it.
| Set `openshift.grantPrivilegedSCC: false` only when a cluster administrator has | ||
| already granted the required SCC access. This setting disables the installer's | ||
| namespace-wide SCC grants; it does not remove the workloads' SCC requirements. | ||
| In this case, the Ray service accounts must have an SCC that allows |
There was a problem hiding this comment.
Honor the documented SCC opt-out
The guide shows grantPrivilegedSCC: false, but the existing yq expression .openshift.grantPrivilegedSCC // "true" returns "true" for a YAML boolean false. Following the documented opt-out can now grant this new SCC along with the existing grants. Please default only when the key is absent and preserve explicit false.
…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>
Summary
PSB SEC-RUN-ASLR (CCF-18300), FR3 and FR4. Follow-up to #265 (PIE operator image).
FR3: ASLR must not be disabled
Seccomp: 0, andsetarch -Rstarted a shell with personality0x40000(ADDR_NO_RANDOMIZE) and the stack at the fixed address0x7ffffffdd000.pkg/ai/raybuildernow setsseccompProfile: RuntimeDefaulton the head and worker pod templates. The RuntimeDefault profile of CRI-O and containerd rejectspersonality(ADDR_NO_RANDOMIZE). The pod-level profile also applies to the KubeRay autoscaler sidecar.anyuidSCC allows no seccomp profile. A server dry-run on the lab showed that a Ray head pod with RuntimeDefault falls through torestricted-v2withrunAsUser: 1000760000. The Ray images do not support a random UID.openshift_with_stack.shnow createssplunk-ai-anyuid-seccomp, a copy of the cluster'sanyuidSCC withseccompProfiles: [runtime/default], and grants it tosystem:serviceaccounts:<AI namespace>. It runs ingrant_privileged_scc, before the operator manifests are applied.anyuidpriority (10). With equal priority and restriction score, OpenShift sorts SCCs by name, so pods without a seccomp profile still getanyuid.clean-alldeletes the SCC only when the installer created it.FR4: no address leaks
internal/controller/debug. No code imports it. It registered thenet/http/pprofhandlers (goroutine and heap dumps).--pprofbecomes--pprof=false. The flag defaults totrueincmd/main.go, so removing it would not turn pprof off.Dockerfile.debug(Delve) is used only byskaffold-dev.yamland by no release workflow. No change.Test plan
go build ./...,go vet,go test ./pkg/... ./internal/... ./cmd/...pass. New testTestRayPodTemplatesUseRuntimeDefaultSeccompchecks the head and worker templates.go mod tidymakes no change.test_openshift_with_stack.sh: 343 passed, 0 failed. This includes 12 new checks for the SCC manifest, create and grant paths, install order, and cleanup.Server dry-run on the lab: the SCC manifest made by
ray_seccomp_scc_manifest()is accepted.Lab test on splunk-ai, OCP 4.21, 2026-11-26 11:51 UTC, branch at 20aac80. The SCC and the test pod were deleted after the test.
Seccomp: 0;setarch -Rworked: personality0x40000, stack at fixed0x7ffffffdd000kuberay-operator, no profileanyuid(no change for pods without a profile)kuberay-operator, RuntimeDefaultsplunk-ai-anyuid-seccomp(notrestricted-v2)splunk-ai-anyuid-seccomp,uid=1001(ray),Seccomp: 2setarch -Rin the test podfailed to set personality to x86_64: Function not implemented(CRI-O returns ENOSYS)0x7ffea6aa5000,0x7ffc776cd000(ASLR on)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):
splunk-ai-anyuid-seccompwith RuntimeDefault, UID from the imageSeccomp: 2in Ray head and workers, SAIA v1, v2, v2 worker, NGINX, SLIM and Weaviatepersonality(ADDR_NO_RANDOMIZE)(setarch -Ror Python ctypes)/gemma4_31b_it/v1/chat/completionsfrom the SAIA v2 pod: HTTP 200, answerParis, 3.1 sprivileged(it adds NET_BIND_SERVICE), not the new SCCNot 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