rauthy: Upstream OIDC with LastLogin doesn't work for some IDs
Configuring upstream OIDC was very straight-forward. However, I noticed that one of my email addresses didn’t work, resulting in
Uncovered HTTP return status '400'. This should never happen, please report this bug.
The email address contains a “&” character, which is valid in email addresses. My best guess is the validator didn’t like that.
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 1
- Comments: 19 (11 by maintainers)
I am not sure, if this is correct. Usually you would never notice this, because all
Stringconversions in all languages automatically convert such things. I only stumbled about this, because I did not do this on purpose to get rid of unnecessary memory allocations. Since this does not do anything with the data and therefore no automatic conversions under the hood, it created this error.When I take a quick look at the RFC 7519 for JWT Tokens, in 7.1 Creating a JWT I find this:
Rust Strings are UTF8 always, so this side should be correct. If the
\u0026in this case is allowed, I am just not sure. Also, even though it works with other clients / IdPs, it does not necessarily mean, that this is correct. If I would use the easy way and just deserialized into ownedStrings, I would never get into that situation. Even when I import your example token above into the Rust code and use defaultStrings, I don’t get any errors. Only when I use types that do not do any auto-conversion, I notice the problem.So, I really don’t know for sure. From reading the RFC, I would assume that it’s not correct, but I might be wrong on this. I just leave the fix implemented. Luckliy it is not the end of the World. I am using
Cow<'a, str>now, which is a thin wrapper around the data and only creates an ownedStringif necessary.Edit:
The current behavior is actually correct it seems. In 7.3 String Comparison Rules I found that String comparison inside a JWT must be done with the UNICODE format. Again, happens automatically, if I just convert into known Strings. The good thing is, this only needs to happen now if the Strings include special characters.
This was a hard to find bug. Thanks a lot!
v0.23.3should show the detailed error message now, if you get into that situation again.It simply shows the JSON deserialized error from the backend as is in the UI, which should help debugging.
The
&in email validation is accepted like it should, the reason must be something else. Please check the logs from Rauthy to get more information. You may setLOG_LEVEL=debugto get detailed logging for the auth provider callback.Edit:
I will update the error message in the UI to show the real error directly, because this is not necessarily a bug with Rauthy, the problem can come from the upstream provider as well in a few places. You can grab the full error response from the network tab during the callback. It is just not deserialized into a message which will show up in the UI at the moment.