@@ -333,9 +333,9 @@ templates['operation'] = template({"1":function(container,depth0,helpers,partial
333333 + alias3((helpers.sanitize || (depth0 && depth0.sanitize) || alias2).call(alias1,(depth0 != null ? depth0.encodedParentId : depth0),{"name":"sanitize","hash":{},"data":data}))
334334 + "/"
335335 + alias3((helpers.sanitize || (depth0 && depth0.sanitize) || alias2).call(alias1,(depth0 != null ? depth0.nickname : depth0),{"name":"sanitize","hash":{},"data":data}))
336- + "' class=\"toggleOperation\">"
336+ + "' class=\"toggleOperation\"><span class=\"markdown\"> "
337337 + ((stack1 = (helpers.escape || (depth0 && depth0.escape) || alias2).call(alias1,(depth0 != null ? depth0.summary : depth0),{"name":"escape","hash":{},"data":data})) != null ? stack1 : "")
338- + "</a>\n </li>\n </ul>\n </div>\n <div class='content' id='"
338+ + "</span></ a>\n </li>\n </ul>\n </div>\n <div class='content' id='"
339339 + alias3((helpers.sanitize || (depth0 && depth0.sanitize) || alias2).call(alias1,(depth0 != null ? depth0.encodedParentId : depth0),{"name":"sanitize","hash":{},"data":data}))
340340 + "_"
341341 + alias3((helpers.sanitize || (depth0 && depth0.sanitize) || alias2).call(alias1,(depth0 != null ? depth0.nickname : depth0),{"name":"sanitize","hash":{},"data":data}))
@@ -3052,7 +3052,12 @@ var _sanitize = function(html) {
30523052
30533053var sanitize =function (html) {
30543054 var _html;
3055- if( _.isUndefined(html) || _.isNull(html) || _.isNumber(html)) {
3055+
3056+ if ( _.isUndefined(html) || _.isNull(html)) {
3057+ return new Handlebars.SafeString('');
3058+ }
3059+
3060+ if (_.isNumber(html)) {
30563061 return new Handlebars.SafeString(html);
30573062 }
30583063
@@ -21695,6 +21700,14 @@ window.SwaggerUi.utils = {
2169521700 }
2169621701
2169721702 return result;
21703+ },
21704+
21705+ sanitize: function(html) {
21706+ // Strip the script tags from the html and inline evenhandlers
21707+ html = html.replace(/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi, '');
21708+ html = html.replace(/(on\w+="[^"]*")*(on\w+='[^']*')*(on\w+=\w*\(\w*\))*/gi, '');
21709+
21710+ return html;
2169821711 }
2169921712};
2170021713'use strict';
@@ -22388,7 +22401,7 @@ SwaggerUi.Views.MainView = Backbone.View.extend({
2238822401 id = id + '_' + counter;
2238922402 counter += 1;
2239022403 }
22391- resource.id = id ;
22404+ resource.id = SwaggerUi.utils.sanitize(id) ;
2239222405 resources[id] = resource;
2239322406 this.addResource(resource, this.model.auths);
2239422407 }
0 commit comments