prisma-sql 1.76.2 → 1.77.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/dist/index.cjs CHANGED
@@ -8075,6 +8075,14 @@ function buildKey(row, fields) {
8075
8075
  }
8076
8076
 
8077
8077
  // src/builder/select/reducer.ts
8078
+ var UNSAFE_PROPERTY_NAMES = /* @__PURE__ */ new Set(["__proto__", "constructor", "prototype"]);
8079
+ function assertSafePropertyName(name) {
8080
+ if (UNSAFE_PROPERTY_NAMES.has(name)) {
8081
+ throw new Error(
8082
+ `Unsafe property name '${name}' rejected to prevent prototype pollution`
8083
+ );
8084
+ }
8085
+ }
8078
8086
  function buildRelationScalarCols(relModel, relPath, includeAllScalars, selectedScalarFields) {
8079
8087
  const jsonSet = getJsonFieldSet(relModel);
8080
8088
  const scalarFields = includeAllScalars ? getScalarFieldNames(relModel) : selectedScalarFields;
@@ -8106,6 +8114,7 @@ function buildReducerConfig(parentModel, includeSpec, allModels, prefix = "", de
8106
8114
  const modelMap = new Map(allModels.map((m) => [m.name, m]));
8107
8115
  for (const [incName, incValue] of Object.entries(includeSpec)) {
8108
8116
  if (incValue === false) continue;
8117
+ assertSafePropertyName(incName);
8109
8118
  const field = parentModel.fields.find((f) => f.name === incName);
8110
8119
  if (!field || !field.isRelation) {
8111
8120
  throw new Error(
@@ -8183,7 +8192,7 @@ function initNestedPlaceholders(obj, nested) {
8183
8192
  function materializeRelationObject(row, rel) {
8184
8193
  const relKey = buildKey(row, rel.keyCols);
8185
8194
  if (relKey == null) return null;
8186
- const obj = {};
8195
+ const obj = /* @__PURE__ */ Object.create(null);
8187
8196
  for (const c of rel.scalarCols) {
8188
8197
  obj[c.fieldName] = parseJsonIfNeeded(c.isJson, row[c.colName]);
8189
8198
  }
@@ -8251,7 +8260,7 @@ function reduceFlatRows(rows, config) {
8251
8260
  if (parentKey == null) continue;
8252
8261
  let record = resultMap.get(parentKey);
8253
8262
  if (!record) {
8254
- record = {};
8263
+ record = /* @__PURE__ */ Object.create(null);
8255
8264
  for (const fieldName of parentScalarFields) {
8256
8265
  record[fieldName] = maybeParseJson(
8257
8266
  row[fieldName],