tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

commit d5e7c19b494ed3306fb4e745597472f05165a663
parent 9e69bd91cac88025a86f851be3eba8759d8a1a14
Author: smayya <smayya@mozilla.com>
Date:   Fri, 19 Dec 2025 22:57:29 +0000

Bug 2005990 - Skip LNA checks when captive portal is active. r=necko-reviewers,valentin

When a captive portal is in the LOCKED_PORTAL state, automatically
allow local network access requests without prompting the user.

This is implemented by checking the captive portal service state
in nsHttpChannel::UpdateLocalNetworkAccessPermissions before proceeding with normal permission checks.

Rationale: When users are trying to access a captive portal (e.g., in
hotels, airports, cafes), showing additional LNA permission prompts
creates unnecessary friction and confusion. Users need to access the
local network to authenticate with the captive portal.

Differential Revision: https://phabricator.services.mozilla.com/D276454

Diffstat:
Mnetwerk/protocol/http/nsHttpChannel.cpp | 12++++++++++++
1 file changed, 12 insertions(+), 0 deletions(-)

diff --git a/netwerk/protocol/http/nsHttpChannel.cpp b/netwerk/protocol/http/nsHttpChannel.cpp @@ -17,6 +17,7 @@ #include "mozilla/glean/AntitrackingMetrics.h" #include "mozilla/glean/NetwerkMetrics.h" #include "mozilla/glean/NetwerkProtocolHttpMetrics.h" +#include "mozilla/net/CaptivePortalService.h" #include "mozilla/net/CookieServiceParent.h" #include "mozilla/StoragePrincipalHelper.h" @@ -2097,6 +2098,17 @@ LNAPermission nsHttpChannel::UpdateLocalNetworkAccessPermissions( return userPerms; } + // Skip LNA checks if captive portal is active + nsCOMPtr<nsICaptivePortalService> cps = CaptivePortalService::GetSingleton(); + if (cps) { + int32_t state = cps->State(); + if (state == nsICaptivePortalService::LOCKED_PORTAL && + aPermissionType == LOCAL_NETWORK_PERMISSION_KEY) { + userPerms = LNAPermission::Granted; + return userPerms; + } + } + // Step 1. Check for Existing Allow or Deny permission if (nsContentUtils::IsExactSitePermAllow(mLoadInfo->TriggeringPrincipal(), aPermissionType)) {