Skip to content

Commit 47ab2a3

Browse files
committed
added sanitization of scopes per swagger-api#2483
1 parent 46fbae2 commit 47ab2a3

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

src/main/javascript/view/Oauth2Model.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,19 @@ SwaggerUi.Models.Oauth2Model = Backbone.Model.extend({
66
},
77

88
initialize: function () {
9+
if(this.attributes && this.attributes.scopes) {
10+
var attributes = _.cloneDeep(this.attributes);
11+
var i, scopes = [];
12+
for(i in attributes.scopes) {
13+
var scope = attributes.scopes[i];
14+
if(typeof scope.description === 'string') {
15+
scopes[scope] = attributes.scopes[i];
16+
scopes.push(attributes.scopes[i]);
17+
}
18+
}
19+
attributes.scopes = scopes;
20+
this.attributes = attributes;
21+
}
922
this.on('change', this.validate);
1023
},
1124

0 commit comments

Comments
 (0)