Skip to content

Commit 03844d9

Browse files
ericfortisaduh95
authored andcommitted
doc: clarify path.isAbsolute is not path traversal mitigation
PR-URL: #57073 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Jordan Harband <ljharb@gmail.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
1 parent 5955aca commit 03844d9

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

doc/api/path.md

+7-5
Original file line numberDiff line numberDiff line change
@@ -317,17 +317,19 @@ added: v0.11.2
317317
* `path` {string}
318318
* Returns: {boolean}
319319

320-
The `path.isAbsolute()` method determines if `path` is an absolute path.
320+
The `path.isAbsolute()` method determines if the literal `path` is absolute.
321+
Therefore, it’s not safe for mitigating path traversals.
321322

322323
If the given `path` is a zero-length string, `false` will be returned.
323324

324325
For example, on POSIX:
325326

326327
```js
327-
path.isAbsolute('/foo/bar'); // true
328-
path.isAbsolute('/baz/..'); // true
329-
path.isAbsolute('qux/'); // false
330-
path.isAbsolute('.'); // false
328+
path.isAbsolute('/foo/bar'); // true
329+
path.isAbsolute('/baz/..'); // true
330+
path.isAbsolute('/baz/../..'); // true
331+
path.isAbsolute('qux/'); // false
332+
path.isAbsolute('.'); // false
331333
```
332334

333335
On Windows:

0 commit comments

Comments
 (0)