Skip to content

Commit

Permalink
added sanitization of scopes per #2483
Browse files Browse the repository at this point in the history
  • Loading branch information
fehguy committed Nov 23, 2016
1 parent 46fbae2 commit 47ab2a3
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/main/javascript/view/Oauth2Model.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,19 @@ SwaggerUi.Models.Oauth2Model = Backbone.Model.extend({
},

initialize: function () {
if(this.attributes && this.attributes.scopes) {
var attributes = _.cloneDeep(this.attributes);
var i, scopes = [];
for(i in attributes.scopes) {
var scope = attributes.scopes[i];
if(typeof scope.description === 'string') {
scopes[scope] = attributes.scopes[i];
scopes.push(attributes.scopes[i]);
}
}
attributes.scopes = scopes;
this.attributes = attributes;
}
this.on('change', this.validate);
},

Expand Down

0 comments on commit 47ab2a3

Please # to comment.