[Webkit-unassigned] [Bug 160960] New: WebKit blocks 'unsafe-inline' event handler upon execution, not upon setting
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Thu Aug 18 09:25:05 PDT 2016
https://bugs.webkit.org/show_bug.cgi?id=160960
Bug ID: 160960
Summary: WebKit blocks 'unsafe-inline' event handler upon
execution, not upon setting
Classification: Unclassified
Product: WebKit
Version: Safari 9
Hardware: All
OS: All
Status: NEW
Severity: Normal
Priority: P2
Component: WebCore JavaScript
Assignee: webkit-unassigned at lists.webkit.org
Reporter: april at pokeinthe.io
OS Version: OS X 10.11
URLs (if applicable) : http://output.jsbin.com/togusapobi / http://output.jsbin.com/wutojesugi
Other browsers tested:
Add OK or FAIL after other browsers where you have tested this issue:
Safari: FAIL
Firefox 48: OK
IE 7/8/9: N/A
Edge: OK
Chrome 52: FAIL
What steps will reproduce the problem?
1. Set Content-Security-Policy to block 'unsafe-inline'
2. Add an event handler to an attribute via setAttribute('onclick') or via onclick attribute added to DOM node
What is the expected result?
In Firefox and Edge, this code will be successfully blocked on being set:
document.querySelector('button').setAttribute('onclick', 'alert(1)')
As will this inline event handler:
<button onclick="alert(1);">yay</button>
What happens instead of that?
WebKit-based browsers block it upon execution, in violation of the CSP specification:
> When an event handler content attribute is set, execute the following steps:
>
> If the Should element's inline behavior be blocked by Content Security Policy? algorithm returns "Blocked" when executed upon the attribute's element, "script attribute", and the attribute's value, then abort these steps. [CSP]
See also:
https://bugs.chromium.org/p/chromium/issues/detail?id=638957
https://bugzilla.mozilla.org/show_bug.cgi?id=1296027
--
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.webkit.org/pipermail/webkit-unassigned/attachments/20160818/ed279983/attachment.html>
More information about the webkit-unassigned
mailing list