[Webkit-unassigned] [Bug 182427] Add a way to check if a host is an IP address

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Fri Feb 2 09:07:49 PST 2018


https://bugs.webkit.org/show_bug.cgi?id=182427

--- Comment #9 from Carlos Garcia Campos <cgarcia at igalia.com> ---
(In reply to Michael Catanzaro from comment #8)
> Comment on attachment 332963 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=332963&action=review
> 
> Looks good, but I'll hold off on r+ because I bet Alex will want to review
> this.
> 
> > Source/WebCore/page/OriginAccessEntry.cpp:43
> > +    , m_hostIsIPAddress(URL::hostIsIPAddress(m_host))
> 
> Might be better to drop this member variable in favor of direct calls to
> hostIsIPAddress(m_host)?

Probably out of scope for this patch.

> > Source/WebCore/page/OriginAccessEntry.cpp:70
> > -    if (m_hostIsIPAddress && m_ipAddressSettings == TreatIPAddressAsIPAddress)
> > +    if (m_ipAddressSettings == TreatIPAddressAsIPAddress && (m_hostIsIPAddress || URL::hostIsIPAddress(origin.host())))
> 
> I think this is right, but it's an unrelated functionality change.
> Previously there was no test to check if origin was an IP address, and now
> there is.

It's not unrelated, this patch revealed the bug, that's what caused the http/tests/security/set-domain-remove-subdomain-for-ip-address.html failure. With the previous code 0.0.1 was considered a valid IP, which was wrong, and matchesOrigin() returned false. We should also check that the origin host is not an IP before trying to match domains.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20180202/ec8a76ab/attachment.html>


More information about the webkit-unassigned mailing list