mirror of
https://github.com/zebrajr/node.git
synced 2026-01-15 12:15:26 +00:00
doc: clarify path.isAbsolute is not path traversal mitigation
PR-URL: https://github.com/nodejs/node/pull/57073 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Jordan Harband <ljharb@gmail.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
This commit is contained in:
@@ -317,17 +317,19 @@ added: v0.11.2
|
||||
* `path` {string}
|
||||
* Returns: {boolean}
|
||||
|
||||
The `path.isAbsolute()` method determines if `path` is an absolute path.
|
||||
The `path.isAbsolute()` method determines if the literal `path` is absolute.
|
||||
Therefore, it’s not safe for mitigating path traversals.
|
||||
|
||||
If the given `path` is a zero-length string, `false` will be returned.
|
||||
|
||||
For example, on POSIX:
|
||||
|
||||
```js
|
||||
path.isAbsolute('/foo/bar'); // true
|
||||
path.isAbsolute('/baz/..'); // true
|
||||
path.isAbsolute('qux/'); // false
|
||||
path.isAbsolute('.'); // false
|
||||
path.isAbsolute('/foo/bar'); // true
|
||||
path.isAbsolute('/baz/..'); // true
|
||||
path.isAbsolute('/baz/../..'); // true
|
||||
path.isAbsolute('qux/'); // false
|
||||
path.isAbsolute('.'); // false
|
||||
```
|
||||
|
||||
On Windows:
|
||||
|
||||
Reference in New Issue
Block a user