Skip to content

[v26.x backport] vm: fix property queries for proxy sandboxes#63741

Open
brianathere wants to merge 1 commit into
nodejs:v26.x-stagingfrom
brianathere:fix-v26-vm-proxy-hasown
Open

[v26.x backport] vm: fix property queries for proxy sandboxes#63741
brianathere wants to merge 1 commit into
nodejs:v26.x-stagingfrom
brianathere:fix-v26-vm-proxy-hasown

Conversation

@brianathere
Copy link
Copy Markdown

@brianathere brianathere commented Jun 3, 2026

Backport of #63742 to v26.x-staging.

Fixes: #63739
Refs: #63549

This updates the vm contextify named property query path to inspect own property descriptors on the sandbox object instead of using HasRealNamedProperty() for that sandbox lookup. The previous lookup cannot see properties through a JSProxy, which made Proxy-backed vm sandboxes report false for hasOwnProperty, Object.hasOwn, in, and Reflect.has even when the property was readable, listed, and had an own descriptor.

The fallback lookup on the real global proxy remains unchanged for properties that are not own properties of the sandbox.

Added a regression test for a Proxy sandbox with writable, non-enumerable, and readonly own properties, plus prototype fallback sanity checks.

Validation on v26.x/v26.x-staging branch:

  • ninja -C out/Release -j12 node
  • ./out/Release/node test/parallel/test-vm-proxy-sandbox-property-query.js
  • python3 tools/test.py -J --mode=release parallel/test-vm-proxy-sandbox-property-query parallel/test-vm-property-definer-interception parallel/test-vm-global-property-interceptors
  • git diff --check HEAD~1..HEAD
  • External minimal repro: stock v26.3.0 fails, patched branch passes
  • External Jest fake-timers repro: patched branch passes both tests

@nodejs-github-bot 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. v26.x Issues that can be reproduced on v26.x or PRs targeting the v26.x-staging branch. vm Issues and PRs related to the vm subsystem. labels Jun 3, 2026
Signed-off-by: Brian Meek <55990082+brianathere@users.noreply.github.com>
@brianathere brianathere force-pushed the fix-v26-vm-proxy-hasown branch from f9bbe90 to 5f641d0 Compare June 4, 2026 00:02
@brianathere brianathere changed the title vm: fix property queries for proxy sandboxes [v26.x backport] vm: fix property queries for proxy sandboxes Jun 4, 2026
@brianathere brianathere changed the base branch from v26.x to v26.x-staging June 4, 2026 00:16
Copy link
Copy Markdown
Member

@legendecas legendecas left a comment

Choose a reason for hiding this comment

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

Backports must wait until the original change lands on the main branch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

c++ Issues and PRs that require attention from people who are familiar with C++. needs-ci PRs that need a full CI run. v26.x Issues that can be reproduced on v26.x or PRs targeting the v26.x-staging branch. vm Issues and PRs related to the vm subsystem.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants