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

Add DisableAnonymous to DelegatingAuthenticationOptions #112181

Merged
merged 1 commit into from Sep 6, 2022

Conversation

xueqzhan
Copy link
Contributor

@xueqzhan xueqzhan commented Sep 1, 2022

What type of PR is this?

/kind bug

What this PR does / why we need it:

This PR adds DisableAnonymous to DelegatingAuthenticationOptions. Currently, a user of DelegatingAuthenticationOptions has no option to disable Anonymous authentication. This has affected backward compatibility of some components seeking to migrate to the new apiserver functionality. kube-rbac-proxy is such an example.

Which issue(s) this PR fixes:

Fixes #

Special notes for your reviewer:

Does this PR introduce a user-facing change?

callers using DelegatingAuthenticationOptions can use DisableAnonymous to disable Anonymous authentication.

Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.:


@k8s-ci-robot k8s-ci-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. kind/bug Categorizes issue or PR as related to a bug. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. do-not-merge/needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Sep 1, 2022
@k8s-ci-robot
Copy link
Contributor

Hi @xueqzhan. Thanks for your PR.

I'm waiting for a kubernetes member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

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.

@k8s-ci-robot k8s-ci-robot added the needs-priority Indicates a PR lacks a `priority/foo` label and requires one. label Sep 1, 2022
@k8s-ci-robot k8s-ci-robot added area/apiserver sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. and removed do-not-merge/needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. labels Sep 1, 2022
@leilajal
Copy link
Contributor

leilajal commented Sep 1, 2022

/sig auth
/assign @roycaihw
/triage accepted

@k8s-ci-robot k8s-ci-robot added sig/auth Categorizes an issue or PR as relevant to SIG Auth. triage/accepted Indicates an issue or PR is ready to be actively worked on. and removed needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels Sep 1, 2022
@@ -202,6 +202,9 @@ type DelegatingAuthenticationOptions struct {

// CustomRoundTripperFn allows for specifying a middleware function for custom HTTP behaviour for the authentication webhook client.
CustomRoundTripperFn transport.WrapperFunc

// DisableAnonymous gives user an option to disable Anonymous authentication.
DisableAnonymous bool
Copy link
Contributor

Choose a reason for hiding this comment

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

In this case, I think this negative phrasing is correct because it means that the zero-value of false does the same thing the struct used to do.

@deads2k
Copy link
Contributor

deads2k commented Sep 1, 2022

A few notable things about this PR

  1. it comes from an actual requirement for kube-rbac-proxy which is trying to move to "normal" kube constructs
  2. in cases where an authentication stack used to disallow unauthenticated users, any authorization rule that was "allow all" used to be "safe" and would become unsafe in a migration.
  3. the polarity of this field makes it safe for other struct users to continue constructing the struct and getting the behavior they expect
  4. the impl here does not bind the flag, because by default we want anonymous as a valid user

/lgtm
/hold

holding for a few days for comment.

@k8s-ci-robot k8s-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Sep 1, 2022
@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Sep 1, 2022
@enj
Copy link
Member

enj commented Sep 1, 2022

@deads2k not sure I follow what you mean on:

the impl here does not bind the flag, because by default we want anonymous as a valid user

Wouldn't we want it bound to some flag so allow this to be configured?

Regardless of the question above this LGTM.

/ok-to-test

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Sep 1, 2022
@deads2k
Copy link
Contributor

deads2k commented Sep 2, 2022

Wouldn't we want it bound to some flag so allow this to be configured?

By making the struct field public, the consuming code can set whatever default it likes and bind to whatever flag it prefers. All of our existing consumers are ok without being able to disallow anonymous. That makes kube-rbac-proxy look like a one-off. I'd prefer to make their use-case possible without adding unnecessary options for the majority. If enough callers want a standard flag, I'm open to adding it.

/approve

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: deads2k, xueqzhan

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

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Sep 2, 2022
@xueqzhan
Copy link
Contributor Author

xueqzhan commented Sep 6, 2022

/retest-required

@deads2k
Copy link
Contributor

deads2k commented Sep 6, 2022

/hold cancel

@k8s-ci-robot k8s-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Sep 6, 2022
@k8s-ci-robot k8s-ci-robot merged commit 23790ec into kubernetes:master Sep 6, 2022
@k8s-ci-robot k8s-ci-robot added this to the v1.26 milestone Sep 6, 2022
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. area/apiserver cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/bug Categorizes issue or PR as related to a bug. lgtm "Looks good to me", indicates that a PR is ready to be merged. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. release-note Denotes a PR that will be considered when it comes time to generate release notes. sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. sig/auth Categorizes an issue or PR as relevant to SIG Auth. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. triage/accepted Indicates an issue or PR is ready to be actively worked on.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants