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

TRUSTED_PROXIES environment variable is not honored in v1.6.0+ #1689

Closed
micahlee opened this issue Jul 15, 2020 · 0 comments
Closed

TRUSTED_PROXIES environment variable is not honored in v1.6.0+ #1689

micahlee opened this issue Jul 15, 2020 · 0 comments
Assignees
Labels

Comments

@micahlee
Copy link
Contributor

Description of the Problem

Prior to v1.6.0, the TRUSTED_PROXIES environment variable for Conjur was used to inform Rack and Rails which IP addresses are "trusted" when processing the X-Forwarded-For HTTP header and the TCP remote IP. The first IP address that is not in the trusted proxies list becomes the request.ip used by Rack and Rails.

This was accomplished in versions before v1.6.0 by patching the Rack::Request#trusted_proxy? method in the conjur-rack gem: https://github.com/cyberark/conjur-rack/blob/master/lib/conjur/rack.rb

However, in version v1.6.0, specifically in upgrading our version of Rails from 4 to 5 (which also upgraded Rack), this method in Rack no longer exists at this location. It was moved to another Rack::Request::Helpers module. So this patch no longer works as expected, and only the default Rails IP safelist is used: https://github.com/rack/rack/blob/master/lib/rack/request.rb#L19

Expected Behavior

To align with the behavior pre-Rails 5, if TRUSTED_PROXIES is set in the environment, then only this list of IP address or IP address ranges (in CIDR format) are considered trusted by Rack and Rails for request.ip. If the TRUSTED_PROXIES is not set, it falls back to the default Rails behavior.

@micahlee micahlee self-assigned this Jul 15, 2020
@micahlee micahlee changed the title TRUSTED_PROXIES environment variable is no honored in v1.6.0+ TRUSTED_PROXIES environment variable is not honored in v1.6.0+ Jul 15, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants