Avoid tokens of trusted web clients after a password reset - #398
Conversation
90be410 to
01d3b7d
Compare
thraxil
left a comment
There was a problem hiding this comment.
Would this be useful to push upstream? Or is the token removal something that only affects us?
|
Thanks @thraxil! I think it would be useful, I'll check with the Open edX folks. |
melvinsoft
left a comment
There was a problem hiding this comment.
@OmarIthawi Thanks for fixing this, it looks good to me!
I second @thraxil comment, we should push it upstream.
Also, regarding your questions, I think put behind a feature flag would be great, we're trying to get our enterprise and tahoe branches together, and this could be an undesired behaviour for enterprise customers.
|
Thanks @melvinsoft! I've already pushed it upstream, but it's going to be a long time before we can get a response from the Open edX folks. So I'll put it behind a feature flag, disabled by default. |
|
@melvinsoft what about the other questions. I'd love to get what you think on them! |
iamjazzar
left a comment
There was a problem hiding this comment.
Thanks for the tests, @OmarIthawi! Some is always better than nothing.
I think this change will create a confusion in edx-oauth2-provider library as its documentation clearly stated the purpose behind the TrustedClient:
"""
By default `django-oauth2-provider` shows a consent form to the
user after his credentials has been validated. Trusted clients
bypass the user consent and redirect to the OAuth2 client
directly.
""" One change here we can make is to add a flag to by passing the consent and/or another one to allow destroying OAuth tokens. What do you think?
Regarding your questions:
Should I put this behind a feature or Wafl flag? Just in case we found out it's dangerous? @melvinsoft says yes!?
I recommend this! It'll reduce the maintenance effort in the future, which is going to accelerate the development time by then 😉
How do we prevent marking mobile clients as trusted?
See my suggestion above ↑
Do you think the tests are solid? Or should test more intensively?
Those are good for now, more might be needed later. I still don't know if we can run all edx-platform tests in this repo?
This comment has been minimized.
This comment has been minimized.
|
Thanks @AhmedAljazzar!
😄
Great catch! Thanks a lot for checking this.
I don't think it makes sense to disable the original behavior. So adding one more feature flag to toggle the new behavior sounds like a good option to me.
Not sure I understand what you mean. Anyway, I think it's a minor point that we can address later.
No we don't have that. We used to have it for Ficus but we didn't get to it in Hawthorn yet. |
@OmarIthawi What I meant is: if we decided to go with implementing a flag for the new behavior, then we will be able to disable this flag for mobile clients (Or any other client technically). I don't know if edX creates mobile clients upon deployment, but if so, we can store those mobile clients with this flag set as disabled to skip the behavior. I wonder what edX will say about this though. |
Ah, got you! I think this is something that I didn't think about! Mobile clients are indeed marked trusted sometimes. I have no idea how to separate mobile client from others. What do you suggest?
That'll take sometime. But I think it's worth the wait. |
|
@OmarIthawi I agreed with @AhmedAljazzar here, those test look enough for now. Regarding the mobile clients, I don't fully understand the question, I think mobile clients are always trusted. |
01d3b7d to
31940d4
Compare
31940d4 to
773949d
Compare
|
@AhmedAljazzar @melvinsoft @thraxil I've added a feature flag and now the function removes the tokens for mobile applications even if they're trusted. Now all the known issues of the original code are resolved. Please take another look and let me know what do you think. |
773949d to
541a410
Compare
|
Thanks @thraxil for the review! @AhmedAljazzar one more look please! |
301f7b3 to
ce20e16
Compare
melvinsoft
left a comment
There was a problem hiding this comment.
@OmarIthawi Thanks for implementing the changes! Let's try it on Staging!
Description
Filip found out that the missing AMC tokens is an Open edX feature after a password reset.
This fixes the issue by avoid removing the tokens for
TrustedClientlike the AMC.See: https://tahoe.appsembler.com/admin/edx_oauth2_provider/trustedclient/
And yes, it has tests 😉
Questions