1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00
node-red/packages/node_modules/@node-red/nodes/core
Alexandre Alapetite e55cbb3e3d
Fix bug in debug node due to msg.hasOwnProperty construct
`msg.hasOwnProperty("status")` might make the debug node crash/produce an error if the payload was created with `Object.create(null)`.
This is the case e.g. for `ini` (to parse INI files), an official NPM node:
4f289946b3/lib/ini.js (L63)

My Node-RED node `node-red-contrib-parser-ini`, which is using that library, was hit by this bug and I had to ship a workaround
fe6b1eb4b1/parser-ini.js (L14)

The `msg.hasOwnProperty("xxx")` construct should not be used since ECMAScript 5.1.

ESLint advises in the same direction https://eslint.org/docs/rules/no-prototype-builtins

This patch was produced using the following regex:
Search: `\b([\w.]+).hasOwnProperty\(`
Replace: `Object.prototype.hasOwnProperty.call($1, `

This could be applied more gobally if desired.
2022-02-03 02:01:22 +01:00
..
common Fix bug in debug node due to msg.hasOwnProperty construct 2022-02-03 02:01:22 +01:00
function Add _path property to nodes and expose as node.path in Function node 2022-01-25 21:32:28 +00:00
network Merge branch 'dev' into mqtt-reconnect-fix 2022-01-25 12:32:49 +00:00
parsers Let JSON parser attempt to parse buffers if they contain strings 2021-12-10 15:21:43 +00:00
sequence Renamed resetTimeout to restartTimeout 2021-08-25 21:53:37 +02:00
storage chaneg exec, file and inject node to use node.debug rather than -v flag 2021-12-17 09:58:10 +00:00