Changeset 85453 in webkit


Ignore:
Timestamp:
May 1, 2011 6:55:17 PM (13 years ago)
Author:
abarth@webkit.org
Message:

2011-05-01 Adam Barth <abarth@webkit.org>

Reviewed by Eric Seidel.

Polish CSP host and port matching
https://bugs.webkit.org/show_bug.cgi?id=59899

Test two host wildcard cases.

  • http/tests/security/contentSecurityPolicy/image-full-host-wildcard-allowed-expected.txt: Added.
  • http/tests/security/contentSecurityPolicy/image-full-host-wildcard-allowed.html: Added.
  • http/tests/security/contentSecurityPolicy/image-host-wildcard-allowed-expected.txt: Added.
  • http/tests/security/contentSecurityPolicy/image-host-wildcard-allowed.html: Added.

2011-05-01 Adam Barth <abarth@webkit.org>

Reviewed by Eric Seidel.

Polish CSP host and port matching
https://bugs.webkit.org/show_bug.cgi?id=59899

Finish last two details of host and port matching. I don't think the
default port handling is testable with our current testing
infrastructure.

Tests: http/tests/security/contentSecurityPolicy/image-full-host-wildcard-allowed.html

http/tests/security/contentSecurityPolicy/image-host-wildcard-allowed.html

  • page/ContentSecurityPolicy.cpp: (WebCore::CSPSource::hostMatches): (WebCore::CSPSource::portMatches):
Location:
trunk
Files:
4 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r85451 r85453  
     12011-05-01  Adam Barth  <abarth@webkit.org>
     2
     3        Reviewed by Eric Seidel.
     4
     5        Polish CSP host and port matching
     6        https://bugs.webkit.org/show_bug.cgi?id=59899
     7
     8        Test two host wildcard cases.
     9
     10        * http/tests/security/contentSecurityPolicy/image-full-host-wildcard-allowed-expected.txt: Added.
     11        * http/tests/security/contentSecurityPolicy/image-full-host-wildcard-allowed.html: Added.
     12        * http/tests/security/contentSecurityPolicy/image-host-wildcard-allowed-expected.txt: Added.
     13        * http/tests/security/contentSecurityPolicy/image-host-wildcard-allowed.html: Added.
     14
    1152011-05-01  Adam Barth  <abarth@webkit.org>
    216
  • trunk/Source/WebCore/ChangeLog

    r85451 r85453  
     12011-05-01  Adam Barth  <abarth@webkit.org>
     2
     3        Reviewed by Eric Seidel.
     4
     5        Polish CSP host and port matching
     6        https://bugs.webkit.org/show_bug.cgi?id=59899
     7
     8        Finish last two details of host and port matching.  I don't think the
     9        default port handling is testable with our current testing
     10        infrastructure.
     11
     12        Tests: http/tests/security/contentSecurityPolicy/image-full-host-wildcard-allowed.html
     13               http/tests/security/contentSecurityPolicy/image-host-wildcard-allowed.html
     14
     15        * page/ContentSecurityPolicy.cpp:
     16        (WebCore::CSPSource::hostMatches):
     17        (WebCore::CSPSource::portMatches):
     18
    1192011-05-01  Adam Barth  <abarth@webkit.org>
    220
  • trunk/Source/WebCore/page/ContentSecurityPolicy.cpp

    r85451 r85453  
    3232#include "FormDataList.h"
    3333#include "Frame.h"
    34 #include "NotImplemented.h"
    3534#include "PingLoader.h"
    3635#include "SecurityOrigin.h"
     
    137136    bool hostMatches(const KURL& url) const
    138137    {
    139         if (m_hostHasWildcard)
    140             notImplemented();
    141 
    142         return equalIgnoringCase(url.host(), m_host);
     138        const String& host = url.host();
     139        if (equalIgnoringCase(host, m_host))
     140            return true;
     141        return m_hostHasWildcard && host.endsWith("." + m_host, false);
     142
    143143    }
    144144
     
    147147        if (m_portHasWildcard)
    148148            return true;
    149 
    150         // FIXME: Handle explicit default ports correctly.
    151         return url.port() == m_port;
     149        int port = url.port();
     150        return port ? port == m_port : isDefaultPortForProtocol(m_port, url.protocol());
    152151    }
    153152
Note: See TracChangeset for help on using the changeset viewer.