Skip to content
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

Security: Only trust local proxies unless overidden #2797

Merged
merged 1 commit into from
Nov 20, 2024

Conversation

pglombardo
Copy link
Owner

@pglombardo pglombardo commented Nov 20, 2024

Description

This PR adds a rule to only trust proxies on the local network.

This fixes a weakness where the X-Forwarded-For header could be spoofed by unauthorized clients to bypass the rate limiter.

This can be overridden by the new trusted_proxies setting:

### Trusted Proxies
#
# By default, Password Pusher will only proxy related headers from proxies on
# the local network.  If you are using a proxy that is not on the local network,
# you will need to add the IP address of the proxy to the list below.
#
# This is useful if you are using a remote reverse proxy such as Cloudflare to
# serve the application.  If local, you can leave this setting as is.
# 
# Multiple IP addresses can be added by separating them with a comma.
#
# Environment Variable Override:
# PWP__TRUSTED_PROXIES='<ipaddress>'
# PWP__TRUSTED_PROXIES='<ipaddress1>,<ipaddress2>'
#
# trusted_proxies:
#   - '1.2.3.4'
#   - '2.3.4.5'

Related Issue

Type of Change

  • 📚 Examples / docs / tutorials / dependencies update
  • 🔧 Bug fix (non-breaking change which fixes an issue)
  • 🥂 Improvement (non-breaking change which improves an existing feature)
  • 🚀 New feature (non-breaking change which adds functionality)
  • 💥 Breaking change (fix or feature that would cause existing functionality to change)
  • 🔐 Security fix

Checklist

  • I've written tests (if applicable) for all new methods and classes that I created. (rake test)
  • I've added documentation as necessary so users can easily use and understand this feature/fix.

@pglombardo pglombardo merged commit 0f740a0 into master Nov 20, 2024
7 checks passed
@pglombardo pglombardo deleted the trusted_proxies branch November 20, 2024 15:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant