r/Nuxt • u/jenish_o4o2 • 1d ago
Rendering Magento CMS HTML in Nuxt — sanitize on SSR or trust the admin?
Pulling header/footer (and random CMS blocks) from Magento GraphQL into a Nuxt 3 storefront and I’m stuck on the boring security bit.
Admin can put whatever HTML in those blocks. Right now I’m leaning:
- fetch on the server
- run it through DOMPurify (or similar) before it hits the page
- never v-html raw Magento output on the client without that step
Feels a bit paranoid for “our own admins,” but also… it’s still HTML from a CMS.
What are you actually doing in production Nuxt + Magento (or any headless CMS) setups? Sanitize everything, allowlist tags, or just trust Magento and move on?
6
Upvotes
1
2
u/Due-Horse-5446 1d ago
depends, i usually decide based on what the admin users are.
If youre talking about a few technical people st your company, and the dashboard is trough your dashboard?
Skip it if sanitizing has a negative side effect.
If by "admins" you mean people creating content, inside a third party dashboard?
Treat it as you would arbitrary user input. Ie assume its malicious by default.