-
Notifications
You must be signed in to change notification settings - Fork 6.4k
chore: update azure/kubelogin to address CVE #20578
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
Conversation
❌ Preview Environment deleted from BunnyshellAvailable commands (reply to this comment):
|
|
@imjasonh the unit test failure is a real one, which I can consistently reproduce. What worked for me was reverting some of the unrelated changes (we would still need to find the actual reason for the failure). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added some changes to go.mod
which makes the failing test pass (basically anything that's not directly related to kubelogin
is reverted to its prior state for now), you'll then need to run go mod tidy
afterwards.
Thanks @blakepettersson, I've updated the deps and ran |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #20578 +/- ##
==========================================
+ Coverage 55.10% 55.18% +0.08%
==========================================
Files 324 324
Lines 55239 55259 +20
==========================================
+ Hits 30439 30495 +56
+ Misses 22180 22145 -35
+ Partials 2620 2619 -1 ☔ View full report in Codecov by Sentry. |
Before this change (3625689):
After this change (11ce485):
|
@imjasonh I'm no Azure expert - how has this been verified that this still works? |
I haven't verified anything at all. I'm just basing this on the previous PR from the feature's author to get the dep updated. If you have any simple instructions to test this, or an end-to-end test that I could run, I'd be happy to give it a shot. |
@bcho is the previous PR's author, 11 months ago |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Sadly I do not know of any. I guess given that @bcho is one of the actual authors of kubelogin and works for Azure Cloud that it gives some reassurance that this should work. I'd pass your question along to bcho. |
Signed-off-by: Jason Hall <jason@chainguard.dev>
Signed-off-by: Jason Hall <jason@chainguard.dev>
Signed-off-by: Jason Hall <jason@chainguard.dev>
Rebased and updated |
Signed-off-by: Jason Hall <jason@chainguard.dev>
Hi, thanks for the tag and the fix! - i am the contributor of kubelogin. I will try verify the change with an AKS cluster w/ entra id auth enabled tomorrow and report back here. |
o.UpdateFromEnv() | ||
o := token.OptionsWithEnv() | ||
// we'll use default of WorkloadIdentityLogin for the login flow | ||
o.LoginMethod = token.WorkloadIdentityLogin |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This backfill breaks the behavior. The previous code is to set the default value for LoginMethod to "WorkloadIdentityLogin", then override with environment variable when "AAD_LOGIN_METHOD" is set. But the new implementation here is to force the LoginMethod to use only WorkloadIdentity.
I think a proper way to do that is like this:
o := token.OptionsWithEnv()
if o.LoginMethod == "" { // no environment variable overrides
// we'll use default of WorkloadIdentityLogin for the login flow
o.LoginMethod = token.WorkloadIdentityLogin
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! I've applied this suggestion, please take a look.
I have verified above code from a test env against an AAD + workload identity enabled AKS cluster. It worked after applying above changes for updating the backfill behavior for both devicelogin / msi / workload identity login method. |
Signed-off-by: Jason Hall <jason@chainguard.dev>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your review, @bcho! LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Thanks @blakepettersson and @bcho! It looks like this still needs approval from an owner with write access. To avoid needing to keep this up to date (as |
Since it's only medium severity, I don't plan to backport the fix. It'll go out with 2.14. Thanks all! |
* update azure/kubelogin to address CVE Signed-off-by: Jason Hall <jason@chainguard.dev> * actually emit token Signed-off-by: Jason Hall <jason@chainguard.dev> * update deps, go mod tidy Signed-off-by: Jason Hall <jason@chainguard.dev> * fix go.sum Signed-off-by: Jason Hall <jason@chainguard.dev> * bcho's suggestion Signed-off-by: Jason Hall <jason@chainguard.dev> --------- Signed-off-by: Jason Hall <jason@chainguard.dev> Signed-off-by: Adrian Aneci <aneci@adobe.com>
This PR attempts to update the project's dependency on
github.com/Azure/kubelogin
to the most recent version, which allows the project to update its dependency ongithub.com/Azure/azure-sdk-for-go/sdk/azidentity
to a version that addresses a medium-severity CVE: GHSA-m5vv-6r4h-3vj9I don't know whether this project is actually susceptible to this vulnerability, but it gets flagged for users of this project, and in general depending on very old releases of packages is not recommended -- this updates
kubelogin
from v0.0.20 (Aug 2022) to v0.1.4 (July this year)The API has changed in breaking ways in the intervening ~2 years, and I assume this is part of the reason this old dependency has stuck around.
This is in part an update to #16661 -- I'm not sure if that PR should just be updated or if that's in some permanently stuck state.
Checklist: