Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(node/fs): add missing stat path argument validation #27086

Merged
merged 3 commits into from
Nov 27, 2024

Conversation

marvinhagemeister
Copy link
Contributor

@marvinhagemeister marvinhagemeister commented Nov 26, 2024

We didn't validate the path argument that's passed to fs.stat() and fs.statSync() which lead to wrong errors being thrown. The @rollup/plugin-node-resolve code calls it with undefined quite a lot which lead to nitro and nuxt failing.

Fixes #26700

Copy link
Member

@littledivy littledivy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@kt3k
Copy link
Member

kt3k commented Nov 26, 2024

How about using getValidatedPath util from ext:deno_node/internal/fs/utils.mjs?

Copy link
Member

@kt3k kt3k left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@marvinhagemeister marvinhagemeister merged commit 927352b into main Nov 27, 2024
17 checks passed
@marvinhagemeister marvinhagemeister deleted the fix-invalid-stat branch November 27, 2024 07:35
bartlomieju pushed a commit that referenced this pull request Nov 28, 2024
We didn't validate the `path` argument that's passed to `fs.stat()` and
`fs.statSync()` which lead to wrong errors being thrown. The
`@rollup/plugin-node-resolve` code calls it with `undefined` quite a lot
which lead to `nitro` and `nuxt` failing.

Fixes #26700

---------

Co-authored-by: Yoshiya Hinosawa <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

TypeError when running Nitro project with deno run dev
3 participants