-
-
Notifications
You must be signed in to change notification settings - Fork 243
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
Use status instead of message for error responses to detect Unauthorized requests #1045
Conversation
Signed-off-by: Leon Kiefer <leon.k97@gmx.de>
@ghys ESLint is complaining about "Expected error to be handled node/handle-callback-err", because now I don't use the first argument of the error callback, because it is not useful in this case. Should I disable this lint rule for these two lines? |
I'm absolutely not 100% sure about this, it could be an object with the code inside. Will have to check. |
Well, actually...
is completely wrong 😠. In other terms So I guess an ugly workaround would be to change the rejection above to |
@ghys I updated the code according to your comments. |
Thank you. Shame we have to deal with it like this but it'll do :)
These are parts of the logic that will redirect to the authorize page when you enforce authorization for the non-admin ops (Settings > API Security > Show advanced > Implicit user role for unauthenticated requests disabled). |
added workaround for empty reason-phrase Signed-off-by: Leon Kiefer <leon.k97@gmx.de>
d801864
to
5f6f0d6
Compare
I added the workaround also to these two places. |
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.
Excellent, thanks!
Job #113: Bundle Size — 10.43MB (~-0.01%). |
With HTTP2 there is no status code reason-phrase and even in HTTP1 it is optional. Therefore the response status codes must be used to detect unauthorized request errors.
fix #1018
@ghys based on your comment I assume the second argument is the integer status code, I did not test this code, but I think it should work.