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

Does SPIRE improve non-falsifiable provenance? #6601

Open
jimmyjones2 opened this issue Apr 28, 2023 · 7 comments
Open

Does SPIRE improve non-falsifiable provenance? #6601

jimmyjones2 opened this issue Apr 28, 2023 · 7 comments
Labels
kind/bug Categorizes issue or PR as related to a bug. lifecycle/frozen Indicates that an issue or PR should not be auto-closed due to staleness.

Comments

@jimmyjones2
Copy link
Contributor

Have been thinking about TEP-0089 and non-falsifiable provenance. I'm struggling to see how it's possible to improve on the controls than Kubernetes RBAC already provides.

As noted in TEP-0089, a potential threat is exec'ing into a pod. While there might only be a small number of admins with this ability, there may be service accounts with this ability in the namespace (or in other namespaces, such as an ArgoCD service account used for deployment). In OpenShift the pipeline SA has the edit ClusterRole - and as it's the only SA available out of the box that has root privileges, many PipelineRuns will need to use it - meaning TaskRuns will have the ability to exec into other pods.

I think the ability to modify PVC contents is an additional threat. If the contents is changed between a git-clone task and a container build task, there is no longer a guarantee the build is of the git reference that was checked out. The ability to change the contents of a PVC is granted to anyone that can create a pod (including indirectly, such as a Deployment or PipelineRun with an inline TaskSpec - #5359). Also, as per above, if there is a powerful service account in the namespace, the pod can be run with that SA to give exec permission into other pods.

With both the above there seem multiple viable ways to exec into the pod of a TaskRun, get access to the certificate and sign results of the TaskRun.

If the whole point of TEP-0089 is to prevent an unauthorised party changing the results of a TaskRun, that's something that can be controlled already by RBAC. Adding SPIFFE/SPIRE is just as dependent on correct RBAC so I don't see how it significantly improves the situation? Or am I missing something - my knowledge of the internals of Tekton isn't great!

@jimmyjones2 jimmyjones2 added the kind/bug Categorizes issue or PR as related to a bug. label Apr 28, 2023
@jagathprakash
Copy link
Member

Thanks for raising these concerns. There are a few concerns here

  1. Proper RBAC can provide the same level of security as SPIRE. - With proper RBAC, we can prevent any workload from modifying the Tekton resources, which in turn means we can ensure non-falsifiable results. But if an admin wants to change the results, it is still possible. With SPIRE signing we will know if a result has been modified by anybody other than the task.
  2. Admins can get access to SPIRE certificates by exec'ing into the pod - This is a valid concern which can be mitigated by preventing exec into pods. This has been addressed in TEP-0089. RBAC nor SPIRE can prevent falsification of results if execs are permitted.
  3. Ability to modify PVC - If TEP-0089 were extended to sign PVC contents, we could prevent such threats.

Deploying SPIRE the correct way will ensure that results are not falsified by any workload or admin. Proper RBAC alone cannot ensure non-falsifiable provenance.

Non-result artifacts generated by TaskRuns or PipelineRuns can still be falsified by an attacker even after TEP-0089, but there could be a path with SPIRE to prevent it.

@jagathprakash
Copy link
Member

@lumjjb @pxp928

@jimmyjones2
Copy link
Contributor Author

To give a simple example - I've got a namespace where some kind of trusted process creates PipelineRuns on behalf of developers. admins are granted ClusterRole edit and developers view.

In this simple case, SPIRE wouldn't help - I can already adequately prevent developers from modifying TaskRun/PipelineRun CRDs - but still can't prevent admins from falsifying provenance (because they can exec).

Even just adding RBAC allowing developers to create PipelineRuns would allow them to falsify provenance (on OpenShift at least) because they could create an inline TaskSpec using the pipelines SA to exec into pods belonging to other PipelineRuns.

@lumjjb
Copy link
Contributor

lumjjb commented May 8, 2023

protecting against exec is something that is a part of ensuring the non-falsifiable provenance, the hope is to have this control be baked into the kubelet and have these be immutable and verifiable for a deployment of kubernetes. So yes, there is a bit more work to move the needle and this is part of the solution.

Today, without that, there are some deployment models where this can be enforced (e.g. managed kubernetes systems) depending on the threat model.

@tekton-robot
Copy link
Collaborator

Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale with a justification.
Stale issues rot after an additional 30d of inactivity and eventually close.
If this issue is safe to close now please do so with /close with a justification.
If this issue should be exempted, mark the issue as frozen with /lifecycle frozen with a justification.

/lifecycle stale

Send feedback to tektoncd/plumbing.

@tekton-robot tekton-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Aug 6, 2023
@tekton-robot
Copy link
Collaborator

Stale issues rot after 30d of inactivity.
Mark the issue as fresh with /remove-lifecycle rotten with a justification.
Rotten issues close after an additional 30d of inactivity.
If this issue is safe to close now please do so with /close with a justification.
If this issue should be exempted, mark the issue as frozen with /lifecycle frozen with a justification.

/lifecycle rotten

Send feedback to tektoncd/plumbing.

@tekton-robot tekton-robot added lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. and removed lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. labels Sep 5, 2023
@jerop
Copy link
Member

jerop commented Sep 5, 2023

/lifecycle frozen

@tekton-robot tekton-robot added lifecycle/frozen Indicates that an issue or PR should not be auto-closed due to staleness. and removed lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. labels Sep 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug. lifecycle/frozen Indicates that an issue or PR should not be auto-closed due to staleness.
Projects
None yet
Development

No branches or pull requests

5 participants