mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-01 11:35:55 +01:00
escape email in registration queue and invites
This commit is contained in:
15
test/user.js
15
test/user.js
@@ -1405,7 +1405,7 @@ describe('User', function () {
|
||||
username: 'rejectme',
|
||||
password: '123456',
|
||||
'password-confirm': '123456',
|
||||
email: 'reject@me.com',
|
||||
email: '<script>alert("ok");<script>reject@me.com',
|
||||
}, function (err) {
|
||||
assert.ifError(err);
|
||||
helpers.loginUser('admin', '123456', function (err, jar) {
|
||||
@@ -1413,7 +1413,7 @@ describe('User', function () {
|
||||
request(nconf.get('url') + '/api/admin/manage/registration', { jar: jar, json: true }, function (err, res, body) {
|
||||
assert.ifError(err);
|
||||
assert.equal(body.users[0].username, 'rejectme');
|
||||
assert.equal(body.users[0].email, 'reject@me.com');
|
||||
assert.equal(body.users[0].email, '<script>alert("ok");<script>reject@me.com');
|
||||
done();
|
||||
});
|
||||
});
|
||||
@@ -1600,6 +1600,17 @@ describe('User', function () {
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
it('should escape email', function (done) {
|
||||
socketUser.invite({ uid: inviterUid }, '<script>alert("ok");</script>', function (err) {
|
||||
assert.ifError(err);
|
||||
User.getInvites(inviterUid, function (err, data) {
|
||||
assert.ifError(err);
|
||||
assert.equal(data[0], '<script>alert("ok");</script>');
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('email confirm', function () {
|
||||
|
||||
Reference in New Issue
Block a user