@mikro-orm/core 6.6.16-dev.1 → 6.6.16

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.
@@ -37,6 +37,10 @@ class EntityAssigner {
37
37
  return entity;
38
38
  }
39
39
  static assignProperty(entity, propName, props, data, options) {
40
+ // needs to happen before the `props` lookup, as those keys resolve to inherited accessors
41
+ if (Utils_1.DANGEROUS_PROPERTY_NAMES.includes(propName)) {
42
+ return;
43
+ }
40
44
  let value = data[propName];
41
45
  const onlyProperties = options.onlyProperties && !(propName in props);
42
46
  const ignoreUndefined = options.ignoreUndefined === true && value === undefined;
package/index.mjs CHANGED
@@ -39,6 +39,7 @@ export const ConstraintViolationException = mod.ConstraintViolationException;
39
39
  export const CreateRequestContext = mod.CreateRequestContext;
40
40
  export const Cursor = mod.Cursor;
41
41
  export const CursorError = mod.CursorError;
42
+ export const DANGEROUS_PROPERTY_NAMES = mod.DANGEROUS_PROPERTY_NAMES;
42
43
  export const DatabaseDriver = mod.DatabaseDriver;
43
44
  export const DatabaseObjectExistsException = mod.DatabaseObjectExistsException;
44
45
  export const DatabaseObjectNotFoundException = mod.DatabaseObjectNotFoundException;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mikro-orm/core",
3
- "version": "6.6.16-dev.1",
3
+ "version": "6.6.16",
4
4
  "description": "TypeScript ORM for Node.js based on Data Mapper, Unit of Work and Identity Map patterns. Supports MongoDB, MySQL, PostgreSQL and SQLite databases as well as usage with vanilla JavaScript.",
5
5
  "main": "index.js",
6
6
  "module": "index.mjs",
@@ -64,7 +64,7 @@
64
64
  "esprima": "4.0.1",
65
65
  "fs-extra": "11.3.3",
66
66
  "globby": "11.1.0",
67
- "mikro-orm": "6.6.16-dev.1",
67
+ "mikro-orm": "6.6.16",
68
68
  "reflect-metadata": "0.2.2"
69
69
  }
70
70
  }
package/utils/Utils.d.ts CHANGED
@@ -4,6 +4,18 @@ import type { Collection } from '../entity/Collection';
4
4
  import type { Platform } from '../platforms';
5
5
  import { ScalarReference } from '../entity/Reference';
6
6
  export declare const ObjectBindingPattern: unique symbol;
7
+ /**
8
+ * List of property names that could lead to prototype pollution vulnerabilities.
9
+ * These names should never be used as entity property names because they could
10
+ * allow malicious code to modify object prototypes when property values are assigned.
11
+ *
12
+ * - `__proto__`: Could modify the prototype chain
13
+ * - `constructor`: Could modify the constructor property
14
+ * - `prototype`: Could modify the prototype object
15
+ *
16
+ * @internal
17
+ */
18
+ export declare const DANGEROUS_PROPERTY_NAMES: readonly string[];
7
19
  export declare function compareObjects(a: any, b: any): boolean;
8
20
  export declare function compareArrays(a: any[] | string, b: any[] | string): boolean;
9
21
  export declare function compareBooleans(a: unknown, b: unknown): boolean;
package/utils/Utils.js CHANGED
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.Utils = exports.ObjectBindingPattern = void 0;
6
+ exports.Utils = exports.DANGEROUS_PROPERTY_NAMES = exports.ObjectBindingPattern = void 0;
7
7
  exports.compareObjects = compareObjects;
8
8
  exports.compareArrays = compareArrays;
9
9
  exports.compareBooleans = compareBooleans;
@@ -26,6 +26,18 @@ const Reference_1 = require("../entity/Reference");
26
26
  const ArrayCollection_1 = require("../entity/ArrayCollection");
27
27
  const EntityHelper_1 = require("../entity/EntityHelper");
28
28
  exports.ObjectBindingPattern = Symbol('ObjectBindingPattern');
29
+ /**
30
+ * List of property names that could lead to prototype pollution vulnerabilities.
31
+ * These names should never be used as entity property names because they could
32
+ * allow malicious code to modify object prototypes when property values are assigned.
33
+ *
34
+ * - `__proto__`: Could modify the prototype chain
35
+ * - `constructor`: Could modify the constructor property
36
+ * - `prototype`: Could modify the prototype object
37
+ *
38
+ * @internal
39
+ */
40
+ exports.DANGEROUS_PROPERTY_NAMES = ['__proto__', 'constructor', 'prototype'];
29
41
  function compareConstructors(a, b) {
30
42
  if (a.constructor === b.constructor) {
31
43
  return true;
@@ -293,7 +305,7 @@ class Utils {
293
305
  const source = sources.shift();
294
306
  if (Utils.isObject(target) && Utils.isPlainObject(source)) {
295
307
  for (const [key, value] of Object.entries(source)) {
296
- if (['__proto__', 'constructor', 'prototype'].includes(key)) {
308
+ if (exports.DANGEROUS_PROPERTY_NAMES.includes(key)) {
297
309
  continue;
298
310
  }
299
311
  if (ignoreUndefined && typeof value === 'undefined') {