Skip to content

Commit e159f6e

Browse files
committed
test: fix defect path traversal tests
The test never actually tested what it claims to test because it did not properly insert separators before `..`.
1 parent 78a1570 commit e159f6e

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

test/fixtures/permission/fs-traversal.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ const path = require('path');
88

99
const blockedFolder = process.env.BLOCKEDFOLDER;
1010
const allowedFolder = process.env.ALLOWEDFOLDER;
11-
const traversalPath = allowedFolder + '../file.md';
12-
const traversalFolderPath = allowedFolder + '../folder';
13-
const bufferTraversalPath = Buffer.from(allowedFolder + '../file.md');
11+
const traversalPath = allowedFolder + '/../file.md';
12+
const traversalFolderPath = allowedFolder + '/../folder';
13+
const bufferTraversalPath = Buffer.from(allowedFolder + '/../file.md');
1414

1515
{
1616
assert.ok(process.permission.has('fs.read', allowedFolder));

test/parallel/test-permission-fs-traversal-path.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ const tmpdir = require('../common/tmpdir');
1818

1919
const file = fixtures.path('permission', 'fs-traversal.js');
2020
const blockedFolder = tmpdir.path;
21-
const allowedFolder = tmpdir.resolve('subdirectory/');
21+
const allowedFolder = tmpdir.resolve('subdirectory');
2222
const commonPathWildcard = path.join(__filename, '../../common*');
2323

2424
{

0 commit comments

Comments
 (0)