| 1 | const assert = require('assert'); |
| 2 | const tmp = require('../lib/tmp'); |
| 3 | |
| 4 | describe('GHSA-ph9p-34f9-6g65', function () { |
| 5 | describe('#fileSync with attacker `prefix`', function () { |
| 6 | it('should not allow such prefixes', function (done) { |
| 7 | assert.throws(function () { |
| 8 | tmp.fileSync({ prefix: "../foo"}); |
| 9 | }, new RegExp('^Error: Relative value not allowed')); |
| 10 | |
| 11 | done(); |
| 12 | }); |
| 13 | }); |
| 14 | |
| 15 | describe('#fileSync with attacker `postfix`', function () { |
| 16 | it('should not allow such prefixes', function (done) { |
| 17 | assert.throws(function () { |
| 18 | tmp.fileSync({ postfix: "../foo"}); |
| 19 | }, new RegExp('^Error: Relative value not allowed')); |
| 20 | |
| 21 | done(); |
| 22 | }); |
| 23 | }); |
| 24 | }); |