GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — vfs: enforce readonly state on open handles by harjothkhara · Pull Request #64403 · nodejs/node

Conversation

@harjothkhara

@harjothkhara harjothkhara commented Jul 10, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

MemoryProvider.setReadOnly() prevented new writable handles from being opened,
but handles opened before the transition retained write access. This allowed
descriptor-based writes and truncation to bypass the provider's documented
read-only state.

Pass a live provider-state callback to MemoryFileHandle and check it at each
mutation primitive. This covers descriptor and direct-handle operations,
including delegated async, vector, and append-mode writes, while preserving
EBADF precedence for handles that were not opened for writing.

Regression tests cover:

  • writeSync() and ftruncateSync() through pre-existing descriptors
  • append-mode descriptors opened before setReadOnly()
  • async handle write(), writeFile(), truncate(), and writev()
  • unchanged file contents after rejected mutations

Validation:

  • python3 tools/test.py test/parallel/test-vfs-memory-provider.js test/parallel/test-vfs-memory-file-handle.js
  • JavaScript lint on the three changed files

Fixes: #64401

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@nodejs-github-bot nodejs-github-bot added needs-ci PRs that need a full CI run. vfs Issues and PRs related to the virtual filesystem subsystem. labels Jul 10, 2026
@harjothkhara
harjothkhara marked this pull request as ready for review July 10, 2026 05:20
@harjothkhara

harjothkhara commented Jul 10, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor Author

Tested this end to end.

Before the fix: the example from #64401 still writes to the file after it's set read-only — bug confirmed.

After the fix: that write is blocked with EROFS, the file is unchanged, and the new test passes. All 97 vfs tests pass and lint is clean.

Other write paths (truncate, append, write streams) are blocked too, and read-only handles still give the original EBADF.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@codecov

codecov Bot commented Jul 26, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.49%. Comparing base (62ca1ba) to head (298698e).
⚠️ Report is 13 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #64403      +/-   ##
==========================================
- Coverage   90.51%   90.49%   -0.03%     
==========================================
  Files         797      797              
  Lines      277688   277706      +18     
  Branches    53356    53353       -3     
==========================================
- Hits       251338   251297      -41     
- Misses      16753    16798      +45     
- Partials     9597     9611      +14     
Files with missing lines Coverage Δ
lib/internal/vfs/file_handle.js 99.49% <100.00%> (+<0.01%) ⬆️
lib/internal/vfs/providers/memory.js 95.89% <100.00%> (+0.03%) ⬆️

... and 31 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@harjothkhara

harjothkhara commented Aug 15, 2026

Copy link
Copy Markdown
Contributor Author

@trivikr @mcollina could one of you take a look? This fixes #64401. CI passed on 2026-07-26 and all new lines are covered.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@trivikr

trivikr commented Aug 15, 2026

Copy link
Copy Markdown
Member

vfs is having a big change in #63653, and many PRs are waiting for it to land.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@harjothkhara

harjothkhara commented Oct 14, 2026

Copy link
Copy Markdown
Contributor Author

@trivikr @mcollina this was waiting on #63653, which closed on Aug 31 without landing. Is this reviewable now, or should I rework it to fit the current vfs direction (#65798)? I can rebase and re-run CI.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@mcollina

mcollina commented Oct 15, 2026

Copy link
Copy Markdown
Member

@harjothkhara it was actually landed manually. If you rebase, this can move.

harjothkhara reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@harjothkhara
vfs: enforce readonly state on open handles
298698e
Signed-off-by: harjoth <[email protected]>
Fixes: nodejs#64401
Assisted-by: Codex
@harjothkhara
harjothkhara force-pushed the codex/fix-vfs-readonly-handles branch from 78a5dec to 298698e Compare October 17, 2026 02:27
@harjothkhara

harjothkhara commented Oct 17, 2026

Copy link
Copy Markdown
Contributor Author

Thanks @mcollina, my mistake on #63653. Rebased on main.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

mcollina
mcollina approved these changes Oct 17, 2026
View reviewed changes

@mcollina mcollina left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

lgtm

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@mcollina mcollina added the request-ci Add this label to start a Jenkins CI on a PR. Only starts once the PR has an approving review. label Oct 17, 2026
@github-actions github-actions Bot removed the request-ci Add this label to start a Jenkins CI on a PR. Only starts once the PR has an approving review. label Oct 17, 2026
@nodejs-github-bot

nodejs-github-bot commented Oct 17, 2026

Copy link
Copy Markdown
Collaborator

CI: https://ci.nodejs.org/job/node-test-pull-request/78458/

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@trivikr trivikr added author ready PRs with CI started, the required approvals, and no outstanding review comments. commit-queue PRs queued for automated landing through the Commit Queue. labels Oct 19, 2026
@nodejs-github-bot
nodejs-github-bot merged commit 06550c7 into nodejs:main Oct 19, 2026
71 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@nodejs-github-bot

nodejs-github-bot commented Oct 19, 2026

Copy link
Copy Markdown
Collaborator

Landed in 06550c7

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@nodejs-github-bot nodejs-github-bot removed the commit-queue PRs queued for automated landing through the Commit Queue. label Oct 19, 2026
@saqibsafwan4-code

This comment was marked as off-topic.

Sign in to view
@aduh95 aduh95 mentioned this pull request Oct 27, 2026
2026-10-28, Version 27.0.0-alpha.0.0.0 (Alpha) #67062
Merged
aduh95 pushed a commit that referenced this pull request Nov 12, 2026
@harjothkhara @aduh95
vfs: enforce readonly state on open handles
7eb0f7a
Signed-off-by: harjoth <[email protected]>
Fixes: #64401
Assisted-by: Codex
PR-URL: #64403
Reviewed-By: Matteo Collina <[email protected]>
@github-actions github-actions Bot mentioned this pull request Nov 20, 2026
2026-11-30, Version 26.14.0 'Lithium' (LTS) #67664
Open
gabylb pushed a commit to gabylb/node that referenced this pull request Nov 27, 2026
@harjothkhara @gabylb
vfs: enforce readonly state on open handles
b1f10d4
Signed-off-by: harjoth <[email protected]>
Fixes: nodejs#64401
Assisted-by: Codex
PR-URL: nodejs#64403
Reviewed-By: Matteo Collina <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@mcollina mcollina mcollina approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

author ready PRs with CI started, the required approvals, and no outstanding review comments. needs-ci PRs that need a full CI run. vfs Issues and PRs related to the virtual filesystem subsystem.

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

vfs: MemoryProvider.setReadOnly() does not prevent writes through existing file descriptors

Uh oh!

There was an error while loading. Please reload this page.

5 participants

@harjothkhara @trivikr @mcollina @nodejs-github-bot @saqibsafwan4-code
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.