@mikro-orm/core 7.1.7 → 7.2.0-dev.0
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/entity/EntityAssigner.js +1 -5
- package/metadata/MetadataValidator.js +13 -1
- package/package.json +1 -1
- package/utils/Utils.d.ts +0 -12
- package/utils/Utils.js +2 -14
package/entity/EntityAssigner.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Collection } from './Collection.js';
|
|
2
|
-
import {
|
|
2
|
+
import { Utils } from '../utils/Utils.js';
|
|
3
3
|
import { Reference } from './Reference.js';
|
|
4
4
|
import { ReferenceKind, SCALAR_TYPES } from '../enums.js';
|
|
5
5
|
import { validateProperty } from './validators.js';
|
|
@@ -35,10 +35,6 @@ export class EntityAssigner {
|
|
|
35
35
|
return entity;
|
|
36
36
|
}
|
|
37
37
|
static assignProperty(entity, propName, props, data, options) {
|
|
38
|
-
// needs to happen before the `props` lookup, as those keys resolve to inherited accessors
|
|
39
|
-
if (DANGEROUS_PROPERTY_NAMES.includes(propName)) {
|
|
40
|
-
return;
|
|
41
|
-
}
|
|
42
38
|
let value = data[propName];
|
|
43
39
|
const onlyProperties = options.onlyProperties && !(propName in props);
|
|
44
40
|
const ignoreUndefined = options.ignoreUndefined === true && value === undefined;
|
|
@@ -1,7 +1,19 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Utils } from '../utils/Utils.js';
|
|
2
2
|
import { normalizePartitionNameForComparison, splitCommaSeparatedIdentifiers } from '../utils/partition-utils.js';
|
|
3
3
|
import { MetadataError } from '../errors.js';
|
|
4
4
|
import { ReferenceKind } from '../enums.js';
|
|
5
|
+
/**
|
|
6
|
+
* List of property names that could lead to prototype pollution vulnerabilities.
|
|
7
|
+
* These names should never be used as entity property names because they could
|
|
8
|
+
* allow malicious code to modify object prototypes when property values are assigned.
|
|
9
|
+
*
|
|
10
|
+
* - `__proto__`: Could modify the prototype chain
|
|
11
|
+
* - `constructor`: Could modify the constructor property
|
|
12
|
+
* - `prototype`: Could modify the prototype object
|
|
13
|
+
*
|
|
14
|
+
* @internal
|
|
15
|
+
*/
|
|
16
|
+
const DANGEROUS_PROPERTY_NAMES = ['__proto__', 'constructor', 'prototype'];
|
|
5
17
|
/**
|
|
6
18
|
* @internal
|
|
7
19
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mikro-orm/core",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.2.0-dev.0",
|
|
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
|
"keywords": [
|
|
6
6
|
"data-mapper",
|
package/utils/Utils.d.ts
CHANGED
|
@@ -3,18 +3,6 @@ import type { Platform } from '../platforms/Platform.js';
|
|
|
3
3
|
import { ScalarReference } from '../entity/Reference.js';
|
|
4
4
|
import { Collection } from '../entity/Collection.js';
|
|
5
5
|
import { type RawQueryFragmentSymbol } from './RawQueryFragment.js';
|
|
6
|
-
/**
|
|
7
|
-
* List of property names that could lead to prototype pollution vulnerabilities.
|
|
8
|
-
* These names should never be used as entity property names because they could
|
|
9
|
-
* allow malicious code to modify object prototypes when property values are assigned.
|
|
10
|
-
*
|
|
11
|
-
* - `__proto__`: Could modify the prototype chain
|
|
12
|
-
* - `constructor`: Could modify the constructor property
|
|
13
|
-
* - `prototype`: Could modify the prototype object
|
|
14
|
-
*
|
|
15
|
-
* @internal
|
|
16
|
-
*/
|
|
17
|
-
export declare const DANGEROUS_PROPERTY_NAMES: readonly string[];
|
|
18
6
|
/** Deeply compares two objects for equality, handling dates, regexes, and raw fragments. */
|
|
19
7
|
export declare function compareObjects(a: any, b: any): boolean;
|
|
20
8
|
/** Compares two arrays element-by-element for deep equality. */
|
package/utils/Utils.js
CHANGED
|
@@ -5,18 +5,6 @@ import { Reference, ScalarReference } from '../entity/Reference.js';
|
|
|
5
5
|
import { Collection } from '../entity/Collection.js';
|
|
6
6
|
import { EntityHelper } from '../entity/EntityHelper.js';
|
|
7
7
|
import { Raw, isRaw } from './RawQueryFragment.js';
|
|
8
|
-
/**
|
|
9
|
-
* List of property names that could lead to prototype pollution vulnerabilities.
|
|
10
|
-
* These names should never be used as entity property names because they could
|
|
11
|
-
* allow malicious code to modify object prototypes when property values are assigned.
|
|
12
|
-
*
|
|
13
|
-
* - `__proto__`: Could modify the prototype chain
|
|
14
|
-
* - `constructor`: Could modify the constructor property
|
|
15
|
-
* - `prototype`: Could modify the prototype object
|
|
16
|
-
*
|
|
17
|
-
* @internal
|
|
18
|
-
*/
|
|
19
|
-
export const DANGEROUS_PROPERTY_NAMES = ['__proto__', 'constructor', 'prototype'];
|
|
20
8
|
function compareConstructors(a, b) {
|
|
21
9
|
if (a.constructor === b.constructor) {
|
|
22
10
|
return true;
|
|
@@ -153,7 +141,7 @@ export function parseJsonSafe(value) {
|
|
|
153
141
|
/** Collection of general-purpose utility methods used throughout the ORM. */
|
|
154
142
|
export class Utils {
|
|
155
143
|
static PK_SEPARATOR = '~~~';
|
|
156
|
-
static #ORM_VERSION = '7.
|
|
144
|
+
static #ORM_VERSION = '7.2.0-dev.0';
|
|
157
145
|
/**
|
|
158
146
|
* Checks if the argument is instance of `Object`. Returns false for arrays.
|
|
159
147
|
*/
|
|
@@ -244,7 +232,7 @@ export class Utils {
|
|
|
244
232
|
const source = sources.shift();
|
|
245
233
|
if (Utils.isObject(target) && Utils.isPlainObject(source)) {
|
|
246
234
|
for (const [key, value] of Object.entries(source)) {
|
|
247
|
-
if (
|
|
235
|
+
if (['__proto__', 'constructor', 'prototype'].includes(key)) {
|
|
248
236
|
continue;
|
|
249
237
|
}
|
|
250
238
|
if (ignoreUndefined && typeof value === 'undefined') {
|