Skip to content
This repository was archived by the owner on Nov 25, 2020. It is now read-only.

Commit 88e4865

Browse files
committed
Use He library to escape html in prototype-based components. Prevent creation of empty-labelled user repository. Prevent action.compression infinite loop while trying to check if file exists.
1 parent bc5d1fa commit 88e4865

22 files changed

+53
-40
lines changed

core/src/plugins/action.compression/manifest.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,9 @@
4242
while(userSelection.fileNameExists(name + extension)){
4343
name = tmpFileName + "-" + compteurFileName;
4444
compteurFileName ++;
45+
if(compteurFileName > 20){
46+
break;
47+
}
4548
}
4649
archive_nameInput.setValue(name + extension);
4750
return name;

core/src/plugins/core.conf/AbstractConfDriver.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1048,7 +1048,11 @@ public function switchAction(ServerRequestInterface $requestInterface, ResponseI
10481048
$tplRepo = RepositoryService::getRepositoryById($tplId);
10491049
$options = [];
10501050
OptionsHelper::parseStandardFormParameters($ctx, $httpVars, $options);
1051-
$newRep = $tplRepo->createTemplateChild(InputFilter::sanitize($httpVars["DISPLAY"]), $options, $loggedUser->getId(), $loggedUser->getId());
1051+
$display = InputFilter::sanitize($httpVars["DISPLAY"]);
1052+
if(empty($display)){
1053+
throw new PydioException("Cannot create repository with empty label");
1054+
}
1055+
$newRep = $tplRepo->createTemplateChild($display, $options, $loggedUser->getId(), $loggedUser->getId());
10521056
$gPath = $loggedUser->getGroupPath();
10531057
if (!empty($gPath)) {
10541058
$newRep->setGroupPath($gPath);

core/src/plugins/core.notifications/class.NotificationLoader.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ Class.create("NotificationLoader", {
9292
}
9393
var elLabel = el.getLabel();
9494
if(!elLabel) elLabel = "/";
95-
var block = '<div class="notif_event_label">'+elLabel+'</div>';
95+
var block = '<div class="notif_event_label">'+He.escape(elLabel)+'</div>';
9696
var detail = '';
9797
if(el.getMetadata().get('event_repository_label')){
9898
detail += '<div class="notif_event_repository">'+ el.getMetadata().get('event_repository_label') + '</div>';

core/src/plugins/editor.soundmanager/class.SMPlayer.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ Class.create("SMPlayer", AbstractEditor, {
199199

200200
open : function($super, ajxpNode){
201201
this.currentRichPreview = this.getPreview(ajxpNode, true);
202-
this.element.down(".smplayer_title").update(ajxpNode.getLabel());
202+
this.element.down(".smplayer_title").update(He.escape(ajxpNode.getLabel()));
203203
this.element.down(".smplayer_preview_element").insert(this.currentRichPreview);
204204
window.setTimeout(function(){
205205
try{this.currentRichPreview.down('span.sm2-360btn').click();}catch(e){}

core/src/plugins/gui.ajax/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@
2626
"react-autosuggest": "1.18.2",
2727
"clipboard":"^1.5.8",
2828
"qrcode.react":"0.6.1",
29-
"cronstrue":"0.3.1"
29+
"cronstrue":"0.3.1",
30+
"he":"1.1.0"
3031
},
3132
"devDependencies": {
3233
"grunt": "~0.4.5",

core/src/plugins/gui.ajax/res/js/ui/prototype/class.AbstractEditor.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ Class.create("AbstractEditor" , {
282282
*/
283283
updateTitle : function(title){
284284
if(this.filenameSpan) {
285-
this.filenameSpan.update(title);
285+
this.filenameSpan.update(He.escape(title));
286286
}
287287
if(this.fullScreenMode){
288288
this.refreshFullScreenTitle();

core/src/plugins/gui.ajax/res/js/ui/prototype/class.AjxpDraggable.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ Class.create("AjxpDraggable", Draggable, {
156156
var max = Math.min(nodes.length,5);
157157
var maxWidth = 0;
158158
for(var i=0;i<max;i++){
159-
var text = nodes[i].getLabel() + (i<max-1?",<br>":"");
159+
var text = He.escape(nodes[i].getLabel()) + (i<max-1?",<br>":"");
160160
maxWidth = Math.max(maxWidth, testStringWidth(text));
161161
this._clone.insert(text);
162162
}

core/src/plugins/gui.ajax/res/js/ui/prototype/class.AjxpTabulator.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,8 @@ Class.create("AjxpTabulator", AjxpPane, {
125125
label = MessageHash[tabInfo.label] || tabInfo.label;
126126
}
127127
var title = MessageHash[tabInfo.title] || label.stripTags();
128+
title = He.escape(title);
129+
label = He.escape(label);
128130
var options = {className:'toggleHeader toggleInactive'};
129131
if(!this.options.tabsTips){ options.title = title; }
130132
td = new Element('span', options);
@@ -165,14 +167,15 @@ Class.create("AjxpTabulator", AjxpPane, {
165167
if(label && label.innerHTML !== undefined){
166168
if(label.down('.filenameSpan')){
167169
var cont = label.down('.filenameSpan').innerHTML;
170+
cont = He.escape(cont);
168171
if(cont.length > 25){
169172
cont = cont.substr(0,7)+"[...]"+cont.substr(-13);
170173
label.down('.filenameSpan').update(cont);
171174
}
172175
}
173176
return label;
174177
}
175-
if(label.stripTags() != label) return label;
178+
label = label.stripTags();
176179
if(!label || !label.length) return '';
177180
if(label.length > 25){
178181
return label.substr(0,7)+"[...]"+label.substr(-13);

core/src/plugins/gui.ajax/res/js/ui/prototype/class.BackgroundManagerPane.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ Class.create("BackgroundManagerPane", {
5252

5353
updatePanelMessage : function(message){
5454
var imgString = '<img src="'+ajxpResourcesFolder+'/images/loadingImage.gif" width="16" align="absmiddle">';
55-
this.panel.update(imgString+' '+message);
55+
this.panel.update(imgString+' '+ He.escape(message));
5656
Effect.Appear(this.panel);
5757
},
5858

@@ -61,7 +61,7 @@ Class.create("BackgroundManagerPane", {
6161
* @param errorMessage String
6262
*/
6363
updatePanelError:function(errorMessage){
64-
this.panel.update(errorMessage);
64+
this.panel.update(He.escape(errorMessage));
6565
this.panel.insert(this.makeCloseLink());
6666
},
6767
/**

core/src/plugins/gui.ajax/res/js/ui/prototype/class.Breadcrumb.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,15 +86,15 @@ Class.create("Breadcrumb", AjxpPane, {
8686
refresh = '<i class="icon-refresh ajxp-goto-refresh" title="'+MessageHash[149]+'"></i>';
8787
}
8888
var first = pos == 0 ? ' first-bread':'';
89-
clickPath += "<li><span class='ajxp-goto "+first+"' data-goTo='"+pair.key+"'><em>"+pair.value+"</em></span></li>";
89+
clickPath += "<li><span class='ajxp-goto "+first+"' data-goTo='"+He.escape(pair.key)+"'><em>"+He.escape(pair.value)+"</em></span></li>";
9090
if(refresh){
91-
clickPath += "<li><i class='ajxp-goto' data-goTo='"+pair.key+"'>"+refresh+"</i></li>";
91+
clickPath += "<li><i class='ajxp-goto' data-goTo='"+He.escape(pair.key)+"'>"+refresh+"</i></li>";
9292
}
9393
}else{
9494
if(pos == length-1){
9595
refresh = '<span class="icon-refresh ajxp-goto-refresh" title="'+MessageHash[149]+'"></span>';
9696
}
97-
clickPath += (pair.value != pos == 0 || !this.options['hide_home_icon'] ? chevron : "") + "<span class='ajxp-goto' data-goTo='"+pair.key+"'>"+pair.value+refresh+"</span>";
97+
clickPath += (pair.value != pos == 0 || !this.options['hide_home_icon'] ? chevron : "") + "<span class='ajxp-goto' data-goTo='"+He.escape(pair.key)+"'>"+He.escape(pair.value)+refresh+"</span>";
9898
}
9999
pos ++;
100100
}.bind(this));

0 commit comments

Comments
 (0)