Chromium blocks 'unsafe-inline' event handler upon execution, not upon setting
Reported by
ap...@pokeinthe.io,
Aug 18 2016
|
|||
Issue descriptionChrome Version : 52.0.2743.116 (64-bit) 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 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]
,
Aug 18 2016
,
Nov 10 2017
,
Feb 18 2018
|
|||
►
Sign in to add a comment |
|||
Comment 1 by mkwst@chromium.org
, Aug 18 2016Labels: OS-Android OS-Chrome OS-Linux OS-Windows
Owner: mkwst@chromium.org
Status: Assigned (was: Unconfirmed)