[tbb-commits] [tor-browser] branch tor-browser-91.13.0esr-11.5-1 updated: fixup! Bug 30237: Add v3 onion services client authentication prompt

gitolite role git at cupani.torproject.org
Wed Oct 12 23:22:45 UTC 2022


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

richard pushed a commit to branch tor-browser-91.13.0esr-11.5-1
in repository tor-browser.

The following commit(s) were added to refs/heads/tor-browser-91.13.0esr-11.5-1 by this push:
     new 12b66ca40d05 fixup! Bug 30237: Add v3 onion services client authentication prompt
12b66ca40d05 is described below

commit 12b66ca40d059552825714fd7cfb7563bb59ae45
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 | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/browser/components/onionservices/content/authPrompt.js b/browser/components/onionservices/content/authPrompt.js
index df609df44e49..1cc298a89a02 100644
--- a/browser/components/onionservices/content/authPrompt.js
+++ b/browser/components/onionservices/content/authPrompt.js
@@ -16,7 +16,7 @@ const OnionAuthPrompt = (function() {
     this._browser = aBrowser;
     this._failedURI = aFailedURI;
     this._reasonForPrompt = aReason;
-    this._onionName = aOnionName;
+    this._onionHostname = aOnionName;
   }
 
   OnionServicesAuthPrompt.prototype = {
@@ -93,7 +93,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;
@@ -177,10 +177,14 @@ 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)
+        let isPermanent = checkboxElem && checkboxElem.checked;
+        torController.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