When making security-related changes, ensure the configuration is (1) least-privilege/scoped, (2) actually enforced by the platform, and (3) consistent across code/docs.
Apply this standard:
runAsNonRoot: true, the kubelet must be able to verify the container’s non-root user. Avoid cases where the image uses a non-numeric/named USER.USER when runAsNonRoot is enabled (or ensure the platform can otherwise verify). If you need deterministic behavior across k8s distros, set a numeric UID in the Dockerfile, and align podSecurityContext with your storage-class behavior.podSecurityContext to {} can behave unexpectedly due to Helm map merges—always confirm the rendered securityContext with helm template.Example (numeric UID to satisfy kubelet verification):
# Ensure kubelet can verify non-root when runAsNonRoot: true
USER 1000:0
Example (scope secrets to test jobs):
# Only provide sensitive tokens where they are required (e.g., PR test jobs)
# Avoid injecting tokens into broad release job env blocks.
env:
# GITHUB_COPILOT_TOKEN: ${{ secrets.GITHUB_COPILOT_TOKEN }} # keep out of release jobs