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