-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[RFC] Trust proxies in the private IP range automatically #33578
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
Comments
In my own limited experience, it is quite common not have an untrusted Local Network, and only have a small set of trusted Reverse Proxies in front of the webserver(s). This used to be simple to manage when servers/vms where statically allocated, but now we live in a Docker/AWS world. But I presume that anybody who lives in a fully-dynamically-managed world has script-fu enough to be able to set up the trusted proxies with automatic reconfiguration upon infra deploy / update. ps: sorry if this is OT. I just read the RFC, not the effective code change... |
How would you implement that? I like the idea, but it should be explicit IMO. |
Well, there is 3 solutions here:
As far as I understand their Ruby code, Rails is doing the first choice. |
Doing the same as RoR would work for me. Help wanted. |
I really not sure if we should trust local networks by default for the same reason @gggeek explained. This kind of remind me of the old Elasticsearch broadcast discover (in the 1.x versions) that was problematic because people had their instances creating clusters with other people on the same local network on some hosting providers. Since this option can lead to security concerns I think the default value should be secure in all cases. |
As @stof reports, that's already the default in Ruby On Rails. I think that's a serious enough precedent to warrant us considering doing the same. See https://api.rubyonrails.org/classes/ActionDispatch/RemoteIp.html |
Note that I don't think this should be the default in Symfony core (I'm not sure it's worth the BC migration path we'll have to create) |
[ troll ] As @stof reports, that's already the default in Ruby On Rails. I think that's a serious enough precedent to warrant us doing the opposite. [ /troll ] :-P |
Reading the Ruby-on-Rails middleware again, it is NOT enabled by default. But once enabled, it defaults to private IPs. An alternative idea, similar to #33574: we could alias the special |
Another idea: symfony/recipes#654 |
This does have potential security implications. Combined with poorly designed security controls - ex. firewalls that have access_control items with the only IP defined (unfortunately seen far too often even in this day and age). Having private ranges trusted by default would increase the attack surface in Symfony installations where someone failed to pay attention to this and have LAN compromised boxes, have bad actors as LAN neighbors OR have some sort of shared hosting environment/whatnot weird network configuration. I'd rather have a choice than unsafe default. It's probably just not worth the risk. |
The idea would be to trust private IP ranges as trusted proxies by default. This would make Symfony works by default when using it behind a load balancer running on the same local network (leaving explicit configuration needed for cases where you have a trusted proxy on public internet, for instance when using Cloudflare without their Argo Tunnel feature).
For instance, this would work out of the box on Heroku (I haven't investigated AWS ELB as I'm not using it). It would also remove the need for HttpCache to alter the trusted proxies to force
127.0.0.1
to be part of itFor reference, this is what Rails does: https://api.rubyonrails.org/v5.1.7/classes/ActionDispatch/RemoteIp.html
what do you think about it ?
The text was updated successfully, but these errors were encountered: