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

Store and validate TaskRun/Run UIDs in pipeline task embedded status #7833

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

vdemeester
Copy link
Member

@vdemeester vdemeester commented Apr 4, 2024

Changes

See GHSA-w2h3-vvvq-3m53

This will ensure that scenarios like described in the linked advisory
cannot occur - we'll read the TaskRun/Run UID when we initially
add it to the embedded status, and if we ever encounter a
TaskRun/Run with the same name but a different UID in the future,
we'll throw an error.

Signed-off-by: Vincent Demeester [email protected]

/cc @abayer @wlynch @tektoncd/core-maintainers

/kind bug
/area security

Submitter Checklist

As the author of this PR, please check off the items in this checklist:

  • Has Docs if any changes are user facing, including updates to minimum requirements e.g. Kubernetes version bumps
  • Has Tests included if any functionality added or changed
  • pre-commit Passed
  • Follows the commit message standard
  • Meets the Tekton contributor standards (including functionality, content, code)
  • Has a kind label. You can add one by adding a comment on this PR that contains /kind <type>. Valid types are bug, cleanup, design, documentation, feature, flake, misc, question, tep
  • Release notes block below has been updated with any user facing changes (API changes, bug fixes, changes requiring upgrade notices or deprecation warnings). See some examples of good release notes.
  • Release notes contains the string "action required" if the change requires additional action from users switching to the new release

Release Notes

Fix CVE-2023-37264: the controller now validates `TaskRun` and `CustomRun` UID to make sure we only accept `TaskRun`s and `Run`s that have the matching UID.

@tekton-robot tekton-robot added the do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. label Apr 4, 2024
@tekton-robot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
To complete the pull request process, please ask for approval from vdemeester after the PR has been reviewed.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@tekton-robot tekton-robot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. release-note Denotes a PR that will be considered when it comes time to generate release notes. and removed do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. labels Apr 4, 2024
@vdemeester vdemeester added kind/bug Categorizes issue or PR as related to a bug. kind/security Categorizes issue or PR as related to a security issue labels Apr 4, 2024
@tekton-robot
Copy link
Collaborator

The following is the coverage report on the affected files.
Say /test pull-tekton-pipeline-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/apis/pipeline/v1beta1/pipelinerun_conversion.go 95.7% 95.8% 0.0
pkg/reconciler/pipelinerun/pipelinerun.go 91.8% 91.8% 0.1
pkg/reconciler/pipelinerun/resources/pipelinerunresolution.go 96.7% 96.1% -0.6

@tekton-robot
Copy link
Collaborator

The following is the coverage report on the affected files.
Say /test pull-tekton-pipeline-go-coverage-df to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/apis/pipeline/v1beta1/pipelinerun_conversion.go 95.7% 95.8% 0.0
pkg/reconciler/pipelinerun/pipelinerun.go 91.8% 91.8% 0.1
pkg/reconciler/pipelinerun/resources/pipelinerunresolution.go 96.7% 96.1% -0.6

See GHSA-w2h3-vvvq-3m53

This will ensure that scenarios like described in the linked advisory
cannot occur - we'll read the `TaskRun`/`Run` UID when we initially
add it to the embedded status, and if we ever encounter a
`TaskRun`/`Run` with the same name but a different UID in the future,
we'll throw an error.

Signed-off-by: Vincent Demeester <[email protected]>
@tekton-robot
Copy link
Collaborator

The following is the coverage report on the affected files.
Say /test pull-tekton-pipeline-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/apis/pipeline/v1beta1/pipelinerun_conversion.go 95.7% 95.8% 0.0
pkg/reconciler/pipelinerun/pipelinerun.go 91.8% 91.8% 0.1
pkg/reconciler/pipelinerun/resources/pipelinerunresolution.go 96.7% 96.1% -0.6

@tekton-robot
Copy link
Collaborator

The following is the coverage report on the affected files.
Say /test pull-tekton-pipeline-go-coverage-df to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/apis/pipeline/v1beta1/pipelinerun_conversion.go 95.7% 95.8% 0.0
pkg/reconciler/pipelinerun/pipelinerun.go 91.8% 91.8% 0.1
pkg/reconciler/pipelinerun/resources/pipelinerunresolution.go 96.7% 96.1% -0.6

@vdemeester vdemeester removed the kind/bug Categorizes issue or PR as related to a bug. label Apr 4, 2024
@piyush-garg
Copy link
Contributor

lgtm

Copy link
Member

@afrittoli afrittoli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @vdemeester for looking into this.
If someone can create a TaskRun in the cluster, they are likely able to edit the PipelineRun status as well and inject the TaskRun there.

This helps but we will have to let the Tekton controller sign *Run resources everytime there is an update to ensure that there was no tampering. If I'm not mistaken, we have the Spiffe/Spire integration almost finished to provide that capabilities.

@vdemeester
Copy link
Member Author

If I'm not mistaken, we have the Spiffe/Spire integration almost finished to provide that capabilities.

Yes, but it's not going to be enabled by default.

@tekton-robot
Copy link
Collaborator

@vdemeester: PR needs rebase.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@tekton-robot tekton-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label May 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/security Categorizes issue or PR as related to a security issue needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants