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

remove interceptor cross namespace secret references; adjust controller permission accordingly #748

Merged

Conversation

gabemontero
Copy link
Contributor

@gabemontero gabemontero commented Sep 8, 2020

Changes

Per recent discussions in the WG, the ability for interceptors to access secrets in other namespaces
appears to be an unintended feature, where we know of no use of it at this time.

Aside from the security implications with the controller accessing secrets from any namespace, eliminating this ability aids the multi-tenant eventlistener migration, as that design scopes the interceptor along with the trigger to within a namespace only.

Submitter Checklist

These are the criteria that every PR should meet, please check them off as you
review them:

See the contribution guide for more details.

Release Notes

BREAKING CHANGE: any interceptors that attempt to reference a Secret outside of the EventListener's namespace will have to change to have those Secrets reside in the EventListener's namespace.

@tekton-robot tekton-robot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. 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 Sep 8, 2020
@tekton-robot tekton-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Sep 8, 2020
@tekton-robot
Copy link

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

File Old Coverage New Coverage Delta
pkg/interceptors/cel/triggers.go 88.3% 88.8% 0.5
pkg/interceptors/interceptors.go 80.0% 82.4% 2.4

@gabemontero gabemontero changed the title WIP: remove interceptor cross namespace secret references; adjust controller permission accordingly remove interceptor cross namespace secret references; adjust controller permission accordingly Sep 8, 2020
@tekton-robot tekton-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. and removed do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. 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 Sep 8, 2020
@tekton-robot
Copy link

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

File Old Coverage New Coverage Delta
pkg/interceptors/cel/triggers.go 88.3% 88.6% 0.3
pkg/interceptors/interceptors.go 80.0% 82.4% 2.4

@gabemontero
Copy link
Contributor Author

OK @dibyom @wlynch @khrm the tests are clean and I have the release note ready.

I did not find any doc references to the SecretRef Namespace field. But double check my greps, etc. with any recollections you all have.

Two questions:

  1. How if any do we want to further surface this for any potential feedback? associated github issue? tekton-dev group notification? triggers slack channel notification? all of the above? none of the above / this PR and the release note when the new release goes out suffices?

  2. who should be assigned the PR?

thanks

@skaegi FYI ... access to secrets is reduced to the pipeline namespace with this PR

@dibyom
Copy link
Member

dibyom commented Sep 15, 2020

How if any do we want to further surface this for any potential feedback? associated github issue? tekton-dev group notification? triggers slack channel notification? all of the above? none of the above / this PR and the release note when the new release goes out suffices?

All of those sound like good ideas. I think a slack message in #general or #triggers and maybe a mail to the tekton-dev group? Maybe we can also point it out in the next Tekton WG meeting.

who should be assigned the PR?

I'm happy to take a look at it.

@gabemontero
Copy link
Contributor Author

How if any do we want to further surface this for any potential feedback? associated github issue? tekton-dev group notification? triggers slack channel notification? all of the above? none of the above / this PR and the release note when the new release goes out suffices?

All of those sound like good ideas. I think a slack message in #general or #triggers and maybe a mail to the tekton-dev group? Maybe we can also point it out in the next Tekton WG meeting.

who should be assigned the PR?

I'm happy to take a look at it.

/assign @dibyom

thanks :-)

@tekton-robot
Copy link

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

File Old Coverage New Coverage Delta
pkg/interceptors/cel/triggers.go 88.3% 88.6% 0.3
pkg/interceptors/interceptors.go 80.0% 82.4% 2.4

@@ -21,7 +21,7 @@ metadata:
app.kubernetes.io/part-of: tekton-triggers
rules:
- apiGroups: [""]
resources: ["configmaps", "secrets", "services", "events"]
Copy link
Member

Choose a reason for hiding this comment

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

🎉

Copy link
Member

Choose a reason for hiding this comment

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

Hmmm, so why does the EL reconciler need access to secrets in the first place 🤔 ? As far as I know, only the EL sink's SA should need access to secrets.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oooh ... interesting @dibyom

I think you are right. Ultimately it is the interceptors called within the sink that are getting the secret token for the git*/bitbucket/etc. verification that we have de-scoped to be local namespace only.

And I see no other use of the k8s secret client.

So that would imply not even creating the new 200-role.yaml and 201-rolebinding.yaml files I have currently in the PR, and instead updating the event listener / sink related yaml under the examples folder, right?

On the plus side, being this much of a newbie path makes me feel young :-)

I'll work on some changes tomorrow / Friday and we'll see how the PR tests fair.

thanks

@tekton-robot tekton-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Sep 17, 2020
@tekton-robot
Copy link

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

File Old Coverage New Coverage Delta
pkg/interceptors/cel/triggers.go 88.3% 88.6% 0.3
pkg/interceptors/interceptors.go 80.0% 82.4% 2.4

@gabemontero
Copy link
Contributor Author

integrations tests still pass, but I'm not sure they run the examples

will look into it Friday and run manually at least if needed

@gabemontero
Copy link
Contributor Author

OK I see the https://github.com/tektoncd/triggers/blob/master/test/e2e-tests-yaml.sh that is analogous to what I've seen in tektoncd/pipelines, but I can't find evidence in the integration-tests run or build-tests run where it is utilized

Does that sound right to your @dibyom ?

In any event, I ran through the instructions at https://github.com/tektoncd/triggers/tree/master/examples manually with this branch deployed and it functioned correctly.

Let me know on about the testing and rest of the code changes @dibyom
Once we are good there, I'll squash the commits and go through the announcement protocol established in #748 (comment)

thanks

@dibyom
Copy link
Member

dibyom commented Sep 18, 2020

Thanks @gabemontero
This looks good to me!
/lgtm

@tekton-robot tekton-robot added the lgtm Indicates that a PR is ready to be merged. label Sep 18, 2020
@gabemontero
Copy link
Contributor Author

How if any do we want to further surface this for any potential feedback? associated github issue? tekton-dev group notification? triggers slack channel notification? all of the above? none of the above / this PR and the release note when the new release goes out suffices?

All of those sound like good ideas. I think a slack message in #general or #triggers and maybe a mail to the tekton-dev group?

Messages have been posted to the two slack channels and the tekton users group.

@dibyom dibyom added this to the Triggers v0.9 milestone Sep 22, 2020
@gabemontero
Copy link
Contributor Author

OK, back from PTO. Looks like I have to rebase this PR, but beforehand, @dibyom - your thoughts on the feedback from the public announcements. If I recall correctly, there was only a minor exchange with you and @afrittoli

I do not think anything concerning stemmed from it, but I'll admit I do not fully recall.

Thoughts gentlemen ?

@dibyom
Copy link
Member

dibyom commented Oct 7, 2020

Hope you had a nice break @gabemontero 🏖️

I've heard any concerning feedback, so I'm ok merging this once it is rebased!

@tekton-robot tekton-robot removed the lgtm Indicates that a PR is ready to be merged. label Oct 7, 2020
@gabemontero
Copy link
Contributor Author

Hope you had a nice break @gabemontero beach_umbrella

thanks @dibyom !

I've heard any concerning feedback, so I'm ok merging this once it is rebased!

rebase pushed

@tekton-robot
Copy link

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

File Old Coverage New Coverage Delta
pkg/interceptors/cel/triggers.go 88.3% 88.6% 0.3
pkg/interceptors/interceptors.go 80.0% 82.4% 2.4

@dibyom
Copy link
Member

dibyom commented Oct 8, 2020

/approve
/lgtm

@tekton-robot tekton-robot added the lgtm Indicates that a PR is ready to be merged. label Oct 8, 2020
@tekton-robot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: dibyom

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

The pull request process is described 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 the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Oct 8, 2020
@tekton-robot tekton-robot merged commit 8eb2067 into tektoncd:master Oct 8, 2020
@gabemontero gabemontero deleted the descope-interceptor-secret branch October 8, 2020 17:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants