graphql-upload-nextjs 3.1.3 → 3.1.5
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/CHANGELOG.md +6 -0
- package/README.md +2 -0
- package/core.js +4 -3
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 3.1.4 - 2026-11-14
|
|
4
|
+
|
|
5
|
+
- Restrict `setValueAtPath` to own containers so inherited objects and arrays are never mutated as a side effect.
|
|
6
|
+
- Preserve existing own-property path behavior and express forbidden prototype keys directly for static verification.
|
|
7
|
+
- Add object and array inheritance regression tests.
|
|
8
|
+
|
|
3
9
|
## 3.1.3 - 2026-11-14
|
|
4
10
|
|
|
5
11
|
- Document the current Apollo Server transitive dependency advisory and application-root mitigation.
|
package/README.md
CHANGED
|
@@ -114,6 +114,8 @@ For pnpm, put the same selector under `overrides` in your root pnpm-workspace.ya
|
|
|
114
114
|
|
|
115
115
|
## Public API compatibility
|
|
116
116
|
|
|
117
|
+
`setValueAtPath` creates an own container when a path encounters an inherited property. Existing own-property object and array paths retain their behavior; inherited containers are not mutated.
|
|
118
|
+
|
|
117
119
|
The existing exports are still there: `File`, `FileStream`, `FormDataFile`, `MinimalRequest`, `GraphQLUpload`, `Upload`, `uploadProcess`, `bufferToStream`, `parseOperationsJSON`, `sanitizeAndValidateJSON`, `setValueAtPath`, `streamToBuffer` and `validateMap`. `Upload` now accepts an optional file type parameter; its default is still `File`.
|
|
118
120
|
|
|
119
121
|
The new exports are `StreamingFile`, `StreamingRequest`, `StreamingUploadSettings` and `uploadProcessStreaming`. Existing buffered callers don't need these new types. Valid buffered requests retain their behaviour. Ambiguous duplicate inputs are now rejected, numeric JSON object keys preserve their sibling properties, malformed body syntax produces a client error, and unexpected server exception details are no longer exposed.
|
package/core.js
CHANGED
|
@@ -159,11 +159,12 @@ export function setValueAtPath(obj, path, value) {
|
|
|
159
159
|
let current = obj;
|
|
160
160
|
for (let i = 0; i < keys.length - 1; i++) {
|
|
161
161
|
const key = keys[i];
|
|
162
|
-
if (
|
|
162
|
+
if (key === '__proto__' || key === 'constructor' || key === 'prototype') {
|
|
163
163
|
throw new Error(`Invalid path segment: '${key}' is not allowed.`);
|
|
164
164
|
}
|
|
165
165
|
const nextKeyIsArrayIndex = /^\d+$/.test(keys[i + 1]);
|
|
166
|
-
if (!current
|
|
166
|
+
if (!Object.hasOwn(current, key) ||
|
|
167
|
+
!current[key] ||
|
|
167
168
|
typeof current[key] !== 'object' ||
|
|
168
169
|
(nextKeyIsArrayIndex && !Array.isArray(current[key])) ||
|
|
169
170
|
(!nextKeyIsArrayIndex && Array.isArray(current[key]))) {
|
|
@@ -172,7 +173,7 @@ export function setValueAtPath(obj, path, value) {
|
|
|
172
173
|
current = current[key];
|
|
173
174
|
}
|
|
174
175
|
const finalKey = keys[keys.length - 1];
|
|
175
|
-
if (
|
|
176
|
+
if (finalKey === '__proto__' || finalKey === 'constructor' || finalKey === 'prototype') {
|
|
176
177
|
throw new Error(`Invalid path segment: '${finalKey}' is not allowed.`);
|
|
177
178
|
}
|
|
178
179
|
current[finalKey] = value;
|
package/package.json
CHANGED
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"next": "^16.4.6",
|
|
22
22
|
"typescript": "^7.0.2",
|
|
23
23
|
"undici": "^8.12.4",
|
|
24
|
-
"vitest": "^5.1.
|
|
24
|
+
"vitest": "^5.1.1"
|
|
25
25
|
},
|
|
26
26
|
"files": [
|
|
27
27
|
"CHANGELOG.md",
|
|
@@ -90,5 +90,5 @@
|
|
|
90
90
|
},
|
|
91
91
|
"type": "module",
|
|
92
92
|
"types": "index.d.ts",
|
|
93
|
-
"version": "3.1.
|
|
93
|
+
"version": "3.1.5"
|
|
94
94
|
}
|