Skip to content

Conversation

@claudiamurialdo
Copy link
Collaborator

@claudiamurialdo claudiamurialdo commented Feb 26, 2024

Add a test for X-Forward headers and RemoteAddress function.

@genexusbot
Copy link
Collaborator

Cherry pick to beta success

@claudiamurialdo claudiamurialdo temporarily deployed to external-storage-tests February 26, 2024 18:17 — with GitHub Actions Inactive
@genexusbot
Copy link
Collaborator

Cherry pick to beta success

ggallotti
ggallotti previously approved these changes Feb 26, 2024
Copy link
Member

@ggallotti ggallotti left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One minor concern about this is that always enabling XForwardedFor allows client spoofing. (anybody can fake their ip address just by sending this header), when the App is not deployed behind a Proxy (LoadBalancer).

So, Apps that are exposed directly to internet (not recommended) could "suffer" this Issue.

I think that it's ok, any secure webapp should be deployed behind a Proxy/LoadBalancer.

…PNETCORE_FORWARDEDHEADERS_ENABLED environment variable is true.
@claudiamurialdo
Copy link
Collaborator Author

claudiamurialdo commented Feb 26, 2024

One minor concern about this is that always enabling XForwardedFor allows client spoofing. (anybody can fake their ip address just by sending this header), when the App is not deployed behind a Proxy (LoadBalancer).

So, Apps that are exposed directly to internet (not recommended) could "suffer" this Issue.

I think that it's ok, any secure webapp should be deployed behind a Proxy/LoadBalancer.

You raise a valid concern about potential IP spoofing when enabling X-Forwarded-For headers without being deployed behind a proxy or load balancer.
No further changes are needed. As you found the middleware behavior can be controlled using the ASPNETCORE_FORWARDEDHEADERS_ENABLED environment variable.
The unit test has been updated to execute with the environment variable.

@genexusbot
Copy link
Collaborator

Cherry pick to beta success

@claudiamurialdo claudiamurialdo changed the title Enabled Forwarded Headers Middleware Unit test for Forwarded Headers Middleware Feb 26, 2024
@claudiamurialdo claudiamurialdo merged commit 47e6c87 into master Feb 27, 2024
@claudiamurialdo claudiamurialdo deleted the remote-address-load-balancer branch February 27, 2024 13:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants