tor-browser

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

commit 47522c30a59571a3ad9c2abedba4c8fbb30ebd45
parent 34bb180f280bb27ade49bba150cfa5fa3d0694fb
Author: smayya <smayya@mozilla.com>
Date:   Sat, 20 Dec 2025 11:47:39 +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)) {