Skip to content

Database error when receiving IPv6 with scope-id #131

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

Open
sevdog opened this issue Dec 17, 2024 · 1 comment
Open

Database error when receiving IPv6 with scope-id #131

sevdog opened this issue Dec 17, 2024 · 1 comment

Comments

@sevdog
Copy link
Contributor

sevdog commented Dec 17, 2024

When receiving an IPv6 there could be a "scope-id" part which is handled and validated by python stdlib.

However the string representation of this kind of value is not valid when used in postgres (see examples in RFC-4007 which raises an error

invalid input syntax for type inet: "fe80::1234%ne0"

Thus the db-prep value should not be the str representation of IPv6 addresses.

@sevdog
Copy link
Contributor Author

sevdog commented Dec 17, 2024

Internally django uses ipaddresse to validate IPv6 and uses a hack to remove the scope-id part:

https://github.com/django/django/blame/7e41a7a47d0ee3e2d8270b04afbb908ece0b2b77/django/utils/ipv6.py#L27

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

No branches or pull requests

1 participant