| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
|
Review requested:
|
Sorry, something went wrong.
|
cc @nodejs/platform-windows Any idea where this error/warning is thrown from? |
Sorry, something went wrong.
|
AFAICT the changes are implying that getValidatedPath() should do path.ToNamespacedPath() internally, but there's no changes to getValidatedPath() itself in this PR. Does it happen implicitly? If yes, on which step? |
Sorry, something went wrong.
getValidatedPath() result is called with toNamespacedPath() to ensure Windows long paths are handled correctly. I didn't quite understand your comment, but this pull request basically replaces toNamespacedPath(getValidatedPath(input)) with getValidatedPath(input) and calls toNamespacedPath from C++ |
Sorry, something went wrong.
Sorry, I read the changes wrong. It doesn't affect js-side toNamespacedPath() itself but adds cpp-side version that is used in cpp implementations for each fs method. |
Sorry, something went wrong.
Sorry, something went wrong.
There was a problem hiding this comment.
As @joyeecheung suggested on my initial PR for node::pathResolve, I suggest you do the same for path.toNamespacePath. Change the bindings in a different PR and run the tests to see if it works.
Example: #51295
Sorry, something went wrong.
|
@RafaelGSS the function signature is not 1 to 1. We're always using BufferValue in node:fs. |
Sorry, something went wrong.
|
I think this is different from #51295 in that, the other PR only used the C++ version in a not very well-tested branch (only when permission is enabled) so if it's broken, we may not be able to know due to the low test coverage. This PR however changed most fs bindings so if it's broken, it's probably more likely that some tests would fail on Windows. That said I think we already don't have enough test cases to check the kind of paths that are need to be handled specially by toNamespacedPath(). Perhaps it would be useful to check the cases in #51097 too |
Sorry, something went wrong.
|
@RafaelGSS can you look into the permission model changes? I removed an unnecessary test since we don't use path.toNamespacedPath anymore in JS world, and updated several paths and surrounded them with path.toNamespacedPath() |
Sorry, something went wrong.
Sorry, something went wrong.
| })); | ||
| } | ||
|
|
||
| // Monkey-patching path module should also not allow path traversal. |
There was a problem hiding this comment.
Regardless if we are moving the implementation to C++ I believe path.toNamespacedPath will always exist through an API right? If so, I don't think we should remove this test, it won't fail anyway.
Sorry, something went wrong.
There was a problem hiding this comment.
I think its not needed but on top of that It fails because win32 path resolves return "." for cwd, but previously it didn't.
Sorry, something went wrong.
| assert.strictEqual(fs.existsSync(pathname), true); | ||
| assert.strictEqual(fs.statSync(pathname).isDirectory(), true); | ||
| assert.strictEqual(p, firstPathCreated); | ||
| assert.strictEqual(p, path.toNamespacedPath(firstPathCreated)); |
There was a problem hiding this comment.
Can you explain why we are changing the comparison to include the path.toNamespacedPath? Did tmpdir.resolve API change somehow? If so, isn't it a breaking change?
Sorry, something went wrong.
There was a problem hiding this comment.
Technically it isn't since both paths are the same and from Windows perspective having a path with namespaced value does not really have any difference with without the prefix.
PS: Namespaced paths are used to avoid "path is too long" errors on Windows. If you look into this file, you'll see that we already check the value surrounded by toNamespacedPath in several places already. I feel like this is more complete.
Sorry, something went wrong.
Sorry, something went wrong.
Sorry, something went wrong.
Co-Authored-By: Daniel Lemire <daniel@lemire.me> PR-URL: #52135 Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com> Reviewed-By: Vinícius Lourenço Claro Cardoso <contact@viniciusl.com.br> Reviewed-By: Daniel Lemire <daniel@lemire.me> Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Co-Authored-By: Daniel Lemire <daniel@lemire.me> PR-URL: nodejs#52135 Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com> Reviewed-By: Vinícius Lourenço Claro Cardoso <contact@viniciusl.com.br> Reviewed-By: Daniel Lemire <daniel@lemire.me> Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
This is a step forward to move all node:fs implementation to C++. Since we now have support for win32.pathResolve() in C++, we can move forward with moving ToNamespacedPath functions to C++.
In a follow up pull-request, I'll move FromNamespacedPath() from node_url.cc to path.cc
cc @nodejs/fs @RafaelGSS