Open Bug 1412271 Opened 7 years ago Updated 2 years ago

createElementNS doesn't work with csp nonce

Categories

(Core :: DOM: Security, defect, P3)

56 Branch
defect

Tracking

()

People

(Reporter: v.shmyroff, Unassigned)

References

(Blocks 2 open bugs)

Details

(Whiteboard: [domsecurity-backlog1])

Attachments

(1 file)

Attached file nonce_error.html
User Agent: Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.113 YaBrowser/17.9.1.768 Yowser/2.5 Safari/537.36

Steps to reproduce:

create svg element with namespace document.createElementNS('http://www.w3.org/2000/svg', 'svg')
add some style (elem.style.position = 'absolute';)
add element to DOM (document.body.appendChild(elem);)

Link: http://vsesh.me/nonce_error.html


Actual results:

The SVG element added without style.
There is csp error in the console.


Expected results:

The SVG element must be added without errors.
Group: firefox-core-security → dom-core-security
Component: Untriaged → DOM: Security
Product: Firefox → Core
Your CSP requires a nonce for both scripts and style. When you create the style element you need to add the nonce attribute to it.
Group: dom-core-security
Status: UNCONFIRMED → RESOLVED
Closed: 7 years ago
Resolution: --- → INVALID
I didn't create a style element. I created style attribute. I works this createElement method. And it works in all another browsers.
Please, look at the example
Status: RESOLVED → UNCONFIRMED
Resolution: INVALID → ---
Note: test document shows this works fine for a normal element, the failure is specifically with an element created in the SVG namespace. Possibly any namespaced element? Will have to test, but SVG for sure.
Status: UNCONFIRMED → NEW
Ever confirmed: true
Priority: -- → P3
Whiteboard: [domsecurity-backlog1]
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: