Skip to content

Commit

Permalink
Escape curl command to fix XSS vulnerability.
Browse files Browse the repository at this point in the history
  • Loading branch information
joevennix committed Jan 13, 2016
1 parent 3abf8d2 commit 331d2be
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
10 changes: 5 additions & 5 deletions dist/swagger-ui.js
Expand Up @@ -25241,10 +25241,10 @@ SwaggerUi.Views.OperationView = Backbone.View.extend({
this.parentId = this.model.parentId;
this.nickname = this.model.nickname;
this.model.encodedParentId = encodeURIComponent(this.parentId);

if (opts.swaggerOptions) {
this.model.defaultRendering = opts.swaggerOptions.defaultModelRendering;

if (opts.swaggerOptions.showRequestHeaders) {
this.model.showRequestHeaders = true;
}
Expand Down Expand Up @@ -25497,15 +25497,15 @@ SwaggerUi.Views.OperationView = Backbone.View.extend({
// This is required for JsonEditor to display the root properly
if(!param.schema.type){
param.schema.type = 'object';
}
}
// This is the title that will be used by JsonEditor for the root
// Since we already display the parameter's name in the Parameter column
// We set this to space, we can't set it to null or space otherwise JsonEditor
// will replace it with the text "root" which won't look good on screen
if(!param.schema.title){
param.schema.title = ' ';
}
}
}

var paramView = new SwaggerUi.Views.ParameterView({
model: param,
Expand Down Expand Up @@ -25926,7 +25926,7 @@ SwaggerUi.Views.OperationView = Backbone.View.extend({
// adds curl output
var curlCommand = this.model.asCurl(this.map, {responseContentType: contentType});
curlCommand = curlCommand.replace('!', '!');
$( 'div.curl', $(this.el)).html('<pre>' + curlCommand + '</pre>');
$( 'div.curl', $(this.el)).html('<pre>' + _.escape(curlCommand) + '</pre>');

// only highlight the response if response is less than threshold, default state is highlight response
var opts = this.options.swaggerOptions;
Expand Down

0 comments on commit 331d2be

Please sign in to comment.