[tbb-commits] [tor-browser] branch tor-browser-102.3.0esr-12.0-2 updated: fixup! Bug 30237: Add v3 onion services client authentication prompt

gitolite role git at cupani.torproject.org
Wed Oct 12 21:31:52 UTC 2022


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

richard pushed a commit to branch tor-browser-102.3.0esr-12.0-2
in repository tor-browser.

The following commit(s) were added to refs/heads/tor-browser-102.3.0esr-12.0-2 by this push:
     new 400276c6eba4 fixup! Bug 30237: Add v3 onion services client authentication prompt
400276c6eba4 is described below

commit 400276c6eba41ada1c93acd7f24a3412e1077961
Author: Richard Pospesel <richard at torproject.org>
AuthorDate: Sat Oct 8 04:00:00 2022 +0000

    fixup! Bug 30237: Add v3 onion services client authentication prompt
    
    - strip subdomain off of onion hostname when extracting the onion service id for use with the ONION_CLIENT_AUTH_ADD command
---
 browser/components/onionservices/content/authPrompt.js | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/browser/components/onionservices/content/authPrompt.js b/browser/components/onionservices/content/authPrompt.js
index ba40e9fd464c..f9b92608ed65 100644
--- a/browser/components/onionservices/content/authPrompt.js
+++ b/browser/components/onionservices/content/authPrompt.js
@@ -18,7 +18,7 @@ const OnionAuthPrompt = (function() {
     this._browser = aBrowser;
     this._failedURI = aFailedURI;
     this._reasonForPrompt = aReason;
-    this._onionName = aOnionName;
+    this._onionHostname = aOnionName;
   }
 
   OnionServicesAuthPrompt.prototype = {
@@ -103,7 +103,7 @@ const OnionAuthPrompt = (function() {
         descElem.appendChild(span);
         span = xulDoc.createElementNS(kHTMLNS, "span");
         span.id = OnionAuthUtil.domid.onionNameSpan;
-        span.textContent = this._onionName;
+        span.textContent = this._onionHostname;
         descElem.appendChild(span);
         span = xulDoc.createElementNS(kHTMLNS, "span");
         span.textContent = suffix;
@@ -196,11 +196,15 @@ const OnionAuthPrompt = (function() {
           console.error(controllerFailureMsg, aError);
           this.show(controllerFailureMsg);
         });
-        let onionAddr = this._onionName.toLowerCase().replace(/\.onion$/, "");
+        // ^(subdomain.)*onionserviceid.onion$ (case-insensitive)
+        const onionServiceIdRegExp = /^(.*\.)*(?<onionServiceId>[a-z2-7]{56})\.onion$/i;
+        // match() will return null on bad match, causing throw
+        const onionServiceId = this._onionHostname.match(onionServiceIdRegExp).groups.onionServiceId.toLowerCase();
+
         let checkboxElem = this._getCheckboxElement();
         let isPermanent = checkboxElem && checkboxElem.checked;
         torController
-          .onionAuthAdd(onionAddr, base64key, isPermanent)
+          .onionAuthAdd(onionServiceId, base64key, isPermanent)
           .then(aResponse => {
             // Success! Reload the page.
             this._browser.sendMessageToActor(

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the tbb-commits mailing list