diff options
author | Luca Casonato <hello@lcas.dev> | 2024-05-23 00:03:35 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-05-23 00:03:35 +0200 |
commit | 971f09abe486185247e1faf4e8d1419ba2506b8d (patch) | |
tree | 3ed0cf608116ad06e88a87552333e930824cc790 /ext/console | |
parent | 6c167c64d61ecfc912dc1b68d300f02aa3677235 (diff) |
fix(runtime): use more null proto objects (#23921)
This is a primordialization effort to improve resistance against users
tampering with the global `Object` prototype.
---------
Co-authored-by: Bartek IwaĆczuk <biwanczuk@gmail.com>
Diffstat (limited to 'ext/console')
-rw-r--r-- | ext/console/01_console.js | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/ext/console/01_console.js b/ext/console/01_console.js index 2b8075668..32d8d653c 100644 --- a/ext/console/01_console.js +++ b/ext/console/01_console.js @@ -2930,7 +2930,7 @@ function cssToAnsi(css, prevCss = null) { return ansi; } -function inspectArgs(args, inspectOptions = {}) { +function inspectArgs(args, inspectOptions = { __proto__: null }) { const ctx = { ...getDefaultInspectOptions(), colors: inspectOptions.colors ?? !noColorStdout(), @@ -3124,7 +3124,7 @@ class Console { ); }; - dir = (obj = undefined, options = {}) => { + dir = (obj = undefined, options = { __proto__: null }) => { this.#printFunc( inspectArgs([obj], { ...getConsoleInspectOptions(noColorStdout()), @@ -3232,7 +3232,7 @@ class Console { resultData = [...new SafeSetIterator(data)]; } else if (isMapObject) { let idx = 0; - resultData = {}; + resultData = { __proto__: null }; MapPrototypeForEach(data, (v, k) => { resultData[idx] = { Key: k, Values: v }; @@ -3390,7 +3390,7 @@ const customInspect = SymbolFor("Deno.customInspect"); function inspect( value, - inspectOptions = {}, + inspectOptions = { __proto__: null }, ) { // Default options const ctx = { |