Closed Bug 1576109 Opened 3 months ago Closed 3 months ago

Some cookies still been blocked if the ETP is off

Categories

(Core :: Privacy: Anti-Tracking, defect, P1)

defect

Tracking

()

RESOLVED FIXED
mozilla70
Tracking Status
firefox-esr60 --- unaffected
firefox-esr68 --- unaffected
firefox69 --- unaffected
firefox70 + fixed

People

(Reporter: timhuang, Assigned: ehsan)

References

(Regression)

Details

(Keywords: regression)

Attachments

(2 files)

STR:

  1. Open the browser toolbox
  2. Open youtube.com and disable the ETP by TP switch on Protection channel
  3. Wait for the page gets stable
  4. Reload the page and inspect the console tag in browser toolbox. (Better to clear the console first)

Expected:
No messages related to blocked cookies.

Actual:
A message shows that cookies been blocked due to content blocking is enabled.

It not always happens, but quite often. And the onContentBlockingEvent is also fired for this.

The stack trace of the parent process when the blocking happens

#0 0x00007fffea2ddfab in mozilla::AntiTrackingCommon::NotifyBlockingDecision(nsIChannel*, mozilla::AntiTrackingCommon::BlockingDecision, unsigned int) (aChannel=0x7fffdca25050, aDecision=mozilla::AntiTrackingCommon::BlockingDecision::eBlock, aRejectedReason=536870912) at /home/timhuang/Project/gecko-dev/toolkit/components/antitracking/AntiTrackingCommon.cpp:2000
#1 0x00007fffe65370ad in nsCookieService::NotifyRejected(nsIURI*, nsIChannel*, unsigned int, CookieOperation) (this=<optimized out>, aChannel=0x7fffdca25050, aRejectedReason=<optimized out>, aOperation=OPERATION_READ, aHostURI=<optimized out>) at /home/timhuang/Project/gecko-dev/netwerk/cookie/nsCookieService.cpp:2255
#2 0x00007fffe65370ad in nsCookieService::GetCookiesForURI(nsIURI*, nsIChannel*, bool, bool, bool, unsigned int, bool, bool, bool, mozilla::OriginAttributes const&, nsTArray<nsCookie*>&) (this=<optimized out>, aHostURI=0x7fffc8a15100, aChannel=0x7fffdca25050, aIsForeign=<optimized out>, aIsTrackingResource=<optimized out>, aFirstPartyStorageAccessGranted=<optimized out>, aRejectedReason=536870912, aIsSafeTopLevelNav=<optimized out>, aIsSameSiteForeign=<optimized out>, aHttpBound=<optimized out>, aOriginAttrs=..., aCookieList=...) at /home/timhuang/Project/gecko-dev/netwerk/cookie/nsCookieService.cpp:3038
#3 0x00007fffe6531243 in nsCookieService::GetCookieStringInternal(nsIURI*, nsIChannel*, bool, bool, bool, unsigned int, bool, bool, bool, mozilla::OriginAttributes const&, nsTSubstring<char>&) (this=0x7fffffffb9a8, aHostURI=0x7fffc8a15100, aChannel=0x7ffff7fd1ab0, aIsForeign=<optimized out>, aIsTrackingResource=<optimized out>, aFirstPartyStorageAccessGranted=<optimized out>, aRejectedReason=536870912, aIsSafeTopLevelNav=<optimized out>, aIsSameSiteForeign=<optimized out>, aHttpBound=<optimized out>, aOriginAttrs=..., aCookieString=...) at /home/timhuang/Project/gecko-dev/netwerk/cookie/nsCookieService.cpp:3164
#4 0x00007fffe65310f7 in nsCookieService::GetCookieStringCommon(nsIURI*, nsIChannel*, bool, nsTSubstring<char>&) (this=0x7fffd9b84820, aHostURI=0x7fffc8a15100, aChannel=0x7fffdca25050, aHttpBound=<optimized out>, aCookie=...) at /home/timhuang/Project/gecko-dev/netwerk/cookie/nsCookieService.cpp:2035
#5 0x00007fffe681f441 in mozilla::net::HttpBaseChannel::AddCookiesToRequest() (this=0x7fffdca25000) at /home/timhuang/Project/gecko-dev/netwerk/protocol/http/HttpBaseChannel.cpp:3071
#6 0x00007fffe687503e in mozilla::net::nsHttpChannel::PrepareToConnect() (this=0x7fffdca25000) at /home/timhuang/Project/gecko-dev/netwerk/protocol/http/nsHttpChannel.cpp:440
#7 0x00007fffe6892950 in mozilla::net::nsHttpChannel::ContinueBeginConnectWithResult() (this=0x7fffdca25000) at /home/timhuang/Project/gecko-dev/netwerk/protocol/http/nsHttpChannel.cpp:6966
#8 0x00007fffe6892add in mozilla::net::nsHttpChannel::BeginConnectActual() (this=0x7fffdca25000) at /home/timhuang/Project/gecko-dev/netwerk/protocol/http/nsHttpChannel.cpp:6820
#9 0x00007fffe68c93a8 in mozilla::net::nsHttpChannel::BeginConnect()::$_22::operator()() const::{lambda()#1}::operator()() const (this=0x7fffdca25000)
at /home/timhuang/Project/gecko-dev/netwerk/protocol/http/nsHttpChannel.cpp:6731
#10 0x00007fffe68c93a8 in mozilla::net::nsHttpChannel::BeginConnect()::$_22::operator()() const (this=0x7fffd501ff50) at /home/timhuang/Project/gecko-dev/netwerk/protocol/http/nsHttpChannel.cpp:6731
#11 0x00007fffe68c93a8 in std::_Function_handler<void (), mozilla::net::nsHttpChannel::BeginConnect()::$_22>::_M_invoke(std::_Any_data const&) (__functor=...)
at /usr/lib/gcc/x86_64-linux-gnu/7.4.0/../../../../include/c++/7.4.0/bits/std_function.h:316
#12 0x00007fffe69231be in std::function<void ()>::operator()() const (this=0x7fffce57f488) at /usr/lib/gcc/x86_64-linux-gnu/7.4.0/../../../../include/c++/7.4.0/bits/std_function.h:706
#13 0x00007fffe69231be in mozilla::net::(anonymous namespace)::CallbackHolder::Exec() const (this=0x7fffce57f478) at /home/timhuang/Project/gecko-dev/netwerk/url-classifier/AsyncUrlChannelClassifier.cpp:479
#14 0x00007fffe69231be in mozilla::net::(anonymous namespace)::FeatureTask::CompleteClassification() (this=<optimized out>)
at /home/timhuang/Project/gecko-dev/netwerk/url-classifier/AsyncUrlChannelClassifier.cpp:676
#15 0x00007fffe69231be in mozilla::net::AsyncUrlChannelClassifier::CheckChannel(nsIChannel*, std::function<void ()>&&)::$_0::operator()() const::{lambda()#1}::operator()() const (this=<optimized out>)
at /home/timhuang/Project/gecko-dev/netwerk/url-classifier/AsyncUrlChannelClassifier.cpp:797
#16 0x00007fffe69231be in mozilla::detail::RunnableFunction<mozilla::net::AsyncUrlChannelClassifier::CheckChannel(nsIChannel*, std::function<void ()>&&)::$_0::operator()() const::{lambda()#1}>::Run() (this=<optimized out>) at /home/timhuang/Project/gecko-dev/obj-ff/dist/include/nsThreadUtils.h:564
#17 0x00007fffe63d3327 in nsThread::ProcessNextEvent(bool, bool*) (this=0x7ffff6a8fe30, aMayWait=<optimized out>, aResult=0x7fffffffc647) at /home/timhuang/Project/gecko-dev/xpcom/threads/nsThread.cpp:1225
#18 0x00007fffe63d5245 in NS_ProcessNextEvent(nsIThread*, bool) (aThread=0x7fffffffb9a8, aMayWait=<optimized out>) at /home/timhuang/Project/gecko-dev/xpcom/threads/nsThreadUtils.cpp:486
#19 0x00007fffe6a105db in mozilla::ipc::MessagePump::Run(base::MessagePump::Delegate*) (this=0x7fffe089e5c0, aDelegate=0x7fffe0834d40) at /home/timhuang/Project/gecko-dev/ipc/glue/MessagePump.cpp:110
#20 0x00007fffe699c2c5 in MessageLoop::RunInternal() (this=0x7fffe0834d40) at /home/timhuang/Project/gecko-dev/ipc/chromium/src/base/message_loop.cc:315
#21 0x00007fffe699c21e in MessageLoop::RunHandler() (this=0x7fffe0834d40) at /home/timhuang/Project/gecko-dev/ipc/chromium/src/base/message_loop.cc:308
#22 0x00007fffe699c21e in MessageLoop::Run() (this=0x7fffe0834d40) at /home/timhuang/Project/gecko-dev/ipc/chromium/src/base/message_loop.cc:290
#23 0x00007fffe91f1f37 in nsBaseAppShell::Run() (this=0x7fffdfa35430) at /home/timhuang/Project/gecko-dev/widget/nsBaseAppShell.cpp:137
#24 0x00007fffea4209cf in nsAppStartup::Run() (this=0x7fffe08ce1a0) at /home/timhuang/Project/gecko-dev/toolkit/components/startup/nsAppStartup.cpp:276
#25 0x00007fffea507672 in XREMain::XRE_mainRun() (this=<optimized out>) at /home/timhuang/Project/gecko-dev/toolkit/xre/nsAppRunner.cpp:4569
#26 0x00007fffea5080de in XREMain::XRE_main(int, char**, mozilla::BootstrapConfig const&) (this=0x7fffffffc9a8, argc=<optimized out>, argv=<optimized out>, aConfig=...)
at /home/timhuang/Project/gecko-dev/toolkit/xre/nsAppRunner.cpp:4707
#27 0x00007fffea5087af in XRE_main(int, char**, mozilla::BootstrapConfig const&) (argc=1, argv=0x7ffff7fd1ab0, aConfig=...) at /home/timhuang/Project/gecko-dev/toolkit/xre/nsAppRunner.cpp:4788
#28 0x00005555555863ba in do_main(int, char**, char**) (argc=<optimized out>, argv=<optimized out>, envp=<optimized out>) at /home/timhuang/Project/gecko-dev/browser/app/nsBrowserApp.cpp:213
#29 0x00005555555863ba in main(int, char**, char**) (argc=<optimized out>, argv=<optimized out>, envp=<optimized out>) at /home/timhuang/Project/gecko-dev/browser/app/nsBrowserApp.cpp:295

Ehsan, would you like to take a look at this?

Component: Tracking Protection → Privacy: Anti-Tracking
Flags: needinfo?(ehsan)
Product: Firefox → Core

I think this is a dupe of bug 1540117 which I coincidentally fixed yesterday, but I will double check...

Flags: needinfo?(ehsan)

No this is actually a regression from bug 1572240.

Assignee: nobody → ehsan
Has Regression Range: --- → yes
Has STR: --- → yes
Keywords: regression
Regressed by: 1572240
Flags: needinfo?(ehsan)
Status: NEW → ASSIGNED
Priority: -- → P1

This bug happens because during HTTP redirects, we lose HttpBaseChannel::mContentBlockingAllowListPrincipal on the post-redirect HTTP channel, so when performing content blocking allow list checks on those channels afterwards, we mistakenly will think that the channels are coming from documents not on the content blocking allow list.

Flags: needinfo?(ehsan)
Pushed by eakhgari@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/f10c829937e8
Ensure that the content blocking allow list principal is set correctly during HTTP redirects; r=baku,dragana
Status: ASSIGNED → RESOLVED
Closed: 3 months ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla70
You need to log in before you can comment on or make changes to this bug.