Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ideally all tasks run as non-root #759

Open
github-actions bot opened this issue Dec 22, 2024 · 0 comments
Open

ideally all tasks run as non-root #759

github-actions bot opened this issue Dec 22, 2024 · 0 comments

Comments

@github-actions
Copy link
Contributor

runAsNonRoot: true

apiVersion: kyverno.io/v1
kind: ClusterPolicy
metadata:
  name: require-tekton-securitycontext
  annotations:
    policies.kyverno.io/title: Require securityContext for Tekton TaskRun
    policies.kyverno.io/category: Tekton
    policies.kyverno.io/severity: medium
    policies.kyverno.io/subject: TaskRun
    kyverno.io/kyverno-version: 1.7.2
    policies.kyverno.io/minversion: 1.7.0
    kyverno.io/kubernetes-version: "1.23"
    policies.kyverno.io/description: >- 
      A securityContext is required for each TaskRun step.
spec:
  validationFailureAction: Audit
  background: true
  rules:
  - name: check-step-securitycontext
    match:
      any:
      - resources:
          kinds:
          - tekton.dev/v1beta1/TaskRun.status
    validate:
      message: "A securityContext is required with `privileged` and `allowPrivilegeEscalation` set to `false`."
      pattern:
        =(status):
          =(taskSpec):
            steps:
              # TODO: missing securityContext for digest-to-results
              - (name): "!digest-to-results"
                securityContext:
                  # TODO: ideally all tasks run as non-root
                  #runAsNonRoot: true
                  privileged: false
                  allowPrivilegeEscalation: false
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

No branches or pull requests

0 participants