-
-
Notifications
You must be signed in to change notification settings - Fork 65
Add custom email mapping support #972
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
base: main
Are you sure you want to change the base?
Conversation
|
Hey @sebadob, what do you think about the UI I added for Also I faced an issue: When serializing I chose to use This is not that bad but the real issue is that I did not get any warning / error on backend logs when that happened. |
|
After a bit of digging, I think the issue lies in hiqlite: https://github.com/sebadob/hiqlite/blob/main/hiqlite/src/query/mod.rs#L168 |
Very limited on time today, can take a look tomorrow.
I would probably tell But, I already added the Edit: Btw regarding the |
No rush ahah, you're already more responsive than 95% of open source maintainers 😄
I'll fix on serde side then, no problem!
Concerning the rocksdb, of course I was planning to remove the commit when the PR is ready, should have mentioned that 😄 I'll use |
305442b to
4fffec1
Compare
That's what I had in mind. Just a selector with pre-defined types. Instead of having the button there, the default could maybe just be And in case of |
b1da6dc to
aef0764
Compare
|
I just merged a very huge PR (#991) and you luckliy have no conflict yet, but you should probably pull the changes to make sure you don't get into trouble when doing templates. Also, I tested a lot, and it seems fine to me so far, but if you have any configuration issues, please let me know. I cleaned up the whole config situation which spiraled a bit ouf of control and got messy, and I ended up having some static vars here and there all over the place. Now it's very clean, but almost 12k lines changed. |
aef0764 to
e9935a3
Compare
|
Hi @sebadob, I got something working and basic UI setup, I'd be glad if you could take a look and tell me if my implementation is to your liking 🙂 Things I still need to do:
What's the best way to do the checks on the backend? How do we ensure that an attr is not modified if it is used in a Do you see anything else? |
| ALTER TABLE clients | ||
| ADD cust_email_mapping TEXT | ||
| REFERENCES user_attr_config | ||
| ON UPDATE ON DELETE CASCADE; No newline at end of file |
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.
You probably need to bump the index on these files by 1 because of the recently added login_locations migrations. Also, a newline at the end would be nice. Not because it would be necessary in this case, but it often is and I am used to always add one, no matter in which context.
Actually, yes. We should think about a confirmation on the user side if an additional E-Mail is being added, very much like the flow when a user changes the primary email via account dashboard. Notifications are sent to both the old and new addresses, and the user needs to confirm that change, before it's being finally executed. Most of the logic can be re-used. Probably even the E-Mail templates, but with slightly adjusted text. Something like The E-Mail address alfread@batcave.io is being added as a secondary E-Mail for the Rauthy account batman@batcace.io. To accept this, please click the link below. Clicking the magic link then should make the change final. This E-Mail should be sent to the new address, that should be added. In addition, a notification about this, but without the link, should probably be sent to the current primary address. I had some more thoughts about this and if we allow an admin to do this change without any confirmation, it would be pretty easy for a malicious admin to take over complete accounts even without the knowledge of the user. For instance, you could add another users address as your own secondary and login to Google Workspace in this case, and you could impersonate the other one quietly. The bare minimum that should be done is sending out a notification about the change to both addresses. However, triggering the flow in the same way as an email change is being executed right now is not that big of an overhead. The magic link creation to finally execute this should be possible without any other database modifications. Edit: It could be, that I have some spare time to help with this email template thingy in the next days, so that you only need to trigger it. I will let you know. |
|
For your second point about a "malicious admin", is that really a concern we can address, to me if the admin is malicious he will be able to impersonate any one he wants. Actually in other SSO solutions (eg. Authentik), there's an impersonate button to exactly do that in the admin UI! |
That's not the case for Rauthy. In fact, that is one of the reasons why impersonate does not exist on purpose, like it does in Authentik for instance. I thought about something like "token inspection" to be able to see how a token would look like for a specific client with the current configuration, but even in that case, I would never issue an actually valid token. If you run Rauthy, you could only do harm to users sub-accounts if you are also It should at least not be easy to do this, even as an admin. User impersonation is something that Enterprises may want on certain platforms for good reason, but doing that on the IdP allows so much access, even without the user knowing about it. But yeah that could be a 2nd step at least, to add more safeguards. |
e9935a3 to
b46c818
Compare
|
Got it, makes sense! Quick question, what is the better approach to do the validation that a |
That is not too straight forward. It has to be checked in multiple places and show a nice error message to the user, if this is the case. I would of course check it for Having additional DB columns is a bit more work on the client side, but makes everything a lot clearer in the UI. Not sure how you would do all of that with a DB constraint, but if you have a solution that works, sure why not. |
|
Pinning the type of the attrs seems like a good idea, that's one less way for the users to break stuff! The idea of the locked seems good, but making it a column is a little strange to me as the information can be derived with a join on the clients table by simply checking that the attribute is used as a custom mapping. With a DB constraint, or maybe a trigger, you can make constraint on a column based on a custom querry, this would allow the DB to stay consistant by itself, raising an error if an attempt at a bad modification is done. This would avoid having to do the checks everywhere a modification is done to either clients or attrs. Haven't done that in a while though but maybe worth exploring. I tough the prettiness of the backend error would not be too big of a concern since on the client side we won't allow to do the invalid request anyway, so a DB error didn't seem too bad. |
We don't need this information in the auth chain and since it's only necessary when modifying via Admin UI or updating, that's fine as well, sure.
Even though this will probably not be an issue with Rauthy, I really don't like triggers and custom functions on the DB, because it requires more resources and time being spent in a place that is usually the bottleneck when you need to scale. Btw all of this is also the reason why the roles, groups and scopes are handled against everything you "learn in school" about DB normalization and stuff. These values are rarely updated and if I can pre-compute stuff and therefore have less stress on the DB in the hot path, I always do it, even if it means a bit more manual maintenance.
Easily solved as well, when you |
Work in progress
Fixes #872