Changeset 199039 in webkit
- Timestamp:
- Apr 4, 2016, 9:12:48 PM (11 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 4 edited
-
ChangeLog (modified) (1 diff)
-
Modules/websockets/WebSocketChannel.cpp (modified) (1 diff)
-
platform/network/cf/SocketStreamHandle.h (modified) (2 diffs)
-
platform/network/cf/SocketStreamHandleCFNet.cpp (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r199038 r199039 1 2016-04-04 John Wilander <wilander@apple.com> 2 3 Block plaintext WebSocket requests to domains under HSTS. 4 https://bugs.webkit.org/show_bug.cgi?id=156049 5 <rdar://problem/13820000> 6 7 Reviewed by Brent Fulgham. 8 9 No new tests because the way TLS is setup for layout tests doesn't allow the server to set HSTS for 127.0.0.1 nor localhost. This is tracked in <rdar://problem/25467825>. 10 11 * Modules/websockets/WebSocketChannel.cpp: 12 (WebCore::WebSocketChannel::connect): 13 - Now sends usesEphemeralSession to SocketStreamHandle::create. 14 * platform/network/cf/SocketStreamHandle.h: 15 (WebCore::SocketStreamHandle::create): 16 - Added parameter usesEphemeralSession which it passes on to the SocketStreamHandle constructor. 17 * platform/network/cf/SocketStreamHandleCFNet.cpp: 18 (WebCore::SocketStreamHandle::SocketStreamHandle): 19 - Now blocks plaintext WebSocket connections for domains under HSTS if not in an ephemeral session. 20 1 21 2016-04-04 Simon Fraser <simon.fraser@apple.com> 2 22 -
trunk/Source/WebCore/Modules/websockets/WebSocketChannel.cpp
r198869 r199039 110 110 if (NetworkingContext* networkingContext = frame->loader().networkingContext()) { 111 111 ref(); 112 m_handle = SocketStreamHandle::create(m_handshake->url(), this, *networkingContext); 112 Page* page = frame->page(); 113 m_handle = SocketStreamHandle::create(m_handshake->url(), this, *networkingContext, (page ? page->usesEphemeralSession() : false)); 113 114 } 114 115 } -
trunk/Source/WebCore/platform/network/cf/SocketStreamHandle.h
r186476 r199039 50 50 class SocketStreamHandle : public ThreadSafeRefCounted<SocketStreamHandle>, public SocketStreamHandleBase, public AuthenticationClient { 51 51 public: 52 static PassRefPtr<SocketStreamHandle> create(const URL& url, SocketStreamHandleClient* client, NetworkingContext& networkingContext ) { return adoptRef(new SocketStreamHandle(url, client, networkingContext)); }52 static PassRefPtr<SocketStreamHandle> create(const URL& url, SocketStreamHandleClient* client, NetworkingContext& networkingContext, bool usesEphemeralSession) { return adoptRef(new SocketStreamHandle(url, client, networkingContext, usesEphemeralSession)); } 53 53 54 54 virtual ~SocketStreamHandle(); … … 61 61 virtual void platformClose(); 62 62 63 SocketStreamHandle(const URL&, SocketStreamHandleClient*, NetworkingContext& );63 SocketStreamHandle(const URL&, SocketStreamHandleClient*, NetworkingContext&, bool usesEphemeralSession); 64 64 void createStreams(); 65 65 void scheduleStreams(); -
trunk/Source/WebCore/platform/network/cf/SocketStreamHandleCFNet.cpp
r188642 r199039 61 61 #endif 62 62 63 #if PLATFORM(COCOA) 64 #import <CFNetworkSPI.h> 65 #endif 66 63 67 namespace WebCore { 64 68 65 SocketStreamHandle::SocketStreamHandle(const URL& url, SocketStreamHandleClient* client, NetworkingContext& networkingContext )69 SocketStreamHandle::SocketStreamHandle(const URL& url, SocketStreamHandleClient* client, NetworkingContext& networkingContext, bool usesEphemeralSession) 66 70 : SocketStreamHandleBase(url, client) 67 71 , m_connectingSubstate(New) … … 76 80 URL httpsURL(URL(), "https://" + m_url.host()); 77 81 m_httpsURL = httpsURL.createCFURL(); 82 83 #if PLATFORM(COCOA) 84 // Don't check for HSTS violation for ephemeral sessions since 85 // HSTS state should not transfer between regular and private browsing. 86 if (url.protocolIs("ws") 87 && !usesEphemeralSession 88 && _CFNetworkIsKnownHSTSHostWithSession(m_httpsURL.get(), nullptr)) { 89 m_client->didFailSocketStream(this, SocketStreamError(0, m_url.string(), "WebSocket connection failed because it violates HTTP Strict Transport Security.")); 90 return; 91 } 92 #endif 78 93 79 94 createStreams();
Note:
See TracChangeset
for help on using the changeset viewer.