Is x-forwarded-for safe?
#34647
Unanswered
jacobrobertsbaca
asked this question in
Questions
Replies: 1 comment
|
Upon further inspection, when the client overwrites the but the Cloudflare header: contains the real IP. Should I prefer |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
This section of the docs mentions using the
x-forwarded-forheader to get the client IP address in Postgres. However after a brief test, it seems that this header can be spoofed.For example, we can make a simple RPC:
and then curl with a spoofed header:
will print out
spoofed.I am using
x-forwarded-forto implement IP-banning for a project I am working on and I need to get a trustworthy value for the requester IP. Is this behaviour intended? Considering this approach was listed under the page called "Securing your API", I would have expected this header to have been forcibly overriden with the real IP when Supabase processed the request.All reactions