Skip to content

fix: isolate walk state from Object prototype#2703

Merged
fatso83 merged 3 commits into
sinonjs:mainfrom
LaplaceYoung:fix/walk-seen-prototype-pollution
May 5, 2026
Merged

fix: isolate walk state from Object prototype#2703
fatso83 merged 3 commits into
sinonjs:mainfrom
LaplaceYoung:fix/walk-seen-prototype-pollution

Conversation

@LaplaceYoung
Copy link
Copy Markdown

Summary

  • Initialize walk()'s visited-name table with a null prototype so inherited Object.prototype properties cannot interfere with tracking.
  • Add source-level and issue-level regression coverage for sinon.stub() when Object.prototype has an inherited non-writable property.
  • Make the local build, Node test, and lint commands run on Windows by invoking the local Rollup CLI and using cross-platform globs.

Verification

  • npm run test-node (1534 passing, 12 pending)
  • npm run lint
  • npx prettier --check build.cjs rollup.config.mjs package.json src/sinon/util/core/walk.js test/src/util/core/walk-test.js test/issues/issues-test.js
  • Source reproduction script now prints stub created

Fixes #2702

Comment thread rollup.config.mjs Outdated
@fatso83 fatso83 force-pushed the fix/walk-seen-prototype-pollution branch from b76efdd to f7476b5 Compare May 5, 2026 19:57
@fatso83 fatso83 merged commit 1519009 into sinonjs:main May 5, 2026
9 checks passed
@fatso83
Copy link
Copy Markdown
Contributor

fatso83 commented May 5, 2026

Thank you!

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.

stub() throws when Object.prototype has a non-writable property

2 participants