Integer IP addresses don't work

Bug #1239388 reported by gue5t gue5t
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Midori Web Browser
Confirmed
Medium
Unassigned

Bug Description

Midori.URI.is_ip_address looks to be pretty rudimentary and has a lot of heuristics which are neither obvious nor explained. Its specific purpose should be documented, or it should be fixed to match what its name implies, as specified by the relevant Internet standards documents.

Some cases which are broken:
midori_uri_is_ip_address("@999.@999.@999.@999.@999.@999.") => TRUE
midori_uri_is_ip_address("127...1") => TRUE
midori_uri_is_ip_address("127.1.1.1.1") => TRUE

midori_uri_is_ip_address("::1") => FALSE
midori_uri_is_ip_address("0.0.0.0") => FALSE
midori_uri_is_ip_address("0177.0.0.1") => FALSE
midori_uri_is_ip_address("2130706433") => FALSE
midori_uri_is_ip_address("017700000001") => FALSE

Revision history for this message
Cris Dywan (kalikiana) wrote :

The purpose of Midori.URI.is_ip_address is to "quickly determine if the input resembles an IP".
> midori_uri_is_ip_address("@999.@999.@999.@999.@999.@999.") => TRUE
> midori_uri_is_ip_address("127...1") => TRUE
> midori_uri_is_ip_address("127.1.1.1.1") => TRUE
Those look like IPs to me, likely typos, showing an error is more useful here than doing a web search.

> midori_uri_is_ip_address("::1") => FALSE
Should say TRUE indeed.

> midori_uri_is_ip_address("0.0.0.0") => FALSE
> midori_uri_is_ip_address("0177.0.0.1") => FALSE
Those should probably return TRUE being typos intended as IPs.

> midori_uri_is_ip_address("2130706433") => FALSE
> midori_uri_is_ip_address("017700000001") => FALSE
Does any spec consider these IPs? They look like phone numbers to me.

I sort of consider the unit tests as the examples since they're based off of real life strings from bug reports and elsewhere. Though I suppose some examples could be added to the Midori.URI docs as well.

Revision history for this message
gue5t gue5t (gue5t) wrote :

All the IPs listed in the second block are accepted by inet_aton and subsequently browsers like Firefox and Chrome (and Midori; try them with "sudo ncat -l -k -p 80"). Unless we have rationale it seems like we should accept exactly what the underlying networking logic considers valid.

Revision history for this message
Cris Dywan (kalikiana) wrote :

What do you mean by "accepted" exactly? Chrome starts a search if I type 2130706433 in there.

Changed in midori:
status: New → Incomplete
Revision history for this message
gue5t gue5t (gue5t) wrote :

I mean that they're considered IP addresses and can be navigated to. They *aren't* URIs; a URI must have a protocol. But when I enter http://2130706433/ in the address bar of Chromium and hit enter, it directs to 127.0.0.1, which is the same IP address as 2130706433.

Revision history for this message
Cris Dywan (kalikiana) wrote :

I think two things are being mixed up here and the second one is what this bug really seem to aim for:

Midori.URI.is_ip_address asserts whether a string without a scheme resembles an IP address. sokoke_magic_uri uses it to guess that it should add http:// to open what's likely an IP address. In entries it's used as a quick check for typos. Neither use case prevents a full URI from working and only affects incomplete input.

Something in our stack doesn't understand some IP addresses such as http://2130706433/ and results in failure to resolve or recognize as a valid host, this doesn't hit Midori.URI.is_ip_address at all.

summary: - midori_uri_is_ip_address needs to be reworked
+ Integer IP addresses don't work
Changed in midori:
status: Incomplete → Confirmed
importance: Undecided → Medium
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.