Skip to content

fix(security): Ray pods with RuntimeDefault seccomp, pprof off (CCF-18300) - #293

Open
kbhos-splunk wants to merge 2 commits into
feature/ai-pod-cra-1.1from
kbhos/ccf-18300-ray-seccomp-pprof
Open

kbhos-splunk wants to merge 2 commits into
feature/ai-pod-cra-1.1from
kbhos/ccf-18300-ray-seccomp-pprof

Conversation

@kbhos-splunk

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

Copy link
Copy Markdown
Collaborator

Summary

PSB SEC-RUN-ASLR (CCF-18300), FR3 and FR4. Follow-up to #265 (PIE operator image).

FR3: ASLR must not be disabled

  • The Ray head and worker pods ran with no seccomp profile. On the splunk-ai lab (2026-11-26) the live Ray head pod showed Seccomp: 0, and setarch -R started a shell with personality 0x40000 (ADDR_NO_RANDOMIZE) and the stack at the fixed address 0x7ffffffdd000.
  • pkg/ai/raybuilder now sets seccompProfile: RuntimeDefault on the head and worker pod templates. The RuntimeDefault profile of CRI-O and containerd rejects personality(ADDR_NO_RANDOMIZE). The pod-level profile also applies to the KubeRay autoscaler sidecar.
  • OpenShift: the built-in anyuid SCC allows no seccomp profile. A server dry-run on the lab showed that a Ray head pod with RuntimeDefault falls through to restricted-v2 with runAsUser: 1000760000. The Ray images do not support a random UID.
    • openshift_with_stack.sh now creates splunk-ai-anyuid-seccomp, a copy of the cluster's anyuid SCC with seccompProfiles: [runtime/default], and grants it to system:serviceaccounts:<AI namespace>. It runs in grant_privileged_scc, before the operator manifests are applied.
    • It keeps the anyuid priority (10). With equal priority and restriction score, OpenShift sorts SCCs by name, so pods without a seccomp profile still get anyuid.
    • clean-all deletes the SCC only when the installer created it.
  • k0s and EKS need no change. Pod Security admission accepts RuntimeDefault.

FR4: no address leaks

  • Delete internal/controller/debug. No code imports it. It registered the net/http/pprof handlers (goroutine and heap dumps).
  • Splunk Operator 3.0.0: --pprof becomes --pprof=false. The flag defaults to true in cmd/main.go, so removing it would not turn pprof off.
  • Dockerfile.debug (Delve) is used only by skaffold-dev.yaml and by no release workflow. No change.

Test plan

  • go build ./..., go vet, go test ./pkg/... ./internal/... ./cmd/... pass. New test TestRayPodTemplatesUseRuntimeDefaultSeccomp checks the head and worker templates.

  • go mod tidy makes 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.

    Check Result
    Live Ray head pod, no profile Seccomp: 0; setarch -R worked: personality 0x40000, stack at fixed 0x7ffffffdd000
    Dry-run as kuberay-operator, no profile SCC anyuid (no change for pods without a profile)
    Dry-run as kuberay-operator, RuntimeDefault SCC splunk-ai-anyuid-seccomp (not restricted-v2)
    Test pod from the Ray head image, RuntimeDefault SCC splunk-ai-anyuid-seccomp, uid=1001(ray), Seccomp: 2
    setarch -R in the test pod rejected: failed to set personality to x86_64: Function not implemented (CRI-O returns ENOSYS)
    Stack address, two runs in the test pod 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):

    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

…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>
@kbhos-splunk
kbhos-splunk marked this pull request as ready for review November 26, 2026 11:52
@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-26T11:53:41.302238Z 20aac80 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. 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

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] 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

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 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

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.

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 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.


ensure_ray_seccomp_scc() {
local group="system:serviceaccounts:${AI_NS}" manifest
if oc get scc "${RAY_SECCOMP_SCC}" &>/dev/null; then

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] 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

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 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

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.

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>
kbhos-splunk added a commit that referenced this pull request Nov 30, 2026
…-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>

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