fix: n8n's JSON-LD endpoint only overwrites plain html content elements

PUT /api/json-ld/{uid} replaced the bodytext of any content element, so a
wrong uid in n8n could wipe visible page content (text, plugins, ...).
Elements of any other CType than html are now refused with 409 before
anything is written.

The group's "Explicitly allow tt_content:CType:html" does not guard this on
its own, since the endpoint bypasses DataHandler's record access checks.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
frommeandClaude Opus 5.5 committed 2026-11-03 09:22:39 +01:00
1 parent 2a510339c3
commit 48f22a7787
2 files changed
+16 -7

No files matched your search

+5 -4
View File
@@ -104,8 +104,9 @@ Configuration (extension configuration `ep_products`, tab ContentFeed): `content
n8n writes the JSON-LD (SEO markup) of a content element (`EP\EpProducts\JsonLd\JsonLdApi`).
n8n is the source of truth: the element's `bodytext` is replaced with the posted object wrapped in
`<script type="application/ld+json">`, whatever the element held before. Other fields (CType,
hidden, …) are left alone; each translation is its own uid.
`<script type="application/ld+json">`, whatever the element held before. Only plain html elements
(`CType` `html`) are written, any other type is refused, so a wrong uid cannot replace visible page
content. Other fields (hidden, …) are left alone; each translation is its own uid.
- Key: `jsonLdApiKey` (extension configuration `ep_products`, tab JsonLd), only as header
`X-Api-Key`; `?key=` is not accepted.
@@ -116,8 +117,8 @@ hidden, …) are left alone; each translation is its own uid.
- `200 {"uid": 13169, "pid": 24, "changed": true}`; `changed: false` when the stored markup is
already identical (nothing written).
- `400` for invalid JSON or a scalar, `403` for a wrong or missing key, `404` for an unknown or
deleted uid, `405` for other methods, `503` when the backend user `_n8n` is missing, `500` with
`errors` when DataHandler refuses the write.
deleted uid, `405` for other methods, `409` when the element is not of type `html`, `503` when
the backend user `_n8n` is missing, `500` with `errors` when DataHandler refuses the write.
The write goes through DataHandler as the backend user `_n8n` (no password, so no login; group
`n8n` with *Tables (modify)* `tt_content` and *Explicitly allow* `tt_content:CType:html`; page