@mikro-orm/core 7.1.12-dev.19 → 7.1.12-dev.20

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/EntityManager.js CHANGED
@@ -1641,8 +1641,9 @@ export class EntityManager {
1641
1641
  }
1642
1642
  // For TPT inheritance, check the entity's own properties, not just the root's
1643
1643
  // For STI, meta.properties includes all properties anyway
1644
- const ret = p in meta.properties;
1645
- if (parts.length > 0) {
1644
+ // use an own-property check so inherited `Object.prototype` members (e.g. `__proto__`, `constructor`) are not treated as populatable
1645
+ const ret = Object.hasOwn(meta.properties, p);
1646
+ if (ret && parts.length > 0) {
1646
1647
  return this.canPopulate(meta.properties[p].targetMeta.class, parts.join('.'));
1647
1648
  }
1648
1649
  return ret;
@@ -1,5 +1,5 @@
1
1
  import { QueryHelper } from '../utils/QueryHelper.js';
2
- import { Utils } from '../utils/Utils.js';
2
+ import { DANGEROUS_PROPERTY_NAMES, Utils } from '../utils/Utils.js';
3
3
  import { ValidationError } from '../errors.js';
4
4
  import { LoadStrategy, PopulatePath, ReferenceKind, } from '../enums.js';
5
5
  import { Reference } from './Reference.js';
@@ -124,10 +124,10 @@ export class EntityLoader {
124
124
  mergeNestedPopulate(populate) {
125
125
  const tmp = populate.reduce((ret, item) => {
126
126
  /* v8 ignore next */
127
- if (item.field === PopulatePath.ALL) {
127
+ if (item.field === PopulatePath.ALL || DANGEROUS_PROPERTY_NAMES.includes(item.field)) {
128
128
  return ret;
129
129
  }
130
- if (!ret[item.field]) {
130
+ if (!Object.hasOwn(ret, item.field)) {
131
131
  ret[item.field] = item;
132
132
  return ret;
133
133
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mikro-orm/core",
3
- "version": "7.1.12-dev.19",
3
+ "version": "7.1.12-dev.20",
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",
@@ -1,5 +1,5 @@
1
1
  import { Reference } from '../entity/Reference.js';
2
- import { Utils } from './Utils.js';
2
+ import { DANGEROUS_PROPERTY_NAMES, Utils } from './Utils.js';
3
3
  import { ARRAY_OPERATORS, GroupOperator, JSON_KEY_OPERATORS, ReferenceKind } from '../enums.js';
4
4
  import { JsonType } from '../types/JsonType.js';
5
5
  import { helper } from '../entity/wrap.js';
@@ -269,7 +269,11 @@ export class QueryHelper {
269
269
  options.forEach(filter => (opts[filter] = true));
270
270
  }
271
271
  else if (Utils.isPlainObject(options)) {
272
- Object.keys(options).forEach(filter => (opts[filter] = options[filter]));
272
+ Object.keys(options).forEach(filter => {
273
+ if (!DANGEROUS_PROPERTY_NAMES.includes(filter)) {
274
+ opts[filter] = options[filter];
275
+ }
276
+ });
273
277
  }
274
278
  return Object.keys(filters)
275
279
  .filter(f => QueryHelper.isFilterActive(meta, f, filters[f], opts))
package/utils/Utils.js CHANGED
@@ -153,7 +153,7 @@ export function parseJsonSafe(value) {
153
153
  /** Collection of general-purpose utility methods used throughout the ORM. */
154
154
  export class Utils {
155
155
  static PK_SEPARATOR = '~~~';
156
- static #ORM_VERSION = '7.1.12-dev.19';
156
+ static #ORM_VERSION = '7.1.12-dev.20';
157
157
  /**
158
158
  * Checks if the argument is instance of `Object`. Returns false for arrays.
159
159
  */