Skip to content

Commit 626e58c

Browse files
authored
Merge pull request #3314 from rhelmer/sanitize-jsonp
better sanitize jsonp
2 parents d7c93b0 + f56936c commit 626e58c

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

src/node/hooks/express/apicalls.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ var apiCaller = function(req, res, fields) {
1818
apiLogger.info("RESPONSE, " + req.params.func + ", " + response);
1919

2020
//is this a jsonp call, if yes, add the function call
21-
if(req.query.jsonp)
21+
if(req.query.jsonp && isVarName(response))
2222
response = req.query.jsonp + "(" + response + ")";
2323

2424
res._____send(response);

src/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,8 @@
4343
"jsonminify" : "0.4.1",
4444
"measured" : "1.1.0",
4545
"mocha" : "2.4.5",
46-
"supertest" : "1.2.0"
46+
"supertest" : "1.2.0",
47+
"is-var-name" : "1.0.0"
4748
},
4849
"bin": { "etherpad-lite": "./node/server.js" },
4950
"devDependencies": {

0 commit comments

Comments
 (0)