Closed Bug 1989488 Opened 1 year ago Closed 1 year ago

document.cookie does not contain some (or all) cookies after XHR with HTTP Status 302

Categories

(Core :: Networking: Cookies, defect, P2)

Firefox 143
defect

Tracking

()

RESOLVED FIXED
145 Branch
Tracking Status
firefox-esr140 --- unaffected
firefox143 --- wontfix
firefox144 --- fixed
firefox145 --- fixed

People

(Reporter: mario, Assigned: edgul)

References

(Regression)

Details

(Keywords: regression, Whiteboard: [necko-triaged] [necko-priority-queue])

Attachments

(1 file, 1 external file)

User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:143.0) Gecko/20100101 Firefox/143.0

Steps to reproduce:

  1. Open Firefox v143
  2. In a new tab, navigate to https://cookie-test.eightbitmachine.com
  3. Open the browser's developer tools.
  4. On the page, click the "Fetch Cookies with native fetch" button.
  5. In the console, click the "Storage" tab, then click "Cookies" on the menu. Select "https://cookie-test.eightbitmachine.com/" to view the cookies that have been set.
  6. Click on the "Console" tab. There will be an array dumped to the console log with a single element containing "'. This represents the cookies available via document.cookie.
  7. You can double check this by evaluating document.cookie on the console.
  8. Compare with the results of evaluating cookieStore.getAll().then(console.log)
  9. Click the "Storage" tab in the browser's developer tools
  10. Right click on "https://cookie-test.eightbitmachine.com/" in the Storage menu and select "Delete all"
  11. On the page, change the "HTTP Status Code" input value to 200.
  12. On the page, click the "Fetch Cookies with native fetch" button.
  13. Click on the "Console" tab in the browser's developer tools.
  14. A list of the cookies that were set should be printed in the console log.

Actual results:

document.cookie does not contain any of the cookies that were set, regardless of SameSite, HttpOnly and Secure attributes when set in a Response with an HTTP Status code 302.

However, it appears to function correctly when the Status Code is 200.

Expected results:

document.cookie should contain at least some of the cookies that were set, based on their attributes.

The cookies are present. This verifiable via the browser development tools and using the cookieStore API.

The Bugbug bot thinks this bug should belong to the 'Core::Networking: Cookies' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.

Component: Untriaged → Networking: Cookies
Product: Firefox → Core

FYI Edgul

Severity: -- → S3
Flags: needinfo?(edgul)
Priority: -- → P2
Whiteboard: [necko-triaged] [necko-priority-new]

The recent addition of MaybeInitializeCookieProcessingGuards prevent the sending of cookies over the primary path to the content process. And cookies also seemed to get lost in the fast path, probably due to the redirect that occurred without copying cookies over to the new HttpChannelParent. This patch allows for the copying of the cookies from old to new HttpChannelParent when we take the fast path.

Assignee: nobody → edgul
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
Keywords: regression
Regressed by: 1977221

Set release status flags based on info from the regressing bug 1977221

Flags: needinfo?(edgul)
Duplicate of this bug: 1987884
Whiteboard: [necko-triaged] [necko-priority-new] → [necko-triaged] [necko-priority-queue]
Pushed by valentin.gosu@gmail.com: https://github.com/mozilla-firefox/firefox/commit/d654c4069f32 https://hg.mozilla.org/integration/autoland/rev/1f74ef4b5794 fix 302 set-cookies not being sent to content process. r=cookie-reviewers,necko-reviewers,valentin
See Also: → 1991118
Status: ASSIGNED → RESOLVED
Closed: 1 year ago
Resolution: --- → FIXED
Target Milestone: --- → 145 Branch

The patch landed in nightly and beta is affected.
:edgul, is this bug important enough to require an uplift?

For more information, please visit BugBot documentation.

Flags: needinfo?(edgul)

Comment on attachment 9514431 [details]
Bug 1989488 - fix 302 set-cookies not being sent to content process. r?#cookie-reviewers

Beta/Release Uplift Approval Request

  • User impact if declined/Reason for urgency: Cookies not being set in XHR/fetch redirect and favicon scenarios. Could impact ability to login.
  • Is this code covered by automated tests?: Yes
  • Has the fix been verified in Nightly?: No
  • Needs manual test from QE?: No
  • If yes, steps to reproduce:
  • List of other uplifts needed: Bug 1991118
  • Risk to taking this patch: Low
  • Why is the change risky/not risky? (and alternatives if risky): This patch un-restricts cookie sending between processes. Relaxing the rules shouldn't introduce any bugs.
  • String changes made/needed:
  • Is Android affected?: Yes
Flags: needinfo?(edgul)
Attachment #9514431 - Flags: approval-mozilla-beta?
Flags: in-testsuite+

Comment on attachment 9514431 [details]
Bug 1989488 - fix 302 set-cookies not being sent to content process. r?#cookie-reviewers

Approved for 144.0b8.

Attachment #9514431 - Flags: approval-mozilla-beta? → approval-mozilla-beta+
Duplicate of this bug: 1988172
Duplicate of this bug: 1991632
See Also: → 1988666
See Also: → 1980725
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: