FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

permission: fix some vulnerabilities in fs by tniessen · Pull Request #47091 · nodejs/node · GitHub

/ node Public

permission: fix some vulnerabilities in fs - #47091

Merged
nodejs-github-bot merged 1 commit into
nodejs:mainfrom
tniessen:permission-fix-some-fatal-flaws-in-fs-open
Mar 19, 2023
Merged

permission: fix some vulnerabilities in fs#47091
nodejs-github-bot merged 1 commit into
nodejs:mainfrom
tniessen:permission-fix-some-fatal-flaws-in-fs-open

Conversation

tniessen commented Mar 14, 2023
edited
Loading

Copy link
Copy Markdown
Member

Without this patch, any restrictions imposed by the permission model can be easily bypassed, granting full read and write access to any file. On Windows, this could even be used to delete files that are supposed to be write-protected.

This likely also fixes a separate bug in fsPromises.open(), which currently incorrectly requires read permissions even for write-only access. (Unless that was somehow intentional?)

I'm not very confident in my understanding of the permission model. Please review carefully.

Fixes: #47090

tniessen added fs Issues and PRs related to the fs subsystem / file system. security Issues and PRs related to security. labels Mar 14, 2023
nodejs-github-bot added c++ Issues and PRs that require attention from people who are familiar with C++. needs-ci PRs that need a full CI run. labels Mar 14, 2023
tniessen requested a review from RafaelGSS March 14, 2023 20:44
RafaelGSS added the request-ci Add this label to start a Jenkins CI on a PR. label Mar 14, 2023
github-actions Bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Mar 14, 2023

Copy link
Copy Markdown
Collaborator

RafaelGSS left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Good catch. I wasn't aware of write_as_side_effects. That's indeed bizarre.

Comment thread src/node_file.cc Outdated
Comment thread src/node_file.cc Outdated

RafaelGSS left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

LGTM.

tniessen added the author ready PRs that have at least one approval, no outstanding review comments, and a CI started. label Mar 15, 2023
Without this patch, any restrictions imposed by the permission model can
be easily bypassed, granting full read and write access to any file. On
Windows, this could even be used to delete files that are supposed to be
write-protected.

Fixes: nodejs#47090
tniessen force-pushed the permission-fix-some-fatal-flaws-in-fs-open branch from c291faa to 233eb62 Compare March 15, 2023 19:05

Copy link
Copy Markdown
Member Author

I changed the implementation to follow V8 conventions as suggested by @targos and @addaleax. The diff is in c291faa8f7a78aff418a9784b98647b69f651c08.

RafaelGSS added the request-ci Add this label to start a Jenkins CI on a PR. label Mar 15, 2023
github-actions Bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Mar 15, 2023

This comment was marked as outdated.

This comment was marked as outdated.

Copy link
Copy Markdown
Member Author

Both Jenkins CI runs failed on Windows due to test-http-max-sockets, which also failed in #47108, so it seems unrelated.

This comment was marked as outdated.

This comment was marked as outdated.

Copy link
Copy Markdown
Member Author

It might be good to get more eyes on this, perhaps from @nodejs/libuv since especially the behavior on Windows depends more on how libuv translates flags than on Windows itself.

tniessen added the request-ci Add this label to start a Jenkins CI on a PR. label Mar 17, 2023
github-actions Bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Mar 17, 2023

This comment was marked as outdated.

This comment was marked as outdated.

This comment was marked as outdated.

This comment was marked as outdated.

Copy link
Copy Markdown
Collaborator

tniessen added the commit-queue Add this label to land a pull request using GitHub Actions. label Mar 19, 2023
nodejs-github-bot removed the commit-queue Add this label to land a pull request using GitHub Actions. label Mar 19, 2023
nodejs-github-bot merged commit aa30e16 into nodejs:main Mar 19, 2023

Copy link
Copy Markdown
Collaborator

Landed in aa30e16

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

author ready PRs that have at least one approval, no outstanding review comments, and a CI started. c++ Issues and PRs that require attention from people who are familiar with C++. fs Issues and PRs related to the fs subsystem / file system. needs-ci PRs that need a full CI run. permission Issues and PRs related to the Permission Model security Issues and PRs related to security.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Permission logic in fs.open(), fs.openSync(), and fsPromises.open() can easily be bypassed

7 participants


Back | FazBrowse Home | New Git URL