-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Why does Dex base64 encode "sub" claims? #1719
Comments
Just a side note: it's not just plain string concatenation. It's base64-encoded binary protobuf message
I'm not sure what's behind this design decision, but I believe it is related to the need to uniquely distinguish the same user IDs belonging to different connectors. |
Thank you for the clarification: I had not considered that protobuf tags might be present (as unprintable characters).
This seems to assume that protobuf encoding is stable, but I think that's implementation-dependent. Here it says:
Clearly it would be problematic if the "sub" of a user were to flip between two encoded values. |
It is a coincidence that the sub claim contains the id of the connector. The right way to get the connector id, as you have mentioned, is to request the I am going to close the issue. Feel free to open a new one if you still have questions. |
Just to clarify: If I'm building an application that uses dex to login users via OpenID Connect, is it wrong to use I used the |
It is ok to use this claim value as a uniq identifier for a user. You can rely on it. |
Hi all, Would it be possible to have an option to disable this feature? One of them includes "sub" (https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_iam-condition-keys.html#condition-keys-wif) But it's impossible to use it when the value is encoded in the obscure protobuf binary |
relates to #2339 |
When using Dex with the example-app, the displayed "sub" claim is base64-encoded.
"sub": "Cg0wLTM4NS0yODA4OS0wEgRtb2Nr"
This decodes to
0-385-28089-0mock
which is the UserID from connector/mock/connectortest.go plus "mock""sub": "CiQwOGE4Njg0Yi1kYjg4LTRiNzMtOTBhOS0zY2QxNjYxZjU0NjYSBWxvY2Fs"
This decodes to
$08a8684b-db88-4b73-90a9-3cd1661f5466local
which is UserID from examples/config-dev.yaml plus "local"This is invalid base64: the trailing
==
from base64 encoding has been stripped, and if I add it back I get "google"However before I investigate the stripping of
==
further, I just wonder what is the reason for base64-encoding thesub
claim in the first place? Surely if this comes from an IDP's JWT, it must already be valid JSON and hence valid unicode?EDIT: is it to discourage people from using
sub
directly, and instead to requestfederated:id
, which gives the cleartext components?The text was updated successfully, but these errors were encountered: