-
-
Notifications
You must be signed in to change notification settings - Fork 4k
Fix reverse proxying in Settings #5232
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
base: main
Are you sure you want to change the base?
Conversation
WalkthroughThe condition in Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: Repository UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
🧰 Additional context used📓 Path-based instructions (2)wled00/data/**/*.{htm,html,css,js}📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Files:
wled00/data/**📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Files:
🧠 Learnings (1)📓 Common learnings🧬 Code graph analysis (1)wled00/data/common.js (1)
🔇 Additional comments (1)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
@gunjambi did you test that it works as before when users don't use a reverse proxy? |
|
Yes, I've tested Settings page works with the following urls:
|
|
I hope that remote proxy is not being used to expose WLED to the public internet - that is a really bad idea. Frankly support use behind a proxy should never really have been added as it risks people thinking it's ok to expose online |
|
I use a reverse proxy to expose WLED over internet over TLS. I use an authentication proxy to limit access to only myself. Access over internet is convenient so I can control my christmas lights. my wlan doesn't have a long range. Can you expand what are your concerns why you think exposing the WLED over internet is a bad idea so we know we are talking of the same problem. I'm not trying to be sarcastic here. There are few concerns I can think of: A) Unauthenticated access: since WLED doesn't support and doesn't intend to support authentication, having authentication could have configure hardware wrong and break it. Or flash it and take over and run malicious code. B) Reverse proxying to non-top level path means the web applications are sharing cookies / resources with other apps under the same domain. This could cause issues if WLED used cookies? For B) I don't see this is as a concern. WLED doesn't use cookies or any web permissions so it can't get mixed up here. And if you manually do upload html and js via /edit, yes, you can access the cookiejar of the domain. This would only be a vulnerability if some external party is hosting the WLED for you on a domain running some other web app. Not realistic, and even still it's not a WLED vulnerability. For A). Yes, unauthenticated use is unsafe, but that's hardly a unique problem for WLED. For any service you expose to internet, you need ensure proper authorization. Rather than say this is too dangerous, maybe there should be a guide how to do it safely, i.e. add an authentication proxy. People are doing this already, so arguably the cat is out of the bag. If we want some technical seatbelts, I guess we could check the IP for all incoming requests and opt-out reject all not in common local network IP address spaces (and captive portal). Additionally, we could check for X-ForwardedFor header to detect the presence of a proxy. I don't believe these would change anything however as users would simply turn the checks off. |
|
I am relieved to hear your proxy setup is adding an additional authentication layer, I fear many (most?) do not While I hope that no users are port forwarding WLED, I'm sure there are instances of that, which is why we have restricted OTA to only be from the same subnet, however this protection is defeated by a proxy |
|
Here's a doc PR which I hope alleviates these concerns. Specifically it:
|
getLoc has an off-by-one where reverse proxy path gets parsed wrong if it's routed on the top-level path.
I have WLED in
domain.com/wled/. On settings page we compute:This then breaks the computation for the "s.js" path.
If I have WLED in
domain.com/w/led/the abovepaths.length > 0is taken as expected and settings work.This PR fixes the off-by-one
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.