Monitor innerHTML calls in chrome code and on about: pages and assert we can not introduce new calls to innerHTML
Categories
(Core :: DOM: Security, task, P2)
Tracking
()
Tracking | Status | |
---|---|---|
firefox74 | --- | fixed |
People
(Reporter: ckerschb, Assigned: ckerschb)
References
(Blocks 2 open bugs)
Details
(Whiteboard: [domsecurity-active])
Attachments
(1 file)
Ideally we shouldn't use .innerHTML() within chrome code or on any of our about: pages. In an effort we made sure that all calls to InnerHTML() pass through our internal fragment sanitizer which obviously reduces the risk. We do not do that for about: pages though. The fact that some about: pages are semi-privileged increases the risk of XSS in addition.
Within this bug we will add a dynamic runtime monitor of calls to innerHTML in chrome code as well as all of our about: pages. We will start by adding an allowlist which basically allows legacy code to work, but we will assert that no new instances of innerHTML can be added within chrome code or any of our about: pages.
Assignee | ||
Updated•6 years ago
|
Assignee | ||
Updated•6 years ago
|
Assignee | ||
Updated•6 years ago
|
Assignee | ||
Comment 1•6 years ago
|
||
Updated•6 years ago
|
Comment 3•6 years ago
|
||
Backed out changeset b80ab0927b40 (bug 1596360) for dt failures in DOMSecurityMonitor.cpp
Failure log: https://treeherder.mozilla.org/logviewer.html#/jobs?job_id=284403363&repo=autoland&lineNumber=1183
Backout: https://hg.mozilla.org/integration/autoland/rev/7a3be2bbce032721ec01a9b75d88cc7c6b089825
Assignee | ||
Comment 4•6 years ago
|
||
(In reply to Oana Pop-Rus from comment #3)
Backed out changeset b80ab0927b40 (bug 1596360) for dt failures in DOMSecurityMonitor.cpp
Seems like I forgot to allowlist react-dom.js :-(
Comment 6•6 years ago
|
||
bugherder |
Comment 7•4 years ago
|
||
// check if there is a JS caller, if not, then we can can return early here // because we only care about calls to the fragment parser (e.g. innerHTML) // originating from JS code. nsAutoString filename; uint32_t lineNum = 0; uint32_t columnNum = 0; JSContext* cx = nsContentUtils::GetCurrentJSContext(); if (!nsJSUtils::GetCallingLocation(cx, filename, &lineNum, &columnNum)) { return; }
I think other similar callers null-check cx
here (it can definitely be null).
Comment 8•4 years ago
|
||
(I've since worked out how to avoid that scenario.)
Description
•