-
Notifications
You must be signed in to change notification settings - Fork 188
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
Wrong WWW-Authenticate: Basic ...
header with basic auth being disabled
#5986
Comments
I am reading the code. This really happens only if PROXY_ENABLE_BASIC_AUTH is set. Are you supposing to never return a |
Was reading the code as well and was really confused because I understood it the same way as you. But your implication is right, I just now found the env var in my docker compose, enabling basic auth. 😠 😆 Really sorry for the noise. To give you some fun: I was searching in my docker compose file with lower case
No. Should be fine the way it is. cc @dschmidt |
Actually... I would argue that when X-Requested-With is set to XmlHttpRequest, the basic auth www-authenticate header should never be sent |
@michaelstingl I would like to fix that. Cross platform approval needed? |
See PR for a possible fix. |
Describe the bug
The
authentication
middleware seems to wrongfully add aWWW-Authenticate: Basic ...
header in some situations. The code reads like that should only ever exist if basic auth is enabled. But I managed to get some edge cases responses with a 401 and bothWWW-Authenticate: Basic ...
andWWW-Authenticate: Bearer ...
headers.Steps to reproduce
Just run the following curl agains an ocis instance running on
https://host.docker.internal:9200
(or change the URL respectively).Since the access token is already expired, ocis returns:
It should just have failed silently with a 401 and
< Www-Authenticate: Bearer realm="host.docker.internal:9200", charset="UTF-8"
. The< Www-Authenticate: Basic realm="host.docker.internal:9200", charset="UTF-8"
is wrong and results in the browser showing a basic auth popup. Which is awful user experience. :-(How is this relevant
The rare edge case that I had was that the notification request was started in between some token renewal related requests. It seems like the internal idp or some middleware invalidates the access token as soon as a new one is requested. That seems to be totally fishy. I suppose this is not an edge case when you have a few thousand users in a system. That's just bad timing / a race condition that we don't want to have.
In the wild this will likely only ever happen with a scheduled notification listing request being badly timed in the middle of token renewal. Still, in production environments this will happen on a not so frequent but regular basis.
The text was updated successfully, but these errors were encountered: