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

Feature: Add impersonation to tekton results API #373

Merged
merged 1 commit into from
Mar 30, 2023

Conversation

sayan-biswas
Copy link
Contributor

@sayan-biswas sayan-biswas commented Feb 28, 2023

Changes

Resolves #309

This feature adds Kubernetes impersonation header processing, impersonation access check for requester and RBAC for tekton results resources with impersonated user data.

https://kubernetes.io/docs/reference/access-authn-authz/authentication/#user-impersonation

Submitter Checklist

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

  • Has Docs included if any changes are user facing
  • Has Tests included if any functionality added or changed
  • Tested your changes locally (if this is a code change)
  • Follows the commit message standard
  • Meets the Tekton contributor standards (including functionality, content, code)
  • Has a kind label. You can add 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)
  • Release notes contain the string "action required" if the change requires additional action from users switching to the new release

Release Notes

Kubernetes impersonation headers can be used when authorizing access to Tekton Results APis.

ACTION REQUIRED: The NO_AUTH config parameter was renamed to AUTH_DISABLE

@tekton-robot
Copy link

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@tekton-robot tekton-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. labels Feb 28, 2023
@tekton-robot tekton-robot added the size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. label Feb 28, 2023
@sayan-biswas
Copy link
Contributor Author

/kind feature

@tekton-robot tekton-robot added the kind/feature Categorizes issue or PR as related to a new feature. label Feb 28, 2023
@sayan-biswas sayan-biswas changed the title Feature: Impersonation Feature: Add impersonation to tekton results API Feb 28, 2023
@sayan-biswas
Copy link
Contributor Author

/test all

@tekton-robot tekton-robot added size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. and removed size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Mar 1, 2023
@sayan-biswas sayan-biswas marked this pull request as ready for review March 1, 2023 10:10
@tekton-robot tekton-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Mar 1, 2023
@sayan-biswas
Copy link
Contributor Author

/test pull-tekton-results-integration-tests

@sayan-biswas
Copy link
Contributor Author

/assign @adambkaplan

Copy link
Contributor

@adambkaplan adambkaplan left a comment

Choose a reason for hiding this comment

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

/approve

Marking this as an approved feature to add. In the current form, however, we need to ensure that e2e tests work with this feature enabled. @dibyom do other projects have a mechanism to test features e2e where the feature flag is enabled and disabled?

pkg/api/server/v1alpha2/auth/rbac.go Outdated Show resolved Hide resolved
pkg/api/server/v1alpha2/auth/rbac.go Outdated Show resolved Hide resolved
pkg/api/server/v1alpha2/auth/rbac.go Outdated Show resolved Hide resolved
pkg/api/server/v1alpha2/auth/rbac.go Outdated Show resolved Hide resolved
config/base/env/config Show resolved Hide resolved
config/base/env/config Outdated Show resolved Hide resolved
cmd/api/main.go Outdated Show resolved Hide resolved
@tekton-robot tekton-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Mar 2, 2023
@tekton-robot tekton-robot added release-note-action-required Denotes a PR that introduces potentially breaking changes that require user action. and removed release-note Denotes a PR that will be considered when it comes time to generate release notes. labels Mar 14, 2023
Copy link
Contributor

@adambkaplan adambkaplan left a comment

Choose a reason for hiding this comment

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

Almost there! Code looks good, I added a suggestion to add a code comment.

Can you also please add a section to the Authorization doc that indicates we support Kubernetes impersonation headers [1]? You don't need to explain what user impersonation is - a link to the Kubernetes doc [2] is sufficient. Just focus on how to enable the feature and how Results clients (gRPC, REST) can use it.

[1] https://github.com/tektoncd/results/tree/main/docs/api#authenticationauthorization
[2] https://kubernetes.io/docs/reference/access-authn-authz/authentication/#user-impersonation

config/base/env/config Show resolved Hide resolved
pkg/api/server/v1alpha2/auth/rbac.go Show resolved Hide resolved
@adambkaplan
Copy link
Contributor

/assign @dibyom @alan-ghelardi

There is a breaking configuration change here.

@khrm
Copy link
Contributor

khrm commented Mar 16, 2023

Shouldn't we introduce a deprecation notice instead of directly breaking it? We can remove the NO_AUTH in the next release with the ACTION required notice. In this release, we can have a deprecation notice.

@dibyom
Copy link
Member

dibyom commented Mar 16, 2023

Shouldn't we introduce a deprecation notice instead of directly breaking it? We can remove the NO_AUTH in the next release with the ACTION required notice. In this release, we can have a deprecation notice.

Technically, we are allowed to make breaking changes in alpha apis. Though generally what we have done in other projects is what @khrm is suggesting here

config/base/env/config Show resolved Hide resolved
@tekton-robot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: adambkaplan, 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

@sayan-biswas
Copy link
Contributor Author

Shouldn't we introduce a deprecation notice instead of directly breaking it? We can remove the NO_AUTH in the next release with the ACTION required notice. In this release, we can have a deprecation notice.

Agreed! But this flag is mostly for development, to bypass the RBAC processing.
Even if this flag is missing from the config, the parses will assume the value as false and continue. Which is the default behaviour anyways.
Also the release will ship the config file which will anyways have the modified parameter.

@sayan-biswas
Copy link
Contributor Author

Almost there! Code looks good, I added a suggestion to add a code comment.

Can you also please add a section to the Authorization doc that indicates we support Kubernetes impersonation headers [1]? You don't need to explain what user impersonation is - a link to the Kubernetes doc [2] is sufficient. Just focus on how to enable the feature and how Results clients (gRPC, REST) can use it.

[1] https://github.com/tektoncd/results/tree/main/docs/api#authenticationauthorization [2] https://kubernetes.io/docs/reference/access-authn-authz/authentication/#user-impersonation

Added code comment and updated doc.

@tekton-robot tekton-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Mar 21, 2023
@tekton-robot tekton-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Mar 22, 2023
This feature adds Kubernetes impersonation header processing, impersonation access check for requester and RBAC for tekton results resources with impersonated user data.
@adambkaplan
Copy link
Contributor

@alan-ghelardi just want to check with you that renaming the NO_AUTH config setting to AUTH_DISABLE is acceptable (since this feature was your contribution).

Otherwise LGTM.

@adambkaplan
Copy link
Contributor

/lgtm

by lazy consensus.

@tekton-robot tekton-robot added the lgtm Indicates that a PR is ready to be merged. label Mar 30, 2023
@tekton-robot tekton-robot merged commit 3ae05ce into tektoncd:main Mar 30, 2023
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. kind/feature Categorizes issue or PR as related to a new feature. lgtm Indicates that a PR is ready to be merged. release-note-action-required Denotes a PR that introduces potentially breaking changes that require user action. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

User Impersonation for RBAC
6 participants