Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sanitize dojo components #849

Merged
merged 2 commits into from
Dec 2, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ See also section about WebODF
### Fixes

* Fix wrongly enabled hyperlink tools with no document loaded ([#833](https://github.com/kogmbh/WebODF/pull/833))

* Prevent Cross-Site Scripting from style names and font names ([#849](https://github.com/kogmbh/WebODF/pull/849)))

# Changes between 0.5.3 and 0.5.4

Expand Down
1 change: 1 addition & 0 deletions programs/editor/dojo-deps/profiles/app.profile.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ var profile = {
"dojo/dom-construct",
"dojo/_base/NodeList",
"dojo/_base/browser",
"dojox/html/entities",
'dijit/layout/BorderContainer',
'dijit/layout/ContentPane',
'dojox/layout/ExpandoPane',
Expand Down
9 changes: 5 additions & 4 deletions programs/editor/widgets/fontPicker.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,10 @@
*/
/*global define,require,document */
define("webodf/editor/widgets/fontPicker", [
"dijit/form/Select"],
"dijit/form/Select",
"dojox/html/entities"],

function (Select) {
function (Select, htmlEntities) {
"use strict";

/**
Expand Down Expand Up @@ -91,7 +92,7 @@ define("webodf/editor/widgets/fontPicker", [
name = documentFonts[i].name;
family = documentFonts[i].family || name;
selectionList.push({
label: '<span style="font-family: ' + family + ';">' + name + '</span>',
label: '<span style="font-family: ' + htmlEntities.encode(family) + ';">' + htmlEntities.encode(name)+ '</span>',
value: name
});
}
Expand All @@ -104,7 +105,7 @@ define("webodf/editor/widgets/fontPicker", [
// Lastly populate the fonts provided by the editor
for (i = 0; i < editorFonts.length; i += 1) {
selectionList.push({
label: '<span style="font-family: ' + editorFonts[i] + ';">' + editorFonts[i] + '</span>',
label: '<span style="font-family: ' + htmlEntities.encode(editorFonts[i]) + ';">' + htmlEntities.encode(editorFonts[i]) + '</span>',
value: editorFonts[i]
});
}
Expand Down
9 changes: 5 additions & 4 deletions programs/editor/widgets/paragraphStyles.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,10 @@

define("webodf/editor/widgets/paragraphStyles", [
"dijit/form/Select",
"dojox/html/entities",
"webodf/editor/EditorSession"],

function (Select, EditorSession) {
function (Select, htmlEntities, EditorSession) {
"use strict"

/**
Expand Down Expand Up @@ -83,7 +84,7 @@ define("webodf/editor/widgets/paragraphStyles", [

for (i = 0; i < availableStyles.length; i += 1) {
selectionList.push({
label: availableStyles[i].displayName || availableStyles[i].name,
label: htmlEntities.encode(availableStyles[i].displayName) || htmlEntities.encode(availableStyles[i].name),
value: availableStyles[i].name
});
}
Expand All @@ -102,8 +103,8 @@ define("webodf/editor/widgets/paragraphStyles", [

newStyleElement = editorSession.getParagraphStyleElement(styleInfo.name);
select.addOption({
value: styleInfo.name,
label: newStyleElement.getAttributeNS(stylens, 'display-name')
label: htmlEntities.encode(newStyleElement.getAttributeNS(stylens, 'display-name')),
value: styleInfo.name
});

if (self.onAdd) {
Expand Down