Closed Bug 1541339 Opened 5 years ago Closed 5 years ago

Web socket in service worker does not send domain cookies

Categories

(Core :: DOM: Service Workers, defect, P1)

67 Branch
defect

Tracking

()

VERIFIED FIXED
mozilla68
Tracking Status
firefox-esr60 --- unaffected
firefox66 --- unaffected
firefox67 + verified
firefox68 + verified

People

(Reporter: dkukartsev, Assigned: baku)

References

(Regression)

Details

(Keywords: regression)

Attachments

(2 files)

User Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36

Steps to reproduce:

set test cookie
create service worker
create web socket in service worker

Actual results:

http request for web socket does not pass cookies

Expected results:

http request for web socket pass cookies

Simple test: https://xdfav.com/test.html
Creates 2 web sockets one under window environment(left column) and another under service worker environment(right column).
Web sockets are recreated, web socket server sends cookies it receives and close connection.

In firefox 65 and in google chrome web socket under service worker pass cookies in http phase.
You can see that firefox beta does not send cookies for web socket under service worker.

Component: Untriaged → DOM: Service Workers
Product: Firefox → Core

We're seeing this in our application. I can reproduce dkukartsev's test case. This seems like a fairly serious regression. Can the priority be upped?

I've used mozregression to find out this changeset [1] might cause this issue.
:baku, could you take a look?

10:44.59 INFO: Narrowed inbound regression window from [7452e8eb, 3cddc7cd] (4 builds) to [615a12a9, 3cddc7cd] (2 builds) (~1 steps left)
10:44.59 INFO: No more inbound revisions, bisection finished.
10:44.59 INFO: Last good revision: 615a12a9276839868bef0858f3fb535a04106295
10:44.59 INFO: First bad revision: 3cddc7cd4da5fcd26b93becb55a028621ab68f64

[1] https://hg.mozilla.org/integration/autoland/pushloghtml?fromchange=615a12a9276839868bef0858f3fb535a04106295&tochange=3cddc7cd4da5fcd26b93becb55a028621ab68f64

Flags: needinfo?(amarchesini)
Assignee: nobody → amarchesini
Flags: needinfo?(amarchesini)
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
Has Regression Range: --- → yes
Has STR: --- → yes
Priority: P3 → P1
Pushed by amarchesini@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/daeba572395d
WebSocket channel should use the correct CookieSettings in workers, r=Ehsan

Push with failures: https://treeherder.mozilla.org/#/jobs?repo=autoland&resultStatus=testfailed%2Cbusted%2Cexception&group_state=expanded&revision=daeba572395db4aa51076a85d1b908405152d50a&searchStr=xpc&selectedJob=242952482

Failure log: https://treeherder.mozilla.org/logviewer.html#/jobs?job_id=242952482&repo=autoland&lineNumber=1874

Backout link: https://hg.mozilla.org/integration/autoland/rev/c74119d8621b12139fa867595600e0c6e9d6af0c

[task 2019-04-26T18:24:45.031Z] 18:24:45 INFO - TEST-START | netwerk/test/unit/test_dns_proxy_bypass.js
[task 2019-04-26T18:24:45.297Z] 18:24:45 WARNING - TEST-UNEXPECTED-FAIL | netwerk/test/unit/test_dns_proxy_bypass.js | xpcshell return code: 0
[task 2019-04-26T18:24:45.298Z] 18:24:45 INFO - TEST-INFO took 266ms
[task 2019-04-26T18:24:45.298Z] 18:24:45 INFO - >>>>>>>
[task 2019-04-26T18:24:45.299Z] 18:24:45 INFO - PID 6436 | [6436, Main Thread] WARNING: NS_ENSURE_SUCCESS(rv, NS_ERROR_UNEXPECTED) failed with result 0x80004005: file /builds/worker/workspace/build/src/extensions/cookie/nsPermissionManager.cpp, line 1026
[task 2019-04-26T18:24:45.299Z] 18:24:45 INFO - PID 6436 | [6436, Main Thread] WARNING: Couldn't get the user appdata directory. Crash events may not be produced.: file /builds/worker/workspace/build/src/toolkit/crashreporter/nsExceptionHandler.cpp, line 2528
[task 2019-04-26T18:24:45.300Z] 18:24:45 INFO - PID 6436 | Couldn't convert chrome URL: chrome://branding/locale/brand.properties
[task 2019-04-26T18:24:45.300Z] 18:24:45 INFO - (xpcshell/head.js) | test MAIN run_test pending (1)
[task 2019-04-26T18:24:45.301Z] 18:24:45 INFO - NS_ERROR_XPC_CANT_GET_PARAM_IFACE_INFO: Cannot find interface information for parameter arg 3 [nsIWebSocketChannel.initLoadInfo]
[task 2019-04-26T18:24:45.302Z] 18:24:45 INFO - run_test@/builds/worker/workspace/build/tests/xpcshell/tests/netwerk/test/unit/test_dns_proxy_bypass.js:65:8
[task 2019-04-26T18:24:45.307Z] 18:24:45 INFO - _execute_test@/builds/worker/workspace/build/tests/xpcshell/head.js:523:7
[task 2019-04-26T18:24:45.307Z] 18:24:45 INFO - @-e:1:1
[task 2019-04-26T18:24:45.309Z] 18:24:45 INFO - PID 6436 | [6436, Main Thread] WARNING: Could not get the program name for a cubeb stream.: 'NS_SUCCEEDED(rv)', file /builds/worker/workspace/build/src/dom/media/CubebUtils.cpp, line 385
[task 2019-04-26T18:24:45.309Z] 18:24:45 INFO - "CONSOLE_MESSAGE: (info) No chrome package registered for chrome://branding/locale/brand.properties"
[task 2019-04-26T18:24:45.311Z] 18:24:45 INFO - PID 6436 | [6436, Main Thread] WARNING: OOPDeinit() without successful OOPInit(): file /builds/worker/workspace/build/src/toolkit/crashreporter/nsExceptionHandler.cpp, line 3104
[task 2019-04-26T18:24:45.311Z] 18:24:45 INFO - PID 6436 | [6436, Main Thread] WARNING: XPCOM objects created/destroyed from static ctor/dtor: file /builds/worker/workspace/build/src/xpcom/base/nsTraceRefcnt.cpp, line 194
[task 2019-04-26T18:24:45.312Z] 18:24:45 INFO - PID 6436 | [6436, Main Thread] WARNING: XPCOM objects created/destroyed from static ctor/dtor: file /builds/worker/workspace/build/src/xpcom/base/nsTraceRefcnt.cpp, line 194
[task 2019-04-26T18:24:45.312Z] 18:24:45 INFO - PID 6436 | nsStringStats
[task 2019-04-26T18:24:45.312Z] 18:24:45 INFO - PID 6436 | => mAllocCount: 10189
[task 2019-04-26T18:24:45.312Z] 18:24:45 INFO - PID 6436 | => mReallocCount: 0
[task 2019-04-26T18:24:45.312Z] 18:24:45 INFO - PID 6436 | => mFreeCount: 10189
[task 2019-04-26T18:24:45.312Z] 18:24:45 INFO - PID 6436 | => mShareCount: 9141
[task 2019-04-26T18:24:45.312Z] 18:24:45 INFO - PID 6436 | => mAdoptCount: 152
[task 2019-04-26T18:24:45.317Z] 18:24:45 INFO - PID 6436 | => mAdoptFreeCount: 152
[task 2019-04-26T18:24:45.318Z] 18:24:45 INFO - PID 6436 | => Process ID: 6436, Thread ID: 3969732416
[task 2019-04-26T18:24:45.319Z] 18:24:45 INFO - <<<<<<<
[task 2019-04-26T18:24:45.320Z] 18:24:45 INFO - INFO | Result summary:
[task 2019-04-26T18:24:45.322Z] 18:24:45 INFO - INFO | Passed: 265
[task 2019-04-26T18:24:45.323Z] 18:24:45 WARNING - INFO | Failed: 1
[task 2019-04-26T18:24:45.324Z] 18:24:45 WARNING - One or more unittests failed.
[task 2019-04-26T18:24:45.325Z] 18:24:45 INFO - INFO | Todo: 0
[task 2019-04-26T18:24:45.326Z] 18:24:45 INFO - INFO | Retried: 1
[task 2019-04-26T18:24:45.328Z] 18:24:45 INFO - SUITE-END | took 173s
[task 2019-04-26T18:24:45.329Z] 18:24:45 INFO - Node moz-http2 server shutting down ...
[task 2019-04-26T18:24:45.382Z] 18:24:45 ERROR - Return code: 1

Flags: needinfo?(amarchesini)
Flags: needinfo?(amarchesini)
Pushed by amarchesini@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/fd9f15fe0ec1
WebSocket channel should use the correct CookieSettings in workers, r=Ehsan
Status: ASSIGNED → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla68

(In reply to Dorel Luca [:dluca] from comment #9)

https://hg.mozilla.org/mozilla-central/rev/fd9f15fe0ec1

Does this mean ff 67 will be released without fix ?

I think we should definitely backport to 67.

Flags: needinfo?(amarchesini)

(In reply to :Ehsan Akhgari from comment #11)

I think we should definitely backport to 67.

FYI, we only have one beta left to take an uplift

Comment on attachment 9060900 [details]
Bug 1541339 - WebSocket channel should use the correct CookieSettings in workers, r?ehsan

Beta/Release Uplift Approval Request

  • User impact if declined: No cookies are sent to webSocket connections when created in workers
  • Is this code covered by automated tests?: No
  • Has the fix been verified in Nightly?: Yes
  • Needs manual test from QE?: No
  • If yes, steps to reproduce:
  • List of other uplifts needed: None
  • Risk to taking this patch: Low
  • Why is the change risky/not risky? (and alternatives if risky): This patch propagates CookieSettings to WebSocketChannel as we do for other channels. Low risk.
  • String changes made/needed: none
Flags: needinfo?(amarchesini)
Attachment #9060900 - Flags: approval-mozilla-beta?

Comment on attachment 9060900 [details]
Bug 1541339 - WebSocket channel should use the correct CookieSettings in workers, r?ehsan

67 regression, patch is low-risk, uplift accepted for 67 beta 16, thanks.

Attachment #9060900 - Flags: approval-mozilla-beta? → approval-mozilla-beta+

We have a testcase in comment #1, let's have QA also verify the fix.

Flags: qe-verify+

mozilla@ubuntu ~/mozilla-unified beta(+3) $ hg graft -er fd9f15fe0ec1
grafting 538232:fd9f15fe0ec1 "Bug 1541339 - WebSocket channel should use the correct CookieSettings in workers, r=Ehsan"
merging dom/websocket/WebSocket.cpp
merging netwerk/protocol/websocket/BaseWebSocketChannel.cpp
merging netwerk/protocol/websocket/BaseWebSocketChannel.h
merging netwerk/protocol/websocket/nsIWebSocketChannel.idl
merging testing/web-platform/meta/infrastructure/server/dir.ini
merging testing/web-platform/meta/websockets/dir.ini
warning: conflicts while merging testing/web-platform/meta/infrastructure/server/dir.ini! (edit, then use 'hg resolve --mark')
warning: conflicts while merging testing/web-platform/meta/websockets/dir.ini! (edit, then use 'hg resolve --mark')
abort: unresolved conflicts, can't continue
(use 'hg resolve' and 'hg graft --continue')

Flags: needinfo?(amarchesini)
Attached patch m-bSplinter Review
Flags: needinfo?(amarchesini)

Reproduced this issue using Fx 67.0b15.

Confirming the fix on latest Nightly (buildID 20190502220333) and Fx 67.0b16 (buildID 20190502232159).

Status: RESOLVED → VERIFIED
Flags: qe-verify+
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: