EventSource: ignore IDs with U+0000

NEW
Assigned to

Status

()

P2
normal
a year ago
26 days ago

People

(Reporter: annevk, Assigned: kershaw)

Tracking

(Depends on: 1 bug)

Firefox Tracking Flags

(Not tracked)

Details

(Whiteboard: [necko-triaged])

Attachments

(1 attachment, 1 obsolete attachment)

(Reporter)

Description

a year ago
Change to standard: https://github.com/whatwg/html/pull/2849

Proposed tests (still need review): https://github.com/w3c/web-platform-tests/pull/6584

It seems good to fix this as this is the only way for someone to smuggle a U+0000 into a header value.
Priority: -- → P2
Moving to p3 because no activity for at least 1 year(s).
See https://github.com/mozilla/bug-handling/blob/master/policy/triage-bugzilla.md#how-do-you-triage for more information
Priority: P2 → P3
(Reporter)

Updated

a month ago
Component: DOM → DOM: Networking
Is this important? Or a good-first-bug maybe?
Flags: needinfo?(amarchesini)
(Reporter)

Comment 3

a month ago
It seems bad to violate HTTP invariants, but we managed thus far, so a bit of both?
annevk gave a good answer, but it also seems that we support it: we pass the WPT. maybe already fixed?
Flags: needinfo?(amarchesini)
(Reporter)

Comment 5

a month ago
Hmm yeah, https://hg.mozilla.org/mozilla-central/rev/c9f228c158d7 looks like it might be it. Simply ignoring 0x00 seems a little dangerous though.
(Reporter)

Comment 6

a month ago
I realized that bug 1453318 would obviate the need for that check, though it would also require changing the passing condition of the test mentioned in comment 0 (it'd simply error).
Depends on: 1453318
Flags: needinfo?(kershaw)
Whiteboard: [necko-triaged]
(Assignee)

Comment 7

a month ago
(In reply to Anne (:annevk) from comment #5)
> Hmm yeah, https://hg.mozilla.org/mozilla-central/rev/c9f228c158d7 looks like
> it might be it. Simply ignoring 0x00 seems a little dangerous though.

Maybe we can close this bug, since this is already fixed.
What do yoy think, Anne?
Flags: needinfo?(kershaw) → needinfo?(annevk)
(Assignee)

Comment 8

a month ago
(In reply to Kershaw Chang [:kershaw] from comment #7)
> (In reply to Anne (:annevk) from comment #5)
> > Hmm yeah, https://hg.mozilla.org/mozilla-central/rev/c9f228c158d7 looks like
> > it might be it. Simply ignoring 0x00 seems a little dangerous though.
> 
> Maybe we can close this bug, since this is already fixed.
> What do yoy think, Anne?

I just found that our current code [1] does have a problem.
We current ignore the char if it is \0. If we get "id: 1\02", the parser set the id to "12".
According to the spec, we should ignore this value.

So, clear the ni and assign this to myself.


[1] https://searchfox.org/mozilla-central/rev/17f55aee76b7c4610a974cffd3453454e0c8de7b/dom/base/EventSource.cpp#1761-1763
Assignee: nobody → kershaw
Flags: needinfo?(annevk)
(Assignee)

Comment 9

a month ago
Created attachment 9024540 [details]
Bug 1387355 - Ignore the field value if it contains NULL character

The original code only skip the NULL character, but according to the spec we should ignore the whole field.
Attachment #9024540 - Attachment is obsolete: true
(Assignee)

Comment 10

a month ago
Created attachment 9024543 [details]
Bug 1387355 - Ignore the field value if it contains NULL character

The original code only skip the NULL character, but according to the spec we should ignore the whole field.
(Reporter)

Comment 11

26 days ago
Kershaw, Olli, https://github.com/web-platform-tests/wpt/pull/14095 has a PR to modify the test to demonstrate the issue in Firefox. Other browsers (Chrome, Safari) pass these tests.

(Also, my earlier comments were a bit confused as this doesn't directly impact the HTTP layer in Firefox (and per code inspection that already has guards for 0x00 and friends), this is only about parsing the text/event-stream format.)
You need to log in before you can comment on or make changes to this bug.