Skip to content

Commit

Permalink
test: fix defect path traversal tests
Browse files Browse the repository at this point in the history
The test never actually tested what it claims to test because it did not
properly insert separators before `..`.
  • Loading branch information
tniessen committed Oct 10, 2023
1 parent 78a1570 commit e159f6e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions test/fixtures/permission/fs-traversal.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ const path = require('path');

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(allowedFolder + '/../file.md');

{
assert.ok(process.permission.has('fs.read', allowedFolder));
Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-permission-fs-traversal-path.js
Original file line number Diff line number Diff line change
Expand Up @@ -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*');

{
Expand Down

0 comments on commit e159f6e

Please sign in to comment.