pipeline icon indicating copy to clipboard operation
pipeline copied to clipboard

tekton cluster resolver let anyone access any tasks on any namespaces by default

Open chmouel opened this issue 2 years ago • 3 comments

Expected Behavior

Don't let someone who does not have access to the task be able to access it

Actual Behavior

Anyone can access to any task as long as they know its name

Steps to Reproduce the Problem

  1. User-a have a git-clone task with for example a reference in a password in clear in that task (bad security practice but one can assume people may feel safe to do this in their own namespace)
  2. User-b create a TaskRun with a reference to User-a namespace and git-clone:
apiVersion: tekton.dev/v1beta1
kind: TaskRun
metadata:
  name: remote-task-reference
spec:
  taskRef:
    resolver: cluster
    params:
    - name: kind
      value: task
    - name: name
      value: git-clone
    - name: namespace
      value: user-a
  1. User-b is able to read the task from user-a and content

Additional Info

  • Kubernetes version:

v0.52.1

This assumes user-b know the task name of user-a but security which mitigate this by obscurity doesn't scale very far :)

Maybe have this restricted to no namespace by default and only explicitly allow namespaces via configuration by default?

chmouel avatar Oct 19 '23 07:10 chmouel

I agree with @chmouel, I think we should make the default configuration for the cluster task to be as secure as possible by default, aka "restricted to no namespace by default and only explicitly allow namespaces via configuration".

/cc @tektoncd/core-maintainers

vdemeester avatar Oct 19 '23 07:10 vdemeester

added a setting to mitigate this in this PR https://github.com/tektoncd/pipeline/pull/7237 I think we may want to make * the default...

chmouel avatar Oct 19 '23 08:10 chmouel

I think i'll submit a new PR setting the new blocked-namespaces=* from https://github.com/tektoncd/pipeline/pull/7237 by default and will see how it goes

chmouel avatar Oct 30 '23 16:10 chmouel