-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Returning forbidden when an unauthorised user tries to revoke a token #1252
Returning forbidden when an unauthorised user tries to revoke a token #1252
Conversation
Something weird with the errors in Travis, I will take a look. However in the meantime I would appreciate if you see this PR and can confirm that the new logic is correct. |
Hi @cristofer . I took a look at
Actually I didn't find what is meant by this described below, so we consider it's the error response from base RFC (6749). Then I checked section Also I think we need to change this line: # token.revoke if token.accessible?
# to:
token.revoke if token&.accessible? # in case invalid access token value was passed and we didn't find the token because of:
If client sends invalid token we have Also this point I think we don't check for token revocation:
Could you please add it too? If no - it's OK, I'll do it myself when I have time. Just LMK. |
Well, seems like your changes broke the specs :) You need to double-check them and fix I think |
thank you @nbulaj ! I will take care of what you mentioned before as soon as I have time. And about the travis errors, any clue about this error? |
Oh, seems like test app (spec/dummy) loads all Rails engines including ActionCable. Wondering how we didn't face it before 🤔 Need to check it out |
I fixed the specs, so you can rebase with current master |
9d28ef1
to
d2d50f7
Compare
@nbulaj please let me know if the changes I pushed in 72f84d1 are good enough (added the error description and the guard, also fixed the tests). I was not sure how to add the logic here
client_id , should I compare it with the server application? thanks!
|
72f84d1
to
fae0109
Compare
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.
See comments please
@cristofer you don't need to add anything here. This method checks if the token (that must be revoked) is present in the HTTP request. If not - we have an error (and it's OK). It token value present in the request, then server checks if this token issued to some application. In case it is, and application is confidential, then server must (and do it) check if authorized client is equal to the client that token was issued for. In case application isn't confidential (i.e public) - it's OK, token can be revoked by anybody. |
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.
Don't forget please to squash commits as bot suggested and we can merge it
Thanks!
f221f12
to
c7eee90
Compare
c7eee90
to
4930248
Compare
All good now @nbulaj ! Thanks for the time you took to give feedback, I am very excited about contributing to this amazing gem :) Chao! |
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.
LGTM
🚝
Thanks @cristofer for your patience and work! 🎉 |
Summary
When digging into an issue we are currently facing with Revoked tokens, I found out that the test
should not revoke the token as its unauthorized
leads me to see that if the user is not authorised to perform therevoke
, then it was not receiving the correct status for the operation, which isforbidden