Repository navigation
chore: adds filters - #12622
chore: adds filters#12622
Conversation
|
A few questions/notes:
|
91909df to
8ab0202
Compare
c079756 to
8ffdc6e
Compare
|
🚀 This is included in version v3.43.0 |
|
After upgrading to v3.43.0, I can't execute any This is the issue: > payload
/Users/xxxxxx/Documents/Projects/cnc-backend-cms/node_modules/.pnpm/[email protected]/node_modules/undici/lib/web/fetch/webidl.js:27
return new TypeError(`${message.header}: ${message.message}`)
^
TypeError: TypeError: Illegal constructor
at webidl.errors.exception (/Users/xxxxxx/Documents/Projects/cnc-backend-cms/node_modules/.pnpm/[email protected]/node_modules/undici/lib/web/fetch/webidl.js:27:10)
at webidl.illegalConstructor (/Users/xxxxxx/Documents/Projects/cnc-backend-cms/node_modules/.pnpm/[email protected]/node_modules/undici/lib/web/fetch/webidl.js:81:23)
at new CacheStorage (/Users/xxxxxx/Documents/Projects/cnc-backend-cms/node_modules/.pnpm/[email protected]/node_modules/undici/lib/web/cache/cachestorage.js:17:14)
at Object.<anonymous> (/Users/xxxxxx/Documents/Projects/cnc-backend-cms/node_modules/.pnpm/[email protected]/node_modules/undici/index.js:144:25)
at Module._compile (node:internal/modules/cjs/loader:1529:14)
at Object.transformer (file:///Users/xxxxxx/Documents/Projects/cnc-backend-cms/node_modules/.pnpm/[email protected]/node_modules/tsx/dist/register-C3TE0KFF.mjs:2:1115)
at Module.load (node:internal/modules/cjs/loader:1275:32)
at Module._load (node:internal/modules/cjs/loader:1096:12)
at Module.require (node:internal/modules/cjs/loader:1298:19)
at require (node:internal/modules/helpers:182:18)
Node.js v20.19.0 |
Thanks @sam-gab . Let us take a look. |
|
Facing the same issue like @sam-gab. |
|
On version 3.43.0, when I try to run It's working fine 3.42.0. |
|
I also face similar issue when I try to edit Document Upload from using Drawer I get: fetch("http://localhost:3000/api/research-documents/6853e79ec74ff5e6453aa6b7?depth=0&fallback-locale=null", {
---,
"referrer": "http://localhost:3000/admin/collections/meetings/6853cd951fb29a5e4f860490",
"referrerPolicy": "strict-origin-when-cross-origin",
"body": "------WebKitFormBoundaryOBc6sCM7NuGdHyLh\r\nContent-Disposition: form-data; name=\"_payload\"\r\n\r\n{\"url\":\"http://localhost:3000/api/research-documents/file/Can_you_translate_this_document_to_hebre-1.pdf\",\"creator\":\"tsemachh\",\"filename\":\"Can_you_translate_this_document_to_hebre-1.pdf\",\"mimeType\":\"application/pdf\",\"filesize\":139204,\"companies\":[\"6848050ca0c94d84bb5555f5\",\"6848050ca0c94d84bb5555fd\"],\"createdAt\":\"2025-06-19T10:34:06.077Z\",\"updatedAt\":\"2025-06-19T10:34:06.077Z\",\"uploadedAt\":\"2025-06-19T10:33:41.865Z\",\"thumbnailURL\":null}\r\n------WebKitFormBoundaryOBc6sCM7NuGdHyLh--\r\n",
"method": "PATCH",
"mode": "cors",
"credentials": "include"
});I get next error in console: {
"level": 50,
"time": 1750333310047,
"user": "tsemachhadad",
"hostname": "Tsemachs-MacBook-Pro.local",
"env": "production",
"err": {
"type": "z",
"message": "A problem occurred while uploading the file. Blocked unsafe attempt to http://localhost:3000/api/research-documents/file/Can_you_translate_this_document_to_hebre-1.pdf",
"stack": [
"z: A problem occurred while uploading the file. Blocked unsafe attempt to http://localhost:3000/api/research-documents/file/Can_you_translate_this_document_to_hebre-1.pdf",
" at rg (/Users/tsemachhadad/devemada/emda-dev/.next/server/chunks/940.js:188:79825)",
" at process.processTicksAndRejections (node:internal/process/task_queues:105:5)",
" at async B (/Users/tsemachhadad/devemada/emda-dev/.next/server/chunks/940.js:190:27905)",
" at async handler (/Users/tsemachhadad/devemada/emda-dev/.next/server/chunks/940.js:413:604780)",
" at async g (/Users/tsemachhadad/devemada/emda-dev/.next/server/chunks/6109.js:1:4473)",
" at async /Users/tsemachhadad/devemada/emda-dev/.next/server/chunks/6109.js:1:7150",
" at async to.do (/Users/tsemachhadad/devemada/emda-dev/node_modules/next/dist/compiled/next-server/app-route.runtime.prod.js:18:18605)",
" at async to.handle (/Users/tsemachhadad/devemada/emda-dev/node_modules/next/dist/compiled/next-server/app-route.runtime.prod.js:18:23632)",
" at async doRender (/Users/tsemachhadad/devemada/emda-dev/node_modules/next/dist/server/base-server.js:1513:42)",
" at async NextNodeServer.renderToResponseWithComponentsImpl (/Users/tsemachhadad/devemada/emda-dev/node_modules/next/dist/server/base-server.js:1915:28)"
],
"data": null,
"isOperational": true,
"isPublic": false,
"status": 500,
"name": "z"
},
"msg": "A problem occurred while uploading the file. Blocked unsafe attempt to http://localhost:3000/api/research-documents/file/Can_you_translate_this_document_to_hebre-1.pdf"
}This happens also on previous payload versions at leat 3.39 , didn't check backwards though |
| const ssrfFilterInterceptor: Dispatcher.DispatcherComposeInterceptor = (dispatch) => { | ||
| return (opts, handler) => { | ||
| const url = new URL(opts.origin?.toString() + opts.path) | ||
| if (!isSafeIp(url.hostname)) { |
There was a problem hiding this comment.
Hostname is not always a valid IP address, as per MDN it can be also a domain. Right now, checked on localhost and vercel deployment when editing a previously uploaded file, the hostname is being a domain name.
same issue using next custom server, working fine in 3.42.0 for me |
## Fix - Use `[Config].upload.skipSafeFetch` to allow specific external urls - Use `[Config].upload.pasteURL.allowList` to allow specific external urls Documentation: [Uploading files from remote urls](https://payloadcms.com/docs/upload/overview#uploading-files-from-remote-urls) Fixes: #12876 Mentioned: #7037, #12934 Source PR: #12622 Issue Trace: 1. [`allowList` Added](8b7f2dd#diff-92acf7b8d30e447a791e37820136bcbf23c42f0358daca0fdea4e7b77f7d4bc9 ) 2. [`allowList` Removed](648c168#diff-92acf7b8d30e447a791e37820136bcbf23c42f0358daca0fdea4e7b77f7d4bc9)
Hi @khnn, noticed you were the only one who seemed to be facing the same issue I was. Just an update, I realized switching from commonJs to ES Modules by adding |
@sam-gab Thanks for pointing that out. I'll try that. |
|
I'm having the same issue as @geminigeek. |
yes, what version of payload you have? i am stuck on 3.38 , waiting for a PR, you can try with latest payload! |
|
|
… false hi, currently we are initializing safeDispatcher outside of the safeFetch function, which is causing edge case issue with bun and undici polyfill like this https://github.com/payloadcms/payload/blob/30fc7e3012dae81b3f727b35ff6917e75f271df1/packages/payload/src/uploads/safeFetch.ts#L52 if we move this to the function safeFetch , we can get rid of edge case like these , if user set `skipSafeFetch: true`. i have implemented this like that in this PR, till bun fixes undici polyfill issue this is a temporary fix. related issues payload payloadcms#12622 (comment) payloadcms#12622 (comment) related issues Bun oven-sh/bun#17799 oven-sh/bun#20022
|
As of version 3.49.1, I still can't run any payload command via npm. Getting the same "TypeError: Illegal constructor" message UPDATE: I was able to get it working by adding "type": "module" to my package.json and converting a config file to module syntax. |
|
Same situation here. Any plans for a fix, besides switching from 'commonjs' to 'module'? |
Filters URLs to avoid issues with SSRF
Had to use
undiciinstead of nativefetchbecause it was the only viable alternative that supported both overriding agent/dispatch and also implementedcredentials: include.More info here.