-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
fix: Override sub with federated_claims.user_id when dex is used #20683
base: master
Are you sure you want to change the base?
Conversation
🔴 Preview Environment stopped on BunnyshellSee: Environment Details | Pipeline Logs Available commands (reply to this comment):
|
3f5b5c7
to
dee232e
Compare
eb08b64
to
e374df5
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #20683 +/- ##
==========================================
+ Coverage 55.19% 55.24% +0.04%
==========================================
Files 337 338 +1
Lines 57058 57192 +134
==========================================
+ Hits 31496 31594 +98
- Misses 22863 22903 +40
+ Partials 2699 2695 -4 ☔ View full report in Codecov by Sentry. |
cmd/argocd/commands/utils/claims.go
Outdated
if federatedClaims, ok := claims["federated_claims"].(map[string]interface{}); ok { | ||
if userID, exists := federatedClaims["user_id"].(string); exists && userID != "" { |
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.
nit: move the values "federated_claims"
, "user_id"
, "sub"
to constants.
test/container/Dockerfile
Outdated
@@ -8,7 +8,7 @@ RUN ln -s /usr/lib/$(uname -m)-linux-gnu /usr/lib/linux-gnu | |||
# Please make sure to also check the contained yarn version and update the references below when upgrading this image's version | |||
FROM docker.io/library/node:22.9.0@sha256:69e667a79aa41ec0db50bc452a60e705ca16f35285eaf037ebe627a65a5cdf52 as node | |||
|
|||
FROM docker.io/library/golang:1.23.3@sha256:d56c3e08fe5b27729ee3834854ae8f7015af48fd651cd25d1e3bcf3c19830174 as golang | |||
FROM docker.io/library/golang:1.23.1@sha256:4f063a24d429510e512cc730c3330292ff49f3ade3ae79bda8f84a24fa25ecb0 as golang |
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.
Is this downgrade on purpose or the PR just needs a rebase?
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.
Yes did it on purpose when testing virtually, I forgot to revert.
4cf2359
to
d131b41
Compare
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.
Overall code change looks good!!
@jannfis @pasha-codefresh do you see any concerns with the change?
4e8b021
to
1393382
Compare
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.
The change from RegisterClaims to MapClaims makes this PR a lot more impactful and the blast radius is hard to grasp, especially that not the same claims seems to be added in the context object.
util/session/sessionmanager.go
Outdated
// Assert that claims is of type jwt.MapClaims | ||
mapClaims, ok := claims.(jwt.MapClaims) | ||
if !ok { | ||
http.Error(w, "Invalid claims type", http.StatusUnauthorized) | ||
return | ||
} |
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 don't think we should use MapClaims. See the comment on the RegisterClaims object
// RegisteredClaims are a structured version of the JWT Claims Set,
// restricted to Registered Claim Names, as referenced at
// https://datatracker.ietf.org/doc/html/rfc7519#section-4.1
//
// This type can be used on its own, but then additional private and
// public claims embedded in the JWT will not be parsed. The typical usecase
// therefore is to embedded this in a user-defined claim type.
basically, define a new struct
type ArgoClaims struct {
RegisteredClaims
OtherClaim string `json:"othet,omitempty"`
...
68b2da0
to
df53a24
Compare
16f3368
to
4a7e597
Compare
c6f8115
to
eff4007
Compare
Signed-off-by: Atif Ali <[email protected]>
Signed-off-by: Atif Ali <[email protected]>
Signed-off-by: Atif Ali <[email protected]>
Signed-off-by: Atif Ali <[email protected]>
Signed-off-by: Atif Ali <[email protected]>
Signed-off-by: Atif Ali <[email protected]>
Signed-off-by: Atif Ali <[email protected]>
Signed-off-by: Atif Ali <[email protected]>
Signed-off-by: Atif Ali <[email protected]>
Signed-off-by: Atif Ali <[email protected]>
Signed-off-by: Atif Ali <[email protected]>
Signed-off-by: Atif Ali <[email protected]>
Signed-off-by: Atif Ali <[email protected]>
Signed-off-by: Atif Ali <[email protected]>
Signed-off-by: Atif Ali <[email protected]>
Signed-off-by: Atif Ali <[email protected]>
Signed-off-by: Atif Ali <[email protected]>
Fixes: #17908
Checklist: