oauth: feat: use OIDC claims on user creation#9286
Conversation
program/include/rcmail_oauth.php
Outdated
There was a problem hiding this comment.
Maybe we should validate the values coming from outside?
There was a problem hiding this comment.
Good catch, here what I did:
- ensure config setup only allowed keys (user & host are for example forbidden)
- normalizing user_email & language, then I check validity
I also added tests
There was a problem hiding this comment.
I just changed the language check, the list_languages() was too strict
- // check that language is supported
- $languages = $this->rcmail->list_languages();
- if (!array_key_exists($value, $languages)) {
+ // check that language is at the correct format
+ if (!preg_match('/^[a-z]{2}(\_[A-Z]{2,})?$/', $value)) {
rcube::raise_error([c0ee8cb to
91fb191
Compare
|
@Neustradamus Please, stop adding these references. It's misleading, not everything is related. |
960e77c to
6f11ec7
Compare
program/include/rcmail_oauth.php
Outdated
There was a problem hiding this comment.
That's not going to work with languages like "ast" or "es_419"
There was a problem hiding this comment.
What about this simplification?
// check that language is in the correct format (over simplification of RFC5646)
if (!preg_match('/^[a-z]{2,8}(\_[a-z0-9]{1,8})*$/i', $value)) {
...Which already sanitize data and ensure you are not going to have temptative hacks like $language="../../../password" or similar
What is the requirement on the user's property language
- does it need to be the wished language from the customer? (Permit respective translation to be added lately)
- or does it need to be a truly and currently supported language by roundcube?
If it has to be a supported language, the best option I see is to change rcube->language_prop() from protected to public and use it in this hook
What do you think ?
There was a problem hiding this comment.
In another place we're using /^[a-zA-Z0-9_-]+$/, but I'd add a length limit, lets say 8, and it will be fine.
There was a problem hiding this comment.
done
please note, I saw that rcube->language_prop() is capturing browser's accepted language via
if (preg_match('/^([a-z]+)[_-]([a-z]+)$/i', $lang, $m))I added this: #9292
Signed-off-by: Edouard Vanbelle <edouard@vanbelle.fr>
6f11ec7 to
ad28efa
Compare
Hello please find the user_create hook that uses the OIDC's identify when creating a new user