Sat, 02 May 2020 19:10:08 +0200
Implemented a preliminary fix for issue 328 showing the user an indication, if he made an exception for a certificate issue of a host.
--- a/eric6/Preferences/__init__.py Sat May 02 14:04:18 2020 +0200 +++ b/eric6/Preferences/__init__.py Sat May 02 19:10:08 2020 +0200 @@ -961,6 +961,7 @@ "KeepCookiesUntil": 0, # CookieJar.KeepUntilExpire "FilterTrackingCookies": True, "SaveUrlColor": QColor(184, 248, 169), + # TODO: add colors for insecure URLs and malicious URLs "UserAgent": "", "AcceptQuotaRequest": 2, # yes/no/ask (0, 1, 2) "AcceptProtocolHandlerRequest": 2, # yes/no/ask (0, 1, 2)
--- a/eric6/WebBrowser/Network/NetworkManager.py Sat May 02 14:04:18 2020 +0200 +++ b/eric6/WebBrowser/Network/NetworkManager.py Sat May 02 19:10:08 2020 +0200 @@ -70,6 +70,8 @@ self.__permanentlyIgnoredSslErrors = {} # dictionaries of permanently and temporarily ignored SSL errors + self.__insecureHosts = set() + self.__loaded = False self.__saveTimer = AutoSaver(self, self.__save) @@ -179,6 +181,8 @@ host = error.url().host() + self.__insecureHosts.add(host) + if ( host in self.__temporarilyIgnoredSslErrors and error.error() in self.__temporarilyIgnoredSslErrors[host] @@ -222,6 +226,15 @@ else: return False + def isInsecureHost(self, host): + """ + Public method to check a host against the list of insecure hosts. + + @return flag indicating an insecure host + @rtype bool + """ + return host in self.__insecureHosts + def authentication(self, url, auth, page=None): """ Public slot to handle an authentication request.
--- a/eric6/WebBrowser/SiteInfo/SiteInfoWidget.py Sat May 02 14:04:18 2020 +0200 +++ b/eric6/WebBrowser/SiteInfo/SiteInfoWidget.py Sat May 02 19:10:08 2020 +0200 @@ -59,10 +59,17 @@ secureLabel.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Preferred) layout.addWidget(secureLabel, rows, 1) if url.scheme() in ["https"]: - secureLabel.setText( - self.tr("Your connection to this site is <b>secure</b>.")) - secureIcon.setPixmap( - UI.PixmapCache.getPixmap("securityHigh")) + if WebBrowserWindow.networkManager().isInsecureHost(url.host()): + secureLabel.setText( + self.tr("Your connection to this site " + "<b>may not be secure</b>.")) + secureIcon.setPixmap( + UI.PixmapCache.getPixmap("securityMedium")) + else: + secureLabel.setText( + self.tr("Your connection to this site is <b>secure</b>.")) + secureIcon.setPixmap( + UI.PixmapCache.getPixmap("securityHigh")) else: secureLabel.setText( self.tr("Your connection to this site is <b>not secure</b>."))
--- a/eric6/WebBrowser/Tools/WebIconLoader.py Sat May 02 14:04:18 2020 +0200 +++ b/eric6/WebBrowser/Tools/WebIconLoader.py Sat May 02 19:10:08 2020 +0200 @@ -19,7 +19,7 @@ """ Class implementing a loader for web site icons. - @signal iconLoaded(icon) emitted when the con has been loaded + @signal iconLoaded(icon) emitted when the icon has been loaded """ iconLoaded = pyqtSignal(QIcon) @@ -50,5 +50,7 @@ icon = QIcon(QPixmap.fromImage(QImage.fromData(data))) self.iconLoaded.emit(icon) + # TODO: extract SSL data as a by-product + self.__reply.deleteLater() self.__reply = None
--- a/eric6/WebBrowser/UrlBar/UrlBar.py Sat May 02 14:04:18 2020 +0200 +++ b/eric6/WebBrowser/UrlBar/UrlBar.py Sat May 02 19:10:08 2020 +0200 @@ -234,11 +234,18 @@ if not self.__browser.getSafeBrowsingStatus(): # malicious web site + # TODO: make this color configurable backgroundColor = QColor(170, 0, 0) foregroundColor = QColor(Qt.white) elif self.__browser.url().scheme() == "https": - backgroundColor = Preferences.getWebBrowser( - "SaveUrlColor") + if WebBrowserWindow.networkManager().isInsecureHost( + self.__browser.url().host() + ): + # TODO: make this color configurable + backgroundColor = QColor(170, 170, 0) + else: + backgroundColor = Preferences.getWebBrowser( + "SaveUrlColor") if progress == 0 or progress == 100: p.setBrush(QPalette.Base, backgroundColor)