最終更新:2023-12-25 (月) 19:54:56 (145d)
path.normalize
Top / path.normalize
normalizes the given path, resolving '..' and '.' segments.
https://nodejs.org/api/path.html#pathnormalizepath
メモ
- https://www.stackhawk.com/blog/node-js-path-traversal-guide-examples-and-prevention/
var safe_input = path.normalize(user_input).replace(/^(\.\.(\/|\\|$))+/, '');
- https://security.stackexchange.com/questions/123720/how-to-prevent-directory-traversal-when-joining-paths-in-node-js