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

IPv6 in X-Forwarded-For fix #6062

Merged
merged 2 commits into from Aug 9, 2019
Merged

IPv6 in X-Forwarded-For fix #6062

merged 2 commits into from Aug 9, 2019

Conversation

@davidfischer
Copy link
Contributor

@davidfischer davidfischer commented Aug 9, 2019

It's unclear to me whether our production proxies would ever include an IPv6 with port. In the errors I'm seeing in prod, I don't see that. X-Forwarded-For is not exactly a standard so there isn't something to look up here.

@davidfischer davidfischer requested review from dojutsu-user and Aug 9, 2019
Copy link
Member

@dojutsu-user dojutsu-user left a comment

Looks good.

Loading

# only client's ip is present
request = RequestFactory().get('/')
request.META['HTTP_X_FORWARDED_FOR'] = '203.0.113.195'
client_ip = get_client_ip(request)
self.assertEqual(client_ip, '203.0.113.195')

# only client's ip is present
request = RequestFactory().get('/')
ip = '2001:abc:def:012:345:6789:abcd:ef12'
Copy link
Member

@dojutsu-user dojutsu-user Aug 9, 2019

Choose a reason for hiding this comment

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

Where did you get the sample ip?

Loading

Copy link
Contributor Author

@davidfischer davidfischer Aug 9, 2019

Choose a reason for hiding this comment

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

I just created it. You can always test if it's a valid IP (it is) with the ipaddress module.

Loading

@ericholscher
Copy link
Member

@ericholscher ericholscher commented Aug 9, 2019

Hotfixed to rel.

Loading

@davidfischer davidfischer merged commit e53af66 into master Aug 9, 2019
3 checks passed
Loading
@davidfischer davidfischer deleted the davidfischer/ipv6-fix branch Aug 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants