Skip to content

bug: allow ignoring OIDC email_verified claim #5065

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

Closed
johnstcn opened this issue Nov 14, 2022 · 5 comments · Fixed by #5165
Closed

bug: allow ignoring OIDC email_verified claim #5065

johnstcn opened this issue Nov 14, 2022 · 5 comments · Fixed by #5165
Assignees

Comments

@johnstcn
Copy link
Member

johnstcn commented Nov 14, 2022

Problem

(Context: see #3954)

Coder will check for the email_verified OIDC claim if it is provided, and block sign-in if the user's email is not verified.
Users with unverified emails atttempting to login will get a message similar to

{"message":"Verify the \"user@acme.corp\" email address on your OIDC provider to authenticate!"}

From the Auth0 docs:

https://auth0.com/docs/manage-users/user-accounts/user-profiles/verified-email-usage

In case of federated identity providers, they sometimes report if the user has a verified email, and based on that, Auth0 sets the email_verified field in the user profile. This, however, transfers the responsibility to the identity provider to do it properly - something we can't ensure. We also don't know if the verified email from that provider is still owned by the user.

When users authenticate with a federated identity provider (e.g. a social or enterprise connection), the value of the email_verified field will match what the identity provider returns in the user profile. If they identity provider does not return any value, it will be set to false.

This means that certain IdPs through Auth0 (for example, AzureAD) are essentially unusable with Coder currently -- if the IdP does not return the email_verified claim, Auth0 will default it to false and Coder will block sign-in.

Solution

Add a command-line flag / environment variable CODER_OIDC_IGNORE_EMAIL_VERIFIED.
This will default to false. If it is set to true, skip the code path to check the email_verified claim:

https://github.com/coder/coder/blob/4b3d211e004ec5e4a3b30f98ca3c3e8ec687168a/coderd/userauth.go#L251-260

This will essentially assume that all emails are verified.

@johnstcn johnstcn changed the title feat: allow ignoring OIDC email_verified claim bug: allow ignoring OIDC email_verified claim Nov 14, 2022
@johnstcn johnstcn added the bug label Nov 14, 2022
@johnstcn johnstcn assigned johnstcn and unassigned johnstcn Nov 14, 2022
@wanghongda-0624
Copy link

i set CODER_OIDC_IGNORE_EMAIL_VERIFIED as true, but it still shows the same error

@dcarrion87
Copy link
Contributor

dcarrion87 commented Nov 24, 2022

@johnstcn is this going to be a breaking change for us as this gets implemented.

We're relying on that bypass that @kylecarbs implemented at the moment so people can get in using AzureAD integration.

I.e. Should I be setting not yet implemented CODER_OIDC_IGNORE_EMAIL_VERIFIED in anticipation?

@johnstcn
Copy link
Member Author

@johnstcn is this going to be a breaking change for us as this gets implemented.

We're relying on that bypass that @kylecarbs implemented at the moment so people can get in using AzureAD integration.

I.e. Should I be setting not yet implemented CODER_OIDC_IGNORE_EMAIL_VERIFIED in anticipation?

In your use-case, the email_verified claim returned by AzureAD is not present -- correct?
This use case is primarily designed for cases where the claim is present but the operator wishes to manually override that.
The behaviour will default to the current implementation (only check email_verified if it is present) unless this is explicitly set. If enabled, the behaviour will essentially become "never check email_verified at all".

Does that sound reasonable to you?

@dcarrion87
Copy link
Contributor

@johnstcn ah yes sorry I was having a moment. You're right it wasn't coming through at all that was our issue.

@johnstcn johnstcn self-assigned this Nov 24, 2022
@johnstcn
Copy link
Member Author

i set CODER_OIDC_IGNORE_EMAIL_VERIFIED as true, but it still shows the same error

@wanghongda-0624 It hasn't been implemented yet :-) Working on it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants