[Pkg-mozext-commits] [perspectives-extension] 21/72: added in statusbar: distrust all certificates Fixes #132.

David Prévot taffit at moszumanska.debian.org
Thu Dec 11 02:12:47 UTC 2014


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch master
in repository perspectives-extension.

commit 8b409b96d2a4508453cecacd9335eb4be692107b
Author: Gerold Meisinger <gerold.meisinger at gmail.com>
Date:   Tue Jul 1 23:25:10 2014 +0100

    added in statusbar: distrust all certificates
    Fixes #132.
---
 plugin/chrome/content/statusbar.js     | 53 ++++++++++++++++++++++++----------
 plugin/chrome/content/statusbar.xul    | 21 ++++++++------
 plugin/chrome/locale/de/dialogs.dtd    |  1 +
 plugin/chrome/locale/en-US/dialogs.dtd |  1 +
 plugin/chrome/locale/es-MX/dialogs.dtd |  1 +
 plugin/chrome/locale/fi/dialogs.dtd    |  1 +
 plugin/chrome/locale/fr/dialogs.dtd    |  1 +
 plugin/chrome/locale/nl/dialogs.dtd    |  6 ++--
 plugin/chrome/locale/pl/dialogs.dtd    |  3 ++
 plugin/chrome/locale/zh-CN/dialogs.dtd |  1 +
 10 files changed, 61 insertions(+), 28 deletions(-)

diff --git a/plugin/chrome/content/statusbar.js b/plugin/chrome/content/statusbar.js
index 9222720..f76bc66 100644
--- a/plugin/chrome/content/statusbar.js
+++ b/plugin/chrome/content/statusbar.js
@@ -26,30 +26,30 @@ var Pers_statusbar = {
 	STATE_WHITELIST : 4,
 
 	force_update : function(event) {
-		Perspectives.forceStatusUpdate(window); 
+		Perspectives.forceStatusUpdate(window);
 	},
 
 	statusbar_click: function(event) {
 		Pers_statusbar.open_results_dialog();
 	},
 
-	// note: when debugging, it is useful to open this dialog as a 
+	// note: when debugging, it is useful to open this dialog as a
 	// window, so we get a Firebug console, etc
-	open_results_dialog: function() { 
+	open_results_dialog: function() {
 		window.openDialog(
 	//	window.open( // for debug
-			"chrome://perspectives/content/results_dialog.xul", 
+			"chrome://perspectives/content/results_dialog.xul",
 	//        	"perspectivesResults", "").focus();  // for debug
 			"perspectivesresults", "centerscreen, chrome, toolbar").focus();
 
 	},
 
-	// note: when debugging, it is useful to open this dialog as a 
+	// note: when debugging, it is useful to open this dialog as a
 	// window, so we get a firebug console, etc
-	open_preferences_dialog: function() { 
+	open_preferences_dialog: function() {
 		window.openDialog(
 	// 	window.open( // for debug
-			"chrome://perspectives/content/preferences_dialog.xul", 
+			"chrome://perspectives/content/preferences_dialog.xul",
 	//       	"perspectivesResults", "").focus();  // for debug
 			"perspectivepreferences", "centerscreen, chrome, toolbar, resizable").focus();
 
@@ -67,25 +67,25 @@ var Pers_statusbar = {
 
 
 	setStatus: function(uri,state, tooltip){
-		if(uri != null && uri != window.gBrowser.currentURI) { 
-		//	Pers_debug.d_print("main", "Ignoring setStatus for '" + uri.spec + 
-		//	"' because current browser tab is for '" + 
-		//	window.gBrowser.currentURI.spec + "'"); 
-			return;  
+		if(uri != null && uri != window.gBrowser.currentURI) {
+		//	Pers_debug.d_print("main", "Ignoring setStatus for '" + uri.spec +
+		//	"' because current browser tab is for '" +
+		//	window.gBrowser.currentURI.spec + "'");
+			return;
 		}
 		if(!tooltip){
 			tooltip = "Perspectives";
 		}
 
 		var imgList = document.querySelectorAll("image.perspective-status-image-class");
-		
+
 		if(!imgList){ //happens when called from a dialog
 			imgList = window.opener.document.
 				querySelectorAll("image.perspective-status-image-class");
 		}
 
 		for (var j = 0; j < imgList.length; ++j) {
-			imgList[j].parentNode.setAttribute("tooltiptext", tooltip); 
+			imgList[j].parentNode.setAttribute("tooltiptext", tooltip);
 			switch(state){
 			case Pers_statusbar.STATE_SEC:
 				Pers_debug.d_print("main", "Secure Status");
@@ -119,10 +119,33 @@ var Pers_statusbar = {
 	},
 
 	openCertificates: function(){
-		openDialog("chrome://pippki/content/certManager.xul", 
+		openDialog("chrome://pippki/content/certManager.xul",
 			"Certificate Manager","centerscreen,chrome");
 	},
 
+	distrusts_all_certificates : function() {
+		var PROMPT = "The CA system is broken"
+		var str = window.prompt(
+			"Perspectives - THIS WILL DISTRUST ALL YOUR BROWSER'S CERTIFICATES! - USE WITH CAUTION!\n" +
+			"If you know what you are doing please enter the following sentence: '" + PROMPT + "'", "");
+		if(str.toLowerCase() === PROMPT.toLowerCase()) {
+			var certDB2 = Components.classes["@mozilla.org/security/x509certdb;1"].getService(Components.interfaces.nsIX509CertDB2);
+			certDB2.QueryInterface(Components.interfaces.nsIX509CertDB);
+			var i = 0;
+			var it = certDB2.getCerts().getEnumerator();
+			while(it.hasMoreElements()) {
+				var cert = it.getNext();
+				certDB2.setCertTrust(cert, cert.CA_CERT    , 0);
+				certDB2.setCertTrust(cert, cert.USER_CERT  , 0);
+				certDB2.setCertTrust(cert, cert.EMAIL_CERT , 0);
+				certDB2.setCertTrust(cert, cert.SERVER_CERT, 0);
+				i += 1;
+			}
+
+			alert(i + " certificates have been distrusted.");
+		}
+	},
+
 	openHelp: function(){
 		openDialog("chrome://perspectives/content/help.xhtml","",
 			"width=600,height=600,resizable=yes,centerscreen");
diff --git a/plugin/chrome/content/statusbar.xul b/plugin/chrome/content/statusbar.xul
index f6149c3..5d191c9 100644
--- a/plugin/chrome/content/statusbar.xul
+++ b/plugin/chrome/content/statusbar.xul
@@ -39,9 +39,10 @@
 		  <menuitem label="&Addtowhitelist;"    oncommand="Pers_whitelist_dialog.add_to_whitelist()"/>
 		  <menuseparator/>
 	<!--      <menuitem label="Refresh All Notary Data"   oncommand="requery()"/> -->
-		  <menuitem label="&Preferences;" oncommand="Pers_statusbar.open_preferences_dialog()"/>
-		  <menuitem label="&ViewCertificateStore;" oncommand="Pers_statusbar.openCertificates()"/>
-		  <menuitem label="&Help;" oncommand="Pers_statusbar.openHelp()"/>
+		  <menuitem label="&Preferences;"             oncommand="Pers_statusbar.open_preferences_dialog()"    />
+		  <menuitem label="&ViewCertificateStore;"    oncommand="Pers_statusbar.openCertificates()"           />
+          <menuitem label="&DistrustAllCertificates;" oncommand="Pers_statusbar.distrusts_all_certificates()" />
+		  <menuitem label="&Help;"                    oncommand="Pers_statusbar.openHelp()"                   />
 		  <!-- TODO enable once all strings have been localized
 		  <menuitem label="&About;" oncommand="Pers_statusbar.open_about_dialog()"/>
 		  -->
@@ -58,9 +59,10 @@
                 <!--<menuitem label="&ReportAttack;"      oncommand="Pers_report.report_attack()"             />-->
       			<menuitem label="&Addtowhitelist;"    oncommand="Pers_whitelist_dialog.add_to_whitelist()"/>
       			<menuseparator/>
-      			<menuitem label="&Preferences;" oncommand="Pers_statusbar.open_preferences_dialog()"/>
-      			<menuitem label="&ViewCertificateStore;" oncommand="Pers_statusbar.openCertificates()"/>
-      			<menuitem label="&Help;" oncommand="Pers_statusbar.openHelp()"/>
+      			<menuitem label="&Preferences;"             oncommand="Pers_statusbar.open_preferences_dialog()"    />
+      			<menuitem label="&ViewCertificateStore;"    oncommand="Pers_statusbar.openCertificates()"           />
+                <menuitem label="&DistrustAllCertificates;" oncommand="Pers_statusbar.distrusts_all_certificates()" />
+      			<menuitem label="&Help;"                    oncommand="Pers_statusbar.openHelp()"                   />
       			<!-- TODO enable once all strings have been localized
       			<menuitem label="&About;" oncommand="Pers_statusbar.open_about_dialog()"/>
       			-->
@@ -77,9 +79,10 @@
      			<!--<menuitem label="&ReportAttack;"      oncommand="Pers_report.report_attack()"             />-->
       			<menuitem label="&Addtowhitelist;"    oncommand="Pers_whitelist_dialog.add_to_whitelist()"/>
       			<menuseparator/>
-      			<menuitem label="&Preferences;" oncommand="Pers_statusbar.open_preferences_dialog()"/>
-      			<menuitem label="&ViewCertificateStore;" oncommand="Pers_statusbar.openCertificates()"/>
-      			<menuitem label="&Help;" oncommand="Pers_statusbar.openHelp()"/>
+      			<menuitem label="&Preferences;"             oncommand="Pers_statusbar.open_preferences_dialog()"    />
+      			<menuitem label="&ViewCertificateStore;"    oncommand="Pers_statusbar.openCertificates()"           />
+                <menuitem label="&DistrustAllCertificates;" oncommand="Pers_statusbar.distrusts_all_certificates()" />
+      			<menuitem label="&Help;"                    oncommand="Pers_statusbar.openHelp()"                   />
       			<!-- TODO enable once all strings have been localized
       			<menuitem label="&About;" oncommand="Pers_statusbar.open_about_dialog()"/>
       			-->
diff --git a/plugin/chrome/locale/de/dialogs.dtd b/plugin/chrome/locale/de/dialogs.dtd
index 29452eb..38497d1 100644
--- a/plugin/chrome/locale/de/dialogs.dtd
+++ b/plugin/chrome/locale/de/dialogs.dtd
@@ -50,6 +50,7 @@
 <!ENTITY ForceNotaryCheck "Nachfrage bei Notaren erzwingen">
 <!ENTITY ReportAttack "Angriff melden">
 <!ENTITY ViewCertificateStore "Zertifikate anzeigen">
+<!ENTITY DistrustAllCertificates "Allen Zertifikaten misstrauen">
 <!ENTITY About "Über Perspectives">
 <!ENTITY AboutMainCredit "Perspectives Client - Erweiterung für Firefox von Dan Wendlandt">
 <!ENTITY ContributorTitle "Mitwirkende">
diff --git a/plugin/chrome/locale/en-US/dialogs.dtd b/plugin/chrome/locale/en-US/dialogs.dtd
index eb40ba1..7c0c517 100644
--- a/plugin/chrome/locale/en-US/dialogs.dtd
+++ b/plugin/chrome/locale/en-US/dialogs.dtd
@@ -51,6 +51,7 @@
 <!ENTITY ForceNotaryCheck "Force Notary Check">
 <!ENTITY ReportAttack "Report Attack">
 <!ENTITY ViewCertificateStore "View Certificate Store">
+<!ENTITY DistrustAllCertificates "Distrust all certificates">
 <!ENTITY About "About Perspectives">
 <!ENTITY AboutMainCredit "Perspectives Client - Firefox Extension, by Dan Wendlandt">
 <!ENTITY ContributorTitle "Contributors">
diff --git a/plugin/chrome/locale/es-MX/dialogs.dtd b/plugin/chrome/locale/es-MX/dialogs.dtd
index 0d3a1fb..b11dfc9 100644
--- a/plugin/chrome/locale/es-MX/dialogs.dtd
+++ b/plugin/chrome/locale/es-MX/dialogs.dtd
@@ -55,6 +55,7 @@
 <!ENTITY ReportAttack "Reportar Ataque">
 <!ENTITY ViewCertificateStore "Ver Lista de Certificados">
 <!-- TODO: these new strings need translation -->
+<!ENTITY DistrustAllCertificates "Distrust all certificates">
 <!ENTITY About "About Perspectives">
 <!ENTITY AboutMainCredit "Perspectives Client - Firefox Extension, by Dan Wendlandt">
 <!ENTITY ContributorTitle "Contributors">
diff --git a/plugin/chrome/locale/fi/dialogs.dtd b/plugin/chrome/locale/fi/dialogs.dtd
index b865375..ec5ffe8 100644
--- a/plugin/chrome/locale/fi/dialogs.dtd
+++ b/plugin/chrome/locale/fi/dialogs.dtd
@@ -55,6 +55,7 @@
 <!ENTITY ReportAttack "Raportoi hyökkäys">
 <!ENTITY ViewCertificateStore "Näytä sertifikaattivarasto">
 <!-- TODO: Please translate! -->
+<!ENTITY DistrustAllCertificates "Distrust all certificates">
 <!ENTITY About "About Perspectives">
 <!ENTITY AboutMainCredit "Perspectives Client - Firefox Extension, by Dan Wendlandt">
 <!ENTITY ContributorTitle "Contributors">
diff --git a/plugin/chrome/locale/fr/dialogs.dtd b/plugin/chrome/locale/fr/dialogs.dtd
index 1bd5399..e65c19a 100644
--- a/plugin/chrome/locale/fr/dialogs.dtd
+++ b/plugin/chrome/locale/fr/dialogs.dtd
@@ -55,6 +55,7 @@
 <!ENTITY ReportAttack "Rapporter une attaque">
 <!ENTITY ViewCertificateStore "Afficher la liste des certificats">
 <!-- TODO: these new strings need translation -->
+<!ENTITY DistrustAllCertificates "Distrust all certificates">
 <!ENTITY About "About Perspectives">
 <!ENTITY AboutMainCredit "Perspectives Client - Firefox Extension, by Dan Wendlandt">
 <!ENTITY ContributorTitle "Contributors">
diff --git a/plugin/chrome/locale/nl/dialogs.dtd b/plugin/chrome/locale/nl/dialogs.dtd
index 419b5eb..54d714b 100644
--- a/plugin/chrome/locale/nl/dialogs.dtd
+++ b/plugin/chrome/locale/nl/dialogs.dtd
@@ -1,4 +1,5 @@
 <!-- This file contains localized strings for Perspectives .xul files. -->
+<!-- TODO translate! -->
 <!ENTITY NotaryResults "Notary Results">
 <!ENTITY ViewNotaryResults "View Notary Results">
 <!ENTITY Preferences "Preferences">
@@ -12,11 +13,9 @@
 <!ENTITY ManualConfiguration "Manual Configuration">
 <!ENTITY Percentageofnotariesthatmustagree "Percentage of notaries that must agree (quorum percentage): ">
 <!ENTITY Lengthoftimequorummustbeachieved  "Days of continuous agreement required (quorum duration): "   >
-<!-- TODO translate -->
 <!ENTITY QueryTimeout                      "Timeout for querying notaries (in milliseconds): ">
 <!ENTITY QueryRetries                      "Number of retries if a timeout has exceeded: "    >
 <!ENTITY MaxCacheAge                       "Cache duration for notary results (in seconds):"  >
-<!-- -->
 <!ENTITY OverridingFirefoxSecurityErrors "Overriding Firefox Security Errors">
 <!ENTITY AllowPerspectivestoautomaticallyoverridesecurityerrors "Allow Perspectives to automatically override security errors">
 <!ENTITY PermanentlytrustcertificatesvalidatedbyPerspectives "Permanently trust certificates validated by Perspectives">
@@ -24,9 +23,7 @@
 <!ENTITY ContactNotariesforallHTTPSsites "Contact Notaries for all HTTPS sites">
 <!ENTITY ContactNotariesonlywhenawebsitescertificatecausesasecurityerror "Contact Notaries only when a website's certificate causes a security error">
 <!ENTITY AlwaysasktheuserbeforecontactingNotaries "Always ask before contacting Notaries">
-<!-- TODO translate -->
 <!ENTITY ContactNotariesInPrivateBrowsingMode "Also contact notaries while in private browsing mode">
-<!-- -->
 <!ENTITY Certificates "Certificates">
 <!ENTITY Servers "Notary Servers">
 <!ENTITY Help "Help">
@@ -54,6 +51,7 @@
 <!ENTITY ForceNotaryCheck "Force Notary Check">
 <!ENTITY ReportAttack "Report Attack">
 <!ENTITY ViewCertificateStore "View Certificate Store">
+<!ENTITY DistrustAllCertificates "Distrust all certificates">
 <!ENTITY About "About Perspectives">
 <!ENTITY AboutMainCredit "Perspectives Client - Firefox Extension, by Dan Wendlandt">
 <!ENTITY ContributorTitle "Contributors">
diff --git a/plugin/chrome/locale/pl/dialogs.dtd b/plugin/chrome/locale/pl/dialogs.dtd
index de6b9da..75cfab3 100644
--- a/plugin/chrome/locale/pl/dialogs.dtd
+++ b/plugin/chrome/locale/pl/dialogs.dtd
@@ -55,6 +55,9 @@
 <!ENTITY ForceNotaryCheck "Wymuś sprawdzenie notarialne">
 <!ENTITY ReportAttack "Zgłoś atak">
 <!ENTITY ViewCertificateStore "Zobacz zapisane certyfikaty">
+<!-- TODO translate -->
+<!ENTITY DistrustAllCertificates "Distrust all certificates">
+<!-- -->
 <!ENTITY About "O Perspectives">
 <!ENTITY AboutMainCredit "Klient Perspectives - rozszerzenie Dana Wendlandta do Firefoxa">
 <!ENTITY ContributorTitle "Współautorzy">
diff --git a/plugin/chrome/locale/zh-CN/dialogs.dtd b/plugin/chrome/locale/zh-CN/dialogs.dtd
index 9ae8762..307c442 100644
--- a/plugin/chrome/locale/zh-CN/dialogs.dtd
+++ b/plugin/chrome/locale/zh-CN/dialogs.dtd
@@ -55,6 +55,7 @@
 <!ENTITY ReportAttack "报告攻击">
 <!ENTITY ViewCertificateStore "查看证书">
 <!-- TODO: these new strings need translation -->
+<!ENTITY DistrustAllCertificates "Distrust all certificates">
 <!ENTITY About "About Perspectives">
 <!ENTITY AboutMainCredit "Perspectives Client - Firefox Extension, by Dan Wendlandt">
 <!ENTITY ContributorTitle "Contributors">

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mozext/perspectives-extension.git



More information about the Pkg-mozext-commits mailing list