i18next-http-middleware 3.9.8 → 3.9.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/cjs/utils.js CHANGED
@@ -66,7 +66,7 @@ function setPath(object, path, newValue) {
66
66
  var _key = stack.shift();
67
67
  if (_key.indexOf('###') > -1) _key = _key.replace(/###/g, '.');
68
68
  if (UNSAFE_KEYS.indexOf(_key) > -1) return;
69
- if (!object[_key]) object[_key] = {};
69
+ if (!Object.prototype.hasOwnProperty.call(object, _key)) object[_key] = {};
70
70
  object = object[_key];
71
71
  }
72
72
  var key = stack.shift();
package/esm/utils.js CHANGED
@@ -49,7 +49,7 @@ export function setPath(object, path, newValue) {
49
49
  var _key = stack.shift();
50
50
  if (_key.indexOf('###') > -1) _key = _key.replace(/###/g, '.');
51
51
  if (UNSAFE_KEYS.indexOf(_key) > -1) return;
52
- if (!object[_key]) object[_key] = {};
52
+ if (!Object.prototype.hasOwnProperty.call(object, _key)) object[_key] = {};
53
53
  object = object[_key];
54
54
  }
55
55
  var key = stack.shift();
package/lib/utils.js CHANGED
@@ -73,7 +73,10 @@ export function setPath (object, path, newValue) {
73
73
  let key = stack.shift()
74
74
  if (key.indexOf('###') > -1) key = key.replace(/###/g, '.')
75
75
  if (UNSAFE_KEYS.indexOf(key) > -1) return // guard against prototype pollution
76
- if (!object[key]) object[key] = {}
76
+ // descend only into OWN properties. Inherited members (hasOwnProperty,
77
+ // valueOf, …) are truthy, so `!object[key]` skipped autovivify and the
78
+ // walk landed on Object.prototype. (GHSA-r4j4-5cw9-pwgj)
79
+ if (!Object.prototype.hasOwnProperty.call(object, key)) object[key] = {}
77
80
  object = object[key]
78
81
  }
79
82
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "i18next-http-middleware",
3
- "version": "3.9.8",
3
+ "version": "3.9.9",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "main": "./cjs/index.js",
@@ -47,7 +47,7 @@
47
47
  "eslint-plugin-standard": "5.0.0",
48
48
  "expect.js": "0.3.1",
49
49
  "express": "5.2.1",
50
- "fastify": "5.8.5",
50
+ "fastify": "5.12.1",
51
51
  "i18next": "26.0.5",
52
52
  "mocha": "11.7.5",
53
53
  "preact": "10.29.1",