How to approach security? #1787
-
|
Given that IPX is the default and I'm trying to run a simple node server SSR enabled application with images, what mechanisms are there to prevent someone to run a simple Because right now, in production, I can hold a CPU hostage for good 20 seconds and produce a > 40mb image per request. I only found mentions of the nonce, but that seems to be CSP only and does not prevent malicious configurations or scripts. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
|
You are right to worry about this. A public image optimizer endpoint is effectively a small image-processing API, so you need limits around it. With the default IPX provider, the first line of defense is to restrict what can be fetched: export default defineNuxtConfig({
runtimeConfig: {
ipx: {
domains: ["your-cdn.example.com"],
alias: {
images: "https://your-cdn.example.com/images",
},
},
},
})That prevents the endpoint from becoming an open proxy, but it does not fully solve abuse via huge resize/modifier combinations. For that, I would add one or more of these:
The |
Beta Was this translation helpful? Give feedback.
You are right to worry about this. A public image optimizer endpoint is effectively a small image-processing API, so you need limits around it.
With the default IPX provider, the first line of defense is to restrict what can be fetched:
That prevents the endpoint from becoming an open proxy, but it does not fully solve abuse via huge resize/modifier combinations.
For that, I would add one or more of these:
/_ipx/**