1
0
Fork 0

test the security fix

This commit is contained in:
Enoch Riese 2022-12-08 20:06:22 -06:00
parent 08f1dcdaba
commit 4f42f4038c
2 changed files with 13 additions and 1 deletions

View file

@ -33,6 +33,18 @@ describe('Pattern', () => {
expect(count).to.equal(2)
})
})
describe('Pattern.createPartForSet()', () => {
it('Should not allow malicious assignment to Object.prototype', () => {
const objProto = Object.prototype
const Pattern = new Design()
const pattern = new Pattern()
expect(() => pattern.createPartForSet('part', '__proto__')).to.throw(
'malicious attempt at altering Object.prototype. Stopping action'
)
expect(objProto).to.equal(Object.prototype)
})
})
it('Should check whether a part is needed', () => {
const partA = {
name: 'test.partA',