fixed tag xss issue
This commit is contained in:
5
dist/css/print.css
vendored
5
dist/css/print.css
vendored
@@ -832,6 +832,11 @@
|
||||
.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation div.heading ul.options li a {
|
||||
text-decoration: none;
|
||||
}
|
||||
.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation div.heading ul.options li a .markdown p {
|
||||
color: inherit;
|
||||
padding: 0;
|
||||
line-height: inherit;
|
||||
}
|
||||
.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation div.heading ul.options li.access {
|
||||
color: black;
|
||||
}
|
||||
|
||||
5
dist/css/screen.css
vendored
5
dist/css/screen.css
vendored
@@ -832,6 +832,11 @@
|
||||
.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation div.heading ul.options li a {
|
||||
text-decoration: none;
|
||||
}
|
||||
.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation div.heading ul.options li a .markdown p {
|
||||
color: inherit;
|
||||
padding: 0;
|
||||
line-height: inherit;
|
||||
}
|
||||
.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation div.heading ul.options li.access {
|
||||
color: black;
|
||||
}
|
||||
|
||||
21
dist/swagger-ui.js
vendored
21
dist/swagger-ui.js
vendored
@@ -333,9 +333,9 @@ templates['operation'] = template({"1":function(container,depth0,helpers,partial
|
||||
+ alias3((helpers.sanitize || (depth0 && depth0.sanitize) || alias2).call(alias1,(depth0 != null ? depth0.encodedParentId : depth0),{"name":"sanitize","hash":{},"data":data}))
|
||||
+ "/"
|
||||
+ alias3((helpers.sanitize || (depth0 && depth0.sanitize) || alias2).call(alias1,(depth0 != null ? depth0.nickname : depth0),{"name":"sanitize","hash":{},"data":data}))
|
||||
+ "' class=\"toggleOperation\">"
|
||||
+ "' class=\"toggleOperation\"><span class=\"markdown\">"
|
||||
+ ((stack1 = (helpers.escape || (depth0 && depth0.escape) || alias2).call(alias1,(depth0 != null ? depth0.summary : depth0),{"name":"escape","hash":{},"data":data})) != null ? stack1 : "")
|
||||
+ "</a>\n </li>\n </ul>\n </div>\n <div class='content' id='"
|
||||
+ "</span></a>\n </li>\n </ul>\n </div>\n <div class='content' id='"
|
||||
+ alias3((helpers.sanitize || (depth0 && depth0.sanitize) || alias2).call(alias1,(depth0 != null ? depth0.encodedParentId : depth0),{"name":"sanitize","hash":{},"data":data}))
|
||||
+ "_"
|
||||
+ 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) {
|
||||
|
||||
var sanitize =function (html) {
|
||||
var _html;
|
||||
if( _.isUndefined(html) || _.isNull(html) || _.isNumber(html)) {
|
||||
|
||||
if ( _.isUndefined(html) || _.isNull(html)) {
|
||||
return new Handlebars.SafeString('');
|
||||
}
|
||||
|
||||
if (_.isNumber(html)) {
|
||||
return new Handlebars.SafeString(html);
|
||||
}
|
||||
|
||||
@@ -21695,6 +21700,14 @@ window.SwaggerUi.utils = {
|
||||
}
|
||||
|
||||
return result;
|
||||
},
|
||||
|
||||
sanitize: function(html) {
|
||||
// Strip the script tags from the html and inline evenhandlers
|
||||
html = html.replace(/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi, '');
|
||||
html = html.replace(/(on\w+="[^"]*")*(on\w+='[^']*')*(on\w+=\w*\(\w*\))*/gi, '');
|
||||
|
||||
return html;
|
||||
}
|
||||
};
|
||||
'use strict';
|
||||
@@ -22388,7 +22401,7 @@ SwaggerUi.Views.MainView = Backbone.View.extend({
|
||||
id = id + '_' + counter;
|
||||
counter += 1;
|
||||
}
|
||||
resource.id = id;
|
||||
resource.id = SwaggerUi.utils.sanitize(id);
|
||||
resources[id] = resource;
|
||||
this.addResource(resource, this.model.auths);
|
||||
}
|
||||
|
||||
20
dist/swagger-ui.min.js
vendored
20
dist/swagger-ui.min.js
vendored
File diff suppressed because one or more lines are too long
@@ -832,6 +832,11 @@
|
||||
.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation div.heading ul.options li a {
|
||||
text-decoration: none;
|
||||
}
|
||||
.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation div.heading ul.options li a .markdown p {
|
||||
color: inherit;
|
||||
padding: 0;
|
||||
line-height: inherit;
|
||||
}
|
||||
.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation div.heading ul.options li.access {
|
||||
color: black;
|
||||
}
|
||||
|
||||
@@ -832,6 +832,11 @@
|
||||
.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation div.heading ul.options li a {
|
||||
text-decoration: none;
|
||||
}
|
||||
.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation div.heading ul.options li a .markdown p {
|
||||
color: inherit;
|
||||
padding: 0;
|
||||
line-height: inherit;
|
||||
}
|
||||
.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation div.heading ul.options li.access {
|
||||
color: black;
|
||||
}
|
||||
|
||||
@@ -11,7 +11,12 @@ var _sanitize = function(html) {
|
||||
|
||||
var sanitize =function (html) {
|
||||
var _html;
|
||||
if( _.isUndefined(html) || _.isNull(html) || _.isNumber(html)) {
|
||||
|
||||
if ( _.isUndefined(html) || _.isNull(html)) {
|
||||
return new Handlebars.SafeString('');
|
||||
}
|
||||
|
||||
if (_.isNumber(html)) {
|
||||
return new Handlebars.SafeString(html);
|
||||
}
|
||||
|
||||
|
||||
@@ -68,5 +68,13 @@ window.SwaggerUi.utils = {
|
||||
}
|
||||
|
||||
return result;
|
||||
},
|
||||
|
||||
sanitize: function(html) {
|
||||
// Strip the script tags from the html and inline evenhandlers
|
||||
html = html.replace(/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi, '');
|
||||
html = html.replace(/(on\w+="[^"]*")*(on\w+='[^']*')*(on\w+=\w*\(\w*\))*/gi, '');
|
||||
|
||||
return html;
|
||||
}
|
||||
};
|
||||
@@ -96,7 +96,7 @@ SwaggerUi.Views.MainView = Backbone.View.extend({
|
||||
id = id + '_' + counter;
|
||||
counter += 1;
|
||||
}
|
||||
resource.id = id;
|
||||
resource.id = SwaggerUi.utils.sanitize(id);
|
||||
resources[id] = resource;
|
||||
this.addResource(resource, this.model.auths);
|
||||
}
|
||||
|
||||
@@ -703,6 +703,11 @@
|
||||
font-size: 0.9em;
|
||||
a {
|
||||
text-decoration: none;
|
||||
.markdown p {
|
||||
color: inherit;
|
||||
padding: 0;
|
||||
line-height: inherit;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
</h3>
|
||||
<ul class='options'>
|
||||
<li>
|
||||
<a href='#!/{{sanitize encodedParentId}}/{{sanitize nickname}}' class="toggleOperation">{{{escape summary}}}</a>
|
||||
<a href='#!/{{sanitize encodedParentId}}/{{sanitize nickname}}' class="toggleOperation"><span class="markdown">{{{escape summary}}}</span></a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
@@ -327,9 +327,9 @@ templates['operation'] = template({"1":function(container,depth0,helpers,partial
|
||||
+ alias3((helpers.sanitize || (depth0 && depth0.sanitize) || alias2).call(alias1,(depth0 != null ? depth0.encodedParentId : depth0),{"name":"sanitize","hash":{},"data":data}))
|
||||
+ "/"
|
||||
+ alias3((helpers.sanitize || (depth0 && depth0.sanitize) || alias2).call(alias1,(depth0 != null ? depth0.nickname : depth0),{"name":"sanitize","hash":{},"data":data}))
|
||||
+ "' class=\"toggleOperation\">"
|
||||
+ "' class=\"toggleOperation\"><span class=\"markdown\">"
|
||||
+ ((stack1 = (helpers.escape || (depth0 && depth0.escape) || alias2).call(alias1,(depth0 != null ? depth0.summary : depth0),{"name":"escape","hash":{},"data":data})) != null ? stack1 : "")
|
||||
+ "</a>\n </li>\n </ul>\n </div>\n <div class='content' id='"
|
||||
+ "</span></a>\n </li>\n </ul>\n </div>\n <div class='content' id='"
|
||||
+ alias3((helpers.sanitize || (depth0 && depth0.sanitize) || alias2).call(alias1,(depth0 != null ? depth0.encodedParentId : depth0),{"name":"sanitize","hash":{},"data":data}))
|
||||
+ "_"
|
||||
+ alias3((helpers.sanitize || (depth0 && depth0.sanitize) || alias2).call(alias1,(depth0 != null ? depth0.nickname : depth0),{"name":"sanitize","hash":{},"data":data}))
|
||||
|
||||
Reference in New Issue
Block a user