Repository navigation
docs/e2e: privileged SCC grant for openshell-sandbox may be obsolete after SCC-aware UID resolution #4808
Description
User Story
As an operator deploying OpenShell on OpenShift, I want the sandbox service account to run with the minimum privileges required, so that the deployment does not grant unnecessary privileged SCC access.
Problem Statement
The public debugging skill (skills/debug-openshell-cluster/SKILL.md) and the e2e helper (e2e/with-kube-gateway.sh) both state that the openshell-sandbox service account requires the privileged SCC on OpenShift, and the helper applies that grant on every run. Since #3110 (plus the annotation fix in #4054), the Kubernetes driver resolves the sandbox UID from the namespace's sa.scc.uid-range annotation, so a sandbox pod should satisfy the restricted-v2 SCC without any grant.
Impact / Why This Matters
- Least privilege: a service account with
privilegedSCC is unnecessary attack surface if the driver already resolves a compliant identity. - Documentation accuracy: the skill is the public debugging guide — telling operators the SA "needs"
privilegedwhen it does not induces unnecessary privilege grants in real clusters. - Operational cost: the e2e helper grants and revokes the SCC on every OpenShift run, adding a side effect that is avoidable if the SCC-aware resolution is sufficient.
Acceptance Criteria
-
e2e:kubernetespasses on OpenShift without theprivilegedSCC grant toopenshell-sandbox - The grant/revoke pair is removed from
e2e/with-kube-gateway.shif confirmed unnecessary - The skill row is rewritten to document the SCC-aware UID resolution as the primary path, with the explicit grant noted only as a fallback
- Any workload fixture that genuinely requires a fixed UID (e.g.
e2e/python/Dockerfile.workloadwith user 1000) is identified and either usessandbox_uidexplicitly or documents the need
Reproduction
Deployed a gateway on an OpenShift cluster using the Helm chart with the values-openshift-scc.yaml overlay. No SCC grants were applied — the deploy only uses the chart's own overlay that nulls the hardcoded runAsUser/fsGroup so restricted-v2 can inject the namespace-assigned range.
The sandbox pods run successfully under the default restricted-v2 profile:
- The namespace's
sa.scc.uid-rangeannotation resolves to1001150000/10000 - Sandbox pods are created with
runAsUser: 1001150000(the first UID from the namespace range) under theopenshell-sandboxservice account oc get scc privileged -o jsonpath='{.users}'returns no entry foropenshell-sandbox— zero privileged grants exist- Sandbox create, exec, and delete all complete normally
- An SELinux audit confirms sandbox processes run under the expected
container_tlabel
This matches the SCC-aware UID resolution in resolve_sandbox_uid (crates/openshell-driver-kubernetes/src/config.rs): the driver reads the sa.scc.uid-range annotation and picks a UID from that range, so the pod satisfies restricted-v2 admission without any grant.
Additional Context
Timeline — the guidance appears to predate the fix by approximately three weeks:
- feat(e2e): make e2e:kubernetes work transparently on OpenShift #3183 (Sep 8) added the privileged grant to the helper and the skill row
- refactor(auth): separate sandbox identity from TLS #3110 (Oct 1) introduced
resolve_sandbox_uidwith namespace-range resolution - fix(kubernetes): wait for OpenShift SCC annotations #4054 (Oct 5) fixed waiting for the OpenShift SCC annotations
One edge case worth deciding with data: workload fixtures that depend on a fixed UID. For example, e2e/python/Dockerfile.workload builds a sandbox user with UID 1000 and files owned by it. Under namespace-range resolution the process runs with a different UID; if such a workload needs to write to UID-1000-owned paths, an explicit sandbox_uid or the grant may still be required for that specific case.
Activity