From 2233567331611452985b88ee656427f5a06ca5ac Mon Sep 17 00:00:00 2001 From: Antoine du Hamel Date: Mon, 27 Jun 2022 17:29:10 +0200 Subject: [PATCH] lib: use null-prototype objects for property descriptors PR-URL: https://github.com/nodejs/node/pull/43473 Reviewed-By: Darshan Sen --- lib/buffer.js | 2 ++ lib/internal/webstreams/readablestream.js | 6 +++--- lib/internal/webstreams/util.js | 2 ++ 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/buffer.js b/lib/buffer.js index 734a9a6feb81ca..d5fde6debc2f74 100644 --- a/lib/buffer.js +++ b/lib/buffer.js @@ -132,11 +132,13 @@ addBufferPrototypeMethods(Buffer.prototype); const constants = ObjectDefineProperties({}, { MAX_LENGTH: { + __proto__: null, value: kMaxLength, writable: false, enumerable: true }, MAX_STRING_LENGTH: { + __proto__: null, value: kStringMaxLength, writable: false, enumerable: true diff --git a/lib/internal/webstreams/readablestream.js b/lib/internal/webstreams/readablestream.js index b44df2ff77896d..0e7d33e9b71eb3 100644 --- a/lib/internal/webstreams/readablestream.js +++ b/lib/internal/webstreams/readablestream.js @@ -1181,9 +1181,9 @@ function createTeeReadableStream(start, pull, cancel) { setupReadableStreamDefaultControllerFromSource( this, ObjectCreate(null, { - start: { value: start }, - pull: { value: pull }, - cancel: { value: cancel } + start: { __proto__: null, value: start }, + pull: { __proto__: null, value: pull }, + cancel: { __proto__: null, value: cancel } }), 1, () => 1); diff --git a/lib/internal/webstreams/util.js b/lib/internal/webstreams/util.js index 305064ba05a490..524093dc74df66 100644 --- a/lib/internal/webstreams/util.js +++ b/lib/internal/webstreams/util.js @@ -49,11 +49,13 @@ const kType = Symbol('kType'); const AsyncIterator = ObjectCreate(AsyncIteratorPrototype, { next: { + __proto__: null, configurable: true, enumerable: true, writable: true, }, return: { + __proto__: null, configurable: true, enumerable: true, writable: true,