[tor-commits] [Git][tpo/applications/tor-browser][tor-browser-102.7.0esr-12.0-1] fixup! Bug 10760: Integrate TorButton to TorBrowser core

Richard Pospesel (@richard) git at gitlab.torproject.org
Wed Feb 1 15:02:15 UTC 2023



Richard Pospesel pushed to branch tor-browser-102.7.0esr-12.0-1 at The Tor Project / Applications / Tor Browser


Commits:
0bf68ade by Pier Angelo Vendrame at 2023-02-01T15:02:12+00:00
fixup! Bug 10760: Integrate TorButton to TorBrowser core

Bug 41572: Check for userContextId also in the circuit display


(cherry picked from commit e4496e7ab626686e07f7d93093b81247e7e26118)
- - - - -


1 changed file:

- toolkit/torbutton/chrome/content/tor-circuit-display.js


Changes:

=====================================
toolkit/torbutton/chrome/content/tor-circuit-display.js
=====================================
@@ -306,21 +306,32 @@ let createTorCircuitDisplay = (function() {
   // Obtains the circuit used by the given browser.
   let currentCircuitData = function(browser) {
     if (browser) {
-      let firstPartyDomain = getDomainForBrowser(browser);
-      let domain = firstPartyDomain || "--unknown--";
-      let domainMap = browserToCredentialsMap.get(browser);
-      let credentials = domainMap && domainMap.get(domain);
+      const firstPartyDomain = getDomainForBrowser(browser);
+      const userContextId =
+        browser.contentPrincipal.originAttributes.userContextId;
+      const key = firstPartyDomain
+        ? `${firstPartyDomain}:${userContextId}`
+        : "--unknown--";
+      const credentialMap = browserToCredentialsMap.get(browser);
+      const credentials = credentialMap && credentialMap.get(key);
       if (credentials) {
-        let [SOCKS_username, SOCKS_password] = credentials;
-        let nodeData = credentialsToNodeDataMap.get(
+        const [SOCKS_username, SOCKS_password] = credentials;
+        const nodeData = credentialsToNodeDataMap.get(
           `${SOCKS_username}|${SOCKS_password}`
         );
-        let domain = SOCKS_username;
-        if (browser.documentURI.host.endsWith(".tor.onion")) {
-          const service = Cc[
-            "@torproject.org/onion-alias-service;1"
-          ].getService(Ci.IOnionAliasService);
-          domain = service.getOnionAlias(browser.documentURI.host);
+        let domain = firstPartyDomain;
+        try {
+          if (browser.documentURI.host.endsWith(".tor.onion")) {
+            const service = Cc[
+              "@torproject.org/onion-alias-service;1"
+            ].getService(Ci.IOnionAliasService);
+            domain = service.getOnionAlias(browser.documentURI.host);
+          }
+        } catch (e) {
+          logger.eclog(
+            3,
+            `[circuit display] Cannot verify if we are visiting an onion alias: ${e.message}\n${e.stack}`
+          );
         }
         return { domain, nodeData };
       }



View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser/-/commit/0bf68aded94ffeb8b7b106efe763203bf9b70468

-- 
View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser/-/commit/0bf68aded94ffeb8b7b106efe763203bf9b70468
You're receiving this email because of your account on gitlab.torproject.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.torproject.org/pipermail/tor-commits/attachments/20230201/2d8d68b4/attachment-0001.htm>


More information about the tor-commits mailing list