Skip to content

Conversation

ManuelBilbao
Copy link
Collaborator

@ManuelBilbao ManuelBilbao commented Oct 1, 2025

Add a config param to set the trusted HTTP header to get the user's IP from

@ManuelBilbao ManuelBilbao self-assigned this Oct 1, 2025
@ManuelBilbao ManuelBilbao added the signer Signer module label Oct 1, 2025
@ManuelBilbao ManuelBilbao changed the base branch from main to sigp-audit-fixes October 1, 2025 22:12
@ManuelBilbao ManuelBilbao marked this pull request as ready for review October 2, 2025 13:55
.get(header)
.ok_or(eyre::eyre!("{header} header not found"))?
.to_str()?
.parse()
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think this is going to run into 2 problems:

  1. When the header is set multiple times in the request, but the HTTP spec mandates that it should only be set once; this should be handled like a malformed input. client-ip knows when to look for it:
  • X-Real-Ip (Nginx)
  • True-Client-IP (Akamai, Cloudflare)
  • Fly-Client-IP (Fly.io)
  • CF-Connecting-IP (Cloudflare)
  1. In other cases, the header can be set multiple times or can have multiple values; for example, X-Forwarded-For is actually a comma-separated string with multiple IPs, and we have to use the rightmost one.

Perhaps there should be a more elaborate config for proxy stuff like this so the user can customize the behavior they'll actually encounter?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

signer Signer module

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants