-
-
Notifications
You must be signed in to change notification settings - Fork 614
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
[Bug]: ACTUAL_TRUSTED_PROXIES has not desired effect #371
Comments
I just had a quick look at the description of proxyaddr:
So this means that |
I am getting the idea that it would be better to use |
@tuetenk0pp at the moment if your proxy is a private IP it would have been already trusted, and so you don't need to specify any proxy in the args. Because we are using 'uniquelocal' we only need folks to pass a trusted proxy that matches the closest public IP range proxy before actualbudget server. In this case we only care about a single trusted endpoint, our closest one. We want to make sure the auth header is coming through a proxy we trust. (just as a form of allowing users to turn on header auth for specific routes, rather than the public way to your budget if you have one) A better experience would likely be to not use |
@twk3 I understand this is the way it should work. Unfortunately for me, it produces the described behavior. My reverse proxy is in fact in a private range. The way I understand the But the main issue I see is something else. From what I understand, the
So this means, if my reverse proxy were at That's why I created #379. |
Ahh yes, that is correct. We need a change that fixes that. What we want to be checking is the closest untrusted proxy though, and not all IPs in the request. The ideal that I would want would be if you could define the proxies in your network between the server and the proxy that's we're trying to ignore. (These maybe load balancers and gateways in your network, today we've hardcoded these to uniquelocal), and the auth proxy. (this is what we've defined as the trusted proxy in our config). Then all other IPs beyond that need to be ignored (cloudflare/cloudfront etc and the like, where you have very little control of the IP even if they are the front of your network, and of course the client ip) Maybe we named the config poorly, maybe it should have been authProxy instead of trustedProxies. (as trusted proxies would usually be the list that goes into the ipaddr function instead of uniquelocal) |
Not related to this bug but I saw your caddy log as |
Now I also get this error. |
Caution Still, the I see #399 will hopefully resolve this so there is probably no need for #379. Feel free to close that / I will close it once #399 hits main. |
I have the same issue with using Authentik and NGINX. Also bypassed this by adding all IPv6 addresses to trusted proxies which is indeed not the best way. As I understand it is that the X-Forwarded-For header is used to determine the proxy? Would it be a temp fix to change this header to $server_addr in the NGINX config? |
@tuetenk0pp would it be possible to reopen your PR, given that #399 seems to be abandonned? |
Probably a good idea. I will check on it later. |
@tuetenk0pp #379 breaks other use cases by requiring all Ips to be trusted other than the last one. This won't work if you are on most university/hotel internet where you are going through additional proxies. I think the fix for now is:
This should allow uses with proxies i the private ranges to set this up without needing to specif the trust, AND if they do setup the trust, it should still work. I can take a look at making these changes over the coming week, @tuetenk0pp I'll ping you when they're ready so you can take a look and see if it fixes the problem for you. |
Verified issue does not already exist?
What happened?
I set up actual budget to allow for header authentication via authentik. So I added the group attributes in authentik:
I also added the following environment variables to my docker setup:
This is how I configured Caddy:
What error did you receive?
When I try to login into my actual budget instance, I get this error:
The server log prints:
So the header authentication works in principle, but appearently, actual budget confuses my external IP and the reverse proxy IP. I suspect the issue might be related to the
validateAuthHeader
function.actual-server/src/util/validate-user.js
Line 32 in 1af5ab0
I also checked my caddy logs, so here's an example:
As you can see, it correctly passes the
X-Forwarded-For
andX-Forwarded-Host
headers to actual budget.I was able to login after I added
<my_external_ip>
to theACTUAL_TRUSTED_PROXIES
. Obviously, this is not how it should work.Let me know if I can assist in any way.
Where are you hosting Actual?
Docker
What browsers are you seeing the problem on?
No response
Operating System
None
The text was updated successfully, but these errors were encountered: