ma1 pushed to branch mullvad-browser-149.0a1-16.0-2 at The Tor Project / Applications / Mullvad Browser Commits: 6a686c89 by hackademix at 2026-03-31T15:49:38+02:00 BB 44801: Redact onion origins from Location.ancestorOrigins. - - - - - 1 changed file: - docshell/base/CanonicalBrowsingContext.cpp Changes: ===================================== docshell/base/CanonicalBrowsingContext.cpp ===================================== @@ -41,6 +41,7 @@ #include "mozilla/StaticPrefs_browser.h" #include "mozilla/StaticPrefs_docshell.h" #include "mozilla/StaticPrefs_fission.h" +#include "mozilla/StaticPrefs_network.h" #include "mozilla/StaticPrefs_security.h" #include "mozilla/glean/DomMetrics.h" #include "nsILayoutHistoryState.h" @@ -3695,6 +3696,10 @@ void CanonicalBrowsingContext::CreateRedactedAncestorOriginsList( // 11. Let masked be false. bool masked = false; + // Tor-specific, not in spec: + // we want to redact cross-origin onions if hideOnionSource is true. + bool redactOnions = StaticPrefs::network_http_referer_hideOnionSource(); + if (referrerPolicy == ReferrerPolicy::No_referrer) { // 12. If referrerPolicy is "no-referrer", then set masked to true. masked = true; @@ -3705,6 +3710,12 @@ void CanonicalBrowsingContext::CreateRedactedAncestorOriginsList( // origin is not same origin with innerDoc's origin, then set masked to // true. masked = true; + } else if (redactOnions && ancestorWGP->DocumentPricipal()->GetIsOnion() && + !ancestorWGP->DocumentPrincipal()->Equals( + aThisDocumentPrincipal)) { + // Tor-specific, not in spec: + // mask parent origin if it's an onion it's different than this document's. + masked = true; } if (masked) { @@ -3721,6 +3732,13 @@ void CanonicalBrowsingContext::CreateRedactedAncestorOriginsList( // 16. For each ancestorOrigin of ancestorOrigins: for (const auto& ancestorOrigin : parentAncestorOriginsList) { + // Tor-specific, not in spec: + // Redact any ancestor onion origin different than this document's origin. + if (redactOnions && ancestorOrigin && ancestorOrigin->GetIsOnion() && + !ancestorOrigin->Equals(aThisDocumentPrincipal)) { + ancestorPrincipals.AppendElement(nullptr); + continue; + } // 16.1 if masked is true if (masked && ancestorOrigin && ancestorOrigin->Equals(ancestorWGP->DocumentPrincipal())) { View it on GitLab: https://gitlab.torproject.org/tpo/applications/mullvad-browser/-/commit/6a68... -- View it on GitLab: https://gitlab.torproject.org/tpo/applications/mullvad-browser/-/commit/6a68... You're receiving this email because of your account on gitlab.torproject.org. Manage all notifications: https://gitlab.torproject.org/-/profile/notifications | Help: https://gitlab.torproject.org/help
participants (1)
-
ma1 (@ma1)