Skip to content
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

Ingress addons alunched from sidebar return 401: Unauthorized #7090

Closed
mikosoft83 opened this issue Sep 18, 2020 · 17 comments
Closed

Ingress addons alunched from sidebar return 401: Unauthorized #7090

mikosoft83 opened this issue Sep 18, 2020 · 17 comments
Labels
Supervisor Related to the supervisor panel

Comments

@mikosoft83
Copy link

The problem

When I try to launch any Ingress based addon from sidebar I get 401: Unathorized. This happened just randomly one day on all my devices (3 different computers, android and ios app, ipad app and also in private mode) and has been like that since (several days now). Restarting HA, HassOS or the whole Pi didn't help. The same behavior happens with File Editor, Node Red, ESPHome etc. When I try to launch WebUI directly from Addon page, it works fine.

Environment

  • Home Assistant Core release with the issue: 0.114 and 0.155
  • Last working Home Assistant Core release (if known): 0.114
  • Operating environment (OS/Container/Supervised/Core): OS
  • Integration causing this issue: ingress
  • Link to integration documentation on our website:

Problem-relevant configuration.yaml

Traceback/Error logs

Additional information

has1
has2

@lovelylain
Copy link

Finally someone reported this problem. This seems to have nothing to do with the HA version. As long as the supervisor is version 236 and later, the sidebar ingress addons will report "401: Unauthorized". There is no problem if enter from "Open Web UI" of addon page.

IMAGE                                            NAMES
hassioaddons/node-red-amd64:7.2.0                addon_a0d7b954_nodered
homeassistant/amd64-addon-mosquitto:5.1          addon_core_mosquitto
homeassistant/qemux86-64-homeassistant:0.115.2   homeassistant
homeassistant/amd64-hassio-multicast:3           hassio_multicast
homeassistant/amd64-hassio-observer:3            hassio_observer
homeassistant/amd64-hassio-cli:26                hassio_cli
homeassistant/amd64-hassio-audio:17              hassio_audio
homeassistant/amd64-hassio-dns:9                 hassio_dns
homeassistant/amd64-hassio-supervisor:245        hassio_supervisor

@frenck frenck transferred this issue from home-assistant/core Sep 21, 2020
@ludeeus
Copy link
Member

ludeeus commented Sep 21, 2020

The cookie handling changed a while back to be ready for the upcoming samesite requirements.
How are you accessing it? IP? mDNS? Home assistant cloud? Proxy? Tor? Does it matter?
What type and version of browsers?
Are anything logged to browser console?

@ludeeus ludeeus added the Supervisor Related to the supervisor panel label Sep 21, 2020
@lovelylain
Copy link

The cookie is Name=ingress_session Path=/api/hassio_ingress/ SameSite=Strict, maybe it's the Path and SameSite property cause the problem.

@ludeeus
Copy link
Member

ludeeus commented Sep 22, 2020

They are both correct, now answer my questions.

@lovelylain
Copy link

ok, it's my browser dit not handle SameSite=Strict correctly, I switch to latest chrome and the problem gone.

@ludeeus
Copy link
Member

ludeeus commented Sep 23, 2020

@mikosoft83 Can you take a look at #7090 (comment)?
and/or check your browser version

@lovelylain
Copy link

But I think you guys are too radical. I tried a variety of browsers, including PC browsers and Android browsers. Only the latest version of chrome will not show 401: Unauthorized.

latest chrome:

Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.121 Safari/537.36

tried PC browsers:

Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.25 Safari/537.36 Core/1.70.3775.400 QQBrowser/10.6.4208.400

tried Android browsers:

Mozilla/5.0 (Linux; U; Android 9; zh-cn; MI 6 Build/PKQ1.190118.001) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/71.0.3578.141 Mobile Safari/537.36 XiaoMi/MiuiBrowser/11.4.17

Mozilla/5.0 (Linux; Android 9; MI 6 Build/PKQ1.190118.001; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/77.0.3865.120 MQQBrowser/6.2 TBS/045331 Mobile Safari/537.36 MMWEBID/5252 MicroMessenger/7.0.18.1740(0x2700123B) Process/tools WeChat/arm64 NetType/WIFI Language/zh_CN ABI/arm64

@mikosoft83
Copy link
Author

@mikosoft83 Can you take a look at #7090 (comment)?
and/or check your browser version

Sorry for being a little late here but my computer is currently stowed away since the room it was in was remodeled.
The mobile apps started working by themselves.
I am using Vivaldi browser (chromium based). I checked and for some reason it stopped notifying me of updates so I forgot to update. After I updated it the Ingress stuff is now working. Thanks for your help, I wouldn't have noticed the browser was so out of date.

@ludeeus
Copy link
Member

ludeeus commented Sep 24, 2020

@lovelylain I have tested this with multiple browsers on desktop (Windows/Ubuntu/MacOS) and mobile (Android 9/iOS 13), none of which have any issues with connection.

@mikosoft83
Copy link
Author

Well, sorry to reopen, but it happened again, out of the blue, without me updating anything. I think I was on sup 248, I updated Core after that, also Sup but it's the same, 401: Unauthorized.

@mikosoft83 mikosoft83 reopened this Oct 22, 2020
@ludeeus
Copy link
Member

ludeeus commented Oct 28, 2020

My comment still stands #7090 (comment)

@mikosoft83
Copy link
Author

I updated my browser and it works again. It was just a minor update.

@ludeeus do I need to religiously update my browser to prevent this from happening? It feels kinda silly.

@ludeeus
Copy link
Member

ludeeus commented Oct 28, 2020

Should not need to.
The browser should have the necessary support, or not, on a version that should not magically disappear 🤷

Closing this for now, if/when it happens again, please open a new issue and provide the details I asked for 👍

@ludeeus ludeeus closed this as completed Oct 28, 2020
@Tyde
Copy link

Tyde commented Aug 14, 2021

I see this issue happening again in my firefox, but not on chrome.

The request parameters for Firefox are:

GET /api/hassio_ingress/Hg-0CXeijTkA-4E4a_okY-qCMbX4dkKN-eX4NoYE1Uc/ HTTP/1.1
Host: 192.168.178.44:8123
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Firefox/91.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
Accept-Language: de,en-US;q=0.7,en;q=0.3
Accept-Encoding: gzip, deflate
DNT: 1
Connection: keep-alive
Referer: http://192.168.178.44:8123/core_configurator
Upgrade-Insecure-Requests: 1
Pragma: no-cache
Cache-Control: no-cache

While on Chrome it sends the following:

GET /api/hassio_ingress/Hg-0CXeijTkA-4E4a_okY-qCMbX4dkKN-eX4NoYE1Uc/ HTTP/1.1
Host: 192.168.178.44:8123
Connection: keep-alive
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.131 Safari/537.36
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9
Referer: http://192.168.178.44:8123/core_configurator
Accept-Encoding: gzip, deflate
Accept-Language: de-DE,de;q=0.9,en-US;q=0.8,en;q=0.7
Cookie: ingress_session=#REDACTED#

So it seems like that Firefox is not sending a ingress_session cookie. I alse cleared all data for this site on Firefox but that did not help. Looking at the cookie-store for the site Firefox does indeed show a cookie called ingress_session, but it isn't part of the request header. Is this an issue with firefox?

@ludeeus
Copy link
Member

ludeeus commented Aug 14, 2021

Firefox does not send any cookies when their "Enhanced Tracking Protection" is set to Strict.
They have a warning in their settings:
Screenshot from 2021-08-14 14-33-41
about:preferences#privacy

@Tyde
Copy link

Tyde commented Aug 14, 2021

Yep thank you that was the issue

@felurx
Copy link

felurx commented Aug 30, 2021

A note for those who don't want to lower their privacy settings (like me): You can just add an exception by clicking the shield next to the URL and toggling the switch off :)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Supervisor Related to the supervisor panel
Projects
None yet
Development

No branches or pull requests

5 participants