|
@@ -62,6 +62,31 @@ describe('EmailBuilder', function () {
|
|
|
})
|
|
})
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
|
|
+ describe('when dealing with escaping', function () {
|
|
|
|
|
+ it("should not show possessive 's as '", function () {
|
|
|
|
|
+ this.opts.project.name = "Aktöbe's project"
|
|
|
|
|
+ this.email = this.EmailBuilder.buildEmail('projectInvite', this.opts)
|
|
|
|
|
+ expect(this.email.subject).to.not.contain(''')
|
|
|
|
|
+ expect(this.email.subject).to.contain(this.opts.project.name)
|
|
|
|
|
+ })
|
|
|
|
|
+
|
|
|
|
|
+ it('should not show an ampersand as &', function () {
|
|
|
|
|
+ this.opts.project.name = 'Aktöbe & Almaty project'
|
|
|
|
|
+ this.email = this.EmailBuilder.buildEmail('projectInvite', this.opts)
|
|
|
|
|
+ expect(this.email.subject).to.not.contain('&')
|
|
|
|
|
+ expect(this.email.subject).to.contain(this.opts.project.name)
|
|
|
|
|
+ })
|
|
|
|
|
+
|
|
|
|
|
+ it('should prevent dangerous characters as project names', function () {
|
|
|
|
|
+ const characters = ['""', '<>', '//']
|
|
|
|
|
+ for (const pair of characters) {
|
|
|
|
|
+ this.opts.project.name = `${pair} project`
|
|
|
|
|
+ this.email = this.EmailBuilder.buildEmail('projectInvite', this.opts)
|
|
|
|
|
+ expect(this.email.subject).to.not.contain(pair)
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
|
|
+ })
|
|
|
|
|
+
|
|
|
describe('when someone is up to no good', function () {
|
|
describe('when someone is up to no good', function () {
|
|
|
it('should not contain the project name at all if unsafe', function () {
|
|
it('should not contain the project name at all if unsafe', function () {
|
|
|
this.opts.project.name = "<img src='http://evilsite.com/evil.php'>"
|
|
this.opts.project.name = "<img src='http://evilsite.com/evil.php'>"
|