Skip to content

Commit f58157e

Browse files
authored
Merge pull request #1 from tomer-mobb/Mobb-fix-a44386e2e7
XSS vulnerability fix (powered by Mobb)
2 parents 4729a1f + 9c9f8a7 commit f58157e

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

insecure-js/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
"dom-iterator": "^1.0.0",
88
"jquery": "2.1.0",
99
"lodash": "4.16.1",
10+
"lodash.escape": ">=4.0.1",
1011
"mysql2": "^2.3.3",
1112
"semver": "5.4.1",
1213
"sequelize": "4.44.1",

insecure-js/server.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
const escapeHtml = require('lodash.escape');
12
const http = require('http');
23
const _ = require('lodash');
34
const qs = require('querystring');
@@ -60,7 +61,7 @@ const server = http.createServer((req, res) => {
6061
}
6162
} catch (error) {
6263
console.error("Raw SQL error:", error);
63-
responseMessages.push(`<p>An error occurred: ${error.message}</p>`);
64+
responseMessages.push(`<p>An error occurred: ${escapeHtml(error.message)}</p>`);
6465
}
6566
}
6667

0 commit comments

Comments
 (0)