cookie with empty name and value should be rejected
Categories
(Core :: Networking: Cookies, defect, P2)
Tracking
()
Tracking | Status | |
---|---|---|
firefox129 | --- | fixed |
People
(Reporter: dveditz, Assigned: baku)
References
(Blocks 1 open bug)
Details
(Whiteboard: [necko-triaged][necko-priority-next])
Attachments
(2 files)
The cookie spec says we should reject cookies that don't have a name and don't have a value (step 2 of §5.6 https://datatracker.ietf.org/doc/html/draft-ietf-httpbis-rfc6265bis-14#section-5.6-3.2.1). The parsing algorithm in §5.5 can lead to an empty name and value (https://datatracker.ietf.org/doc/html/draft-ietf-httpbis-rfc6265bis-14#name-the-set-cookie-header-field) but the later step is supposed to prevent that.
test:
- open the dev tools console
- execute
document.cookie = " ; path=/; secure"
- check storage in dev tools
When we construct the cookie string we correctly filter it out -- it doesn't show up in document.cookie or in the Cookie: header. But it's there in storage.
Reporter | ||
Updated•1 year ago
|
Pretty sure fixing this will resolve the WPTs in cookies/attributes/invalid.html:
- "Ignore name- and value-less
Set-Cookie: ; bar
" - "Ignore
Set-Cookie: =
with otherSet-Cookie
headers"
Assignee | ||
Updated•1 year ago
|
Assignee | ||
Comment 2•1 year ago
|
||
Updated•1 year ago
|
Comment 4•1 year ago
|
||
Backed out for causing bc failures in browser_cookie_insecure_overwrites_secure.js
- Backout link
- Push with failures
- Failure Log
- Failure line: TEST-UNEXPECTED-FAIL | netwerk/cookie/test/browser/browser_cookie_insecure_overwrites_secure.js | A promise chain failed to handle a rejection: Actor 'SpecialPowers' destroyed before query 'Spawn' was resolved - stack: ensureDOMPromiseRejectionsProcessed@resource://testing-common/PromiseTestUtils.sys.mjs:115:17
Comment 6•1 year ago
|
||
bugherder |
Assignee | ||
Updated•1 year ago
|
Updated•1 year ago
|
Comment 7•1 year ago
|
||
Hi Andreea,
Before the fix (Win11x64 and FF 129.0a1 (20240617214416)) the cookie with empty name was displayed in storage, but after the fix (Win11x64 and FF 129.0b8) the cookie is displayed again in storage but this time with name, is this the expected outcome? Thank you.
Comment 9•1 year ago
|
||
I followed the steps from description:
- opened link https://datatracker.ietf.org/doc/html/draft-ietf-httpbis-rfc6265bis-14#section-5.6-3.2.1
- open the dev tools console
- execute document.cookie = " ; path=/; secure"
- check storage in dev tools
Actual result: On 129.0a1 I have an entry with no name under storage (before fix) and on 129.0b9 I have an entry with name under storage (after fix). Is this expected?
Comment 10•1 year ago
|
||
Assignee | ||
Comment 11•1 year ago
|
||
The two things seem unrelated. The cf_clearance
cookie is there but it's not shown by the dev-tools.
:edgul, do you know how can help here? In the log I see this:
Parent 402759: Main Thread]: D/cookie ===== COOKIE ACCEPTED =====
[Parent 402759: Main Thread]: D/cookie request URL: https://datatracker.ietf.org/cdn-cgi/challenge-platform/h/b/jsd/r/8abdcd2dcca85a1f
[Parent 402759: Main Thread]: D/cookie cookie string: cf_clearance=; Path=/; Expires=Thu, 01-Jan-70 00:00:00 GMT; Domain=.ietf.org; HttpOnly; Secure; SameSite=None
cf_clearance=XXX; Path=/; Expires=Thu, 31-Jul-25 13:05:44 GMT; Domain=.ietf.org; HttpOnly; Secure; SameSite=None; Partitioned
[Parent 402759: Main Thread]: D/cookie replaces existing cookie: false
[Parent 402759: Main Thread]: D/cookie current time: Wed Jul 31 13:05:44 2024 GMT
[Parent 402759: Main Thread]: D/cookie ----------------
[Parent 402759: Main Thread]: D/cookie name: cf_clearance
[Parent 402759: Main Thread]: D/cookie value: XXX
[Parent 402759: Main Thread]: D/cookie domain: .ietf.org
[Parent 402759: Main Thread]: D/cookie path: /
[Parent 402759: Main Thread]: D/cookie expires: Thu Jul 31 13:05:44 2025 GMT
[Parent 402759: Main Thread]: D/cookie created: Wed Jul 31 13:05:44 2024 GMT
[Parent 402759: Main Thread]: D/cookie is secure: true
[Parent 402759: Main Thread]: D/cookie is httpOnly: true
Comment 12•1 year ago
|
||
This is a known bug; cookies with Partitioned
attribute are not showing in devtools. We believe this will be addressed by Bug 1895215
Description
•