This Bugzilla instance is deprecated, and most Eclipse projects now use GitHub or Eclipse GitLab. Please see the deprecation plan for details.
Bug 392469 - dojo.place() can be an alias for innerHTML
Summary: dojo.place() can be an alias for innerHTML
Status: RESOLVED FIXED
Alias: None
Product: Orion (Archived)
Classification: ECD
Component: Client (show other bugs)
Version: 1.0   Edit
Hardware: PC Windows 7
: P3 normal (vote)
Target Milestone: 2.0 M2   Edit
Assignee: Susan McCourt CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 393810
  Show dependency tree
 
Reported: 2012-10-19 11:57 EDT by Mark Macdonald CLA
Modified: 2013-01-10 13:55 EST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Mark Macdonald CLA 2012-10-19 11:57:38 EDT
The signature for dojo.place is:
 dojo.place(node, refNode, pos)

It allows the first parameter to be a string giving an HTML fragment. When the HTML string contains untrusted content, this coding pattern is insecure. For example, this is bad:

  dojo.place("<h2>" + messages["SectionHeader"] + "</h2>", whatever);

But this is OK since the HTML fragment is a constant value:

 dojo.place("<h2>Hello</h2>", whatever);

Anyone using the first pattern needs to use proper DOM APIs instead.

[1] http://dojotoolkit.org/reference-guide/1.8/dojo/dom-construct.html#dojo-dom-construct-place
Comment 1 Susan McCourt CLA 2013-01-10 13:55:39 EST
Just searched on dojo.place.
It's gone from all common modules and only left in the pages that haven't been converted yet.  The pattern is recorded on the wiki at

http://wiki.eclipse.org/index.php?title=Orion/Library_Independence#DOM_manipulation

I think we can close this.