Verified Commit 46d798bd authored by cypherpunks1's avatar cypherpunks1 Committed by Pier Angelo Vendrame
Browse files

fixup! Bug 23247: Communicating security expectations for .onion

Bug 41934: Treat unencrypted websocket connections to onion services as secure
parent 79ed1d1a
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
@@ -1734,12 +1734,15 @@ nsresult WebSocketImpl::Init(JSContext* aCx, bool aIsSecure,
  }

  // Don't allow https:// to open ws://
  if (!mIsServerSide && !mSecure &&
  if (!mIsServerSide && !mSecure && aIsSecure &&
      !Preferences::GetBool("network.websocket.allowInsecureFromHTTPS",
                            false) &&
      !nsMixedContentBlocker::IsPotentiallyTrustworthyLoopbackHost(
          mAsciiHost)) {
    if (aIsSecure) {
    nsCOMPtr<nsIURI> uri;
    nsresult rv = NS_NewURI(getter_AddRefs(uri), mURI);
    NS_ENSURE_SUCCESS(rv, rv);
    if (!nsMixedContentBlocker::IsPotentiallyTrustworthyOnion(uri)) {
      return NS_ERROR_DOM_SECURITY_ERR;
    }
  }