test: fix defect path traversal tests

The test never actually tested what it claims to test because it did not
properly insert separators before `..`.

PR-URL: https://github.com/nodejs/node/pull/50124
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
This commit is contained in:
Tobias Nießen authored and Michaël Zasso committed 2023-10-23 08:19:30 +02:00
1 parent 5df3d5abcc
commit ae905a8f35
2 files changed
+4 -4

No files matched your search

+3 -3
View File
@@ -12,9 +12,9 @@ path.resolve = (s) => s;
const blockedFolder = process.env.BLOCKEDFOLDER;
const allowedFolder = process.env.ALLOWEDFOLDER;
const traversalPath = allowedFolder + '../file.md';
const traversalFolderPath = allowedFolder + '../folder';
const bufferTraversalPath = Buffer.from(allowedFolder + '../file.md');
const traversalPath = allowedFolder + '/../file.md';
const traversalFolderPath = allowedFolder + '/../folder';
const bufferTraversalPath = Buffer.from(traversalPath);
const uint8ArrayTraversalPath = new TextEncoder().encode(traversalPath);
{
@@ -18,7 +18,7 @@ const tmpdir = require('../common/tmpdir');
const file = fixtures.path('permission', 'fs-traversal.js');
const blockedFolder = tmpdir.path;
const allowedFolder = tmpdir.resolve('subdirectory/');
const allowedFolder = tmpdir.resolve('subdirectory');
const commonPathWildcard = path.join(__filename, '../../common*');
{