Open Bug 1387355 Opened 3 years ago Updated 1 year ago

EventSource: ignore IDs with U+0000

Categories

(Core :: DOM: Networking, enhancement, P2)

enhancement

Tracking

()

People

(Reporter: annevk, Assigned: kershaw)

References

(Depends on 1 open bug)

Details

(Whiteboard: [necko-triaged])

Attachments

(1 file, 1 obsolete file)

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
Component: DOM → DOM: Networking
Is this important? Or a good-first-bug maybe?
Flags: needinfo?(amarchesini)
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)
Hmm yeah, https://hg.mozilla.org/mozilla-central/rev/c9f228c158d7 looks like it might be it. Simply ignoring 0x00 seems a little dangerous though.
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)
Priority: P3 → P2
Whiteboard: [necko-triaged]
(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)
(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)
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
The original code only skip the NULL character, but according to the spec we should ignore the whole field.
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.