Closed paulschreiber closed 1 year ago
Thanks @paulschreiber. Looks like we need to disable SQL injection detection on the site editor. Just to be sure, you're using v4.0 with the new plugin architecture, correct?
I am using 3.3.4 — I installed the the modsecurity-crs 3.3.4-1 .deb on Ubuntu 23.04.
I see. I'll check whether this is already fixed in 4.0.
It looks like this is still an issue. I'm working on a PR but I need some help. Could you possibly provide the contents of an actual request? I need to know the value of the Content-Type
header and the format of the request (JSON in body, URL encoded in body, ...).
Content-Type is application/json
.
HTTP payload:
{"id":50,"styles":{"blocks":{"core/comment-author-name":{"elements":{"link":{":active":{"color":{"text":"var(--wp--preset--color--tertiary)"}}}}},"core/comment-date":{"elements":{"link":{":active":{"color":{"text":"var(--wp--preset--color--tertiary)"},"typography":{"textDecoration":"underline"}}}}},"core/comment-edit-link":{"elements":{"link":{":active":{"color":{"text":"var(--wp--preset--color--tertiary)"}}}}},"core/comments-pagination":{"elements":{"link":{"typography":{"textDecoration":"underline"}}}},"core/image":{"filter":{"duotone":"var(--wp--preset--duotone--default-filter)"}},"core/navigation":{"elements":{"link":{":active":{"typography":{"textDecoration":"underline dashed"}},"color":{"text":"var(--wp--preset--color--primary)"},"typography":{"textDecoration":"underline"}}}},"core/paragraph":{"color":{"text":"var(--wp--preset--color--contrast)"},"elements":{"link":{":hover":{"color":{"text":"var(--wp--preset--color--tertiary)"}}}}},"core/post-content":{"elements":{"link":{"color":{"text":"var(--wp--preset--color--primary)"}}}},"core/post-date":{"elements":{"link":{"typography":{"textDecoration":"none","fontStyle":"italic"}}}},"core/post-featured-image":{"filter":{"duotone":"var(--wp--preset--duotone--default-filter)"}},"core/post-title":{"elements":{"link":{":active":{"color":{"text":"var(--wp--preset--color--tertiary)"},"typography":{"textDecoration":"underline"}},"typography":{"textDecoration":"underline"}}}},"core/query-pagination":{"elements":{"link":{"typography":{"textDecoration":"underline"}}}},"core/separator":{"color":{"text":"var(--wp--preset--color--secondary)"}},"core/site-title":{"elements":{"link":{":active":{"color":{"text":"var(--wp--preset--color--primary)"}}}},"typography":{"fontStyle":"italic","fontWeight":"700"}}},"color":{"gradient":"var(--wp--preset--gradient--dots)"},"elements":{"button":{":active":{"color":{"background":"var(--wp--preset--color--secondary)","gradient":"none"}},":focus":{"color":{"gradient":"var(--wp--preset--gradient--secondary-primary)"}},":hover":{"color":{"gradient":"var(--wp--preset--gradient--secondary-primary)"}},":visited":{"color":{"text":"var(--wp--preset--color--base)"}},"border":{"radius":"5px"},"color":{"gradient":"var(--wp--preset--gradient--primary-secondary)","text":"var(--wp--preset--color--base)"}},"h1":{"color":{"text":"var(--wp--preset--color--contrast)"}},"h2":{"color":{"text":"var(--wp--preset--color--contrast)"}},"h3":{"color":{"text":"var(--wp--preset--color--primary)"}},"h4":{"color":{"text":"var(--wp--preset--color--primary)"}},"h5":{"color":{"text":"var(--wp--preset--color--primary)"}},"h6":{"color":{"text":"var(--wp--preset--color--primary)"}},"heading":{"color":{"text":"var(--wp--preset--color--primary)"}},"link":{"color":{"text":"var(--wp--preset--color--primary)"},":hover":{"color":{"text":"var(--wp--preset--color--tertiary)"}},":focus":{"color":{"text":"var(--wp--preset--color--tertiary)"}},":active":{"color":{"text":"var(--wp--preset--color--tertiary)"}}}}},"settings":{"color":{"duotone":{"theme":[{"colors":["#222828","#9EF9FD"],"slug":"default-filter","name":"Default filter"}]},"gradients":{"theme":[{"gradient":"linear-gradient(180deg, var(--wp--preset--color--primary) 0%,var(--wp--preset--color--secondary) 100%)","name":"Primary to Secondary","slug":"primary-secondary"},{"gradient":"linear-gradient(180deg, var(--wp--preset--color--secondary) 0%,var(--wp--preset--color--primary) 100%)","name":"Secondary to Primary","slug":"secondary-primary"},{"gradient":"linear-gradient(180deg, var(--wp--preset--color--primary) 0%,var(--wp--preset--color--tertiary) 100%)","name":"Tertiary to Secondary","slug":"tertiary-secondary"},{"gradient":"linear-gradient(180deg, var(--wp--preset--color--tertiary) 0%,var(--wp--preset--color--primary) 100%)","name":"Tertiary to Primary","slug":"tertiary-primary"},{"gradient":"linear-gradient(180deg, var(--wp--preset--color--base) 0%,var(--wp--preset--color--primary) 350%)","name":"Base to Primary","slug":"base-primary"},{"gradient":"radial-gradient(circle at 5px 5px,#0c0d0d70 2px,#ffffff00 0px,#ffffff00 0px) 0 0 / 8px 8px, linear-gradient(180deg, var(--wp--preset--color--base) 0%,#000000 200%)","name":"Dots","slug":"dots"}]},"palette":{"theme":[{"color":"#222828","name":"Base","slug":"base"},{"color":"#ffffff","name":"Contrast","slug":"contrast"},{"color":"#53ED85","name":"Primary","slug":"primary"},{"color":"#9EF9FD","name":"Secondary","slug":"secondary"},{"color":"#D8E202","name":"Tertiary","slug":"tertiary"}]}}}}
Here's the data from Copy as cURL:
curl 'https://XXXXX.org/index.php?rest_route=%2Fwp%2Fv2%2Fglobal-styles%2F50&_locale=user' \
-H 'authority: XXXXX.org' \
-H 'accept: application/json, */*;q=0.1' \
-H 'accept-language: en-US,en;q=0.9' \
-H 'content-type: application/json' \
-H 'cookie: wordpress_test_cookie=xxxxxx \
-H 'origin: https://XXXXX.org' \
-H 'referer: https://XXXXX.org/wp-admin/site-editor.php?path=%2Fwp_global_styles' \
-H 'sec-ch-ua: "Google Chrome";v="117", "Not;A=Brand";v="8", "Chromium";v="117"' \
-H 'sec-ch-ua-mobile: ?0' \
-H 'sec-ch-ua-platform: "macOS"' \
-H 'sec-fetch-dest: empty' \
-H 'sec-fetch-mode: cors' \
-H 'sec-fetch-site: same-origin' \
-H 'user-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/117.0.0.0 Safari/537.36' \
-H 'x-http-method-override: PUT' \
-H 'x-wp-nonce: dbaa844df9' \
--data-raw '{"id":50,"styles":{"blocks":{"core/comment-author-name":{"elements":{"link":{":active":{"color":{"text":"var(--wp--preset--color--tertiary)"}}}}},"core/comment-date":{"elements":{"link":{":active":{"color":{"text":"var(--wp--preset--color--tertiary)"},"typography":{"textDecoration":"underline"}}}}},"core/comment-edit-link":{"elements":{"link":{":active":{"color":{"text":"var(--wp--preset--color--tertiary)"}}}}},"core/comments-pagination":{"elements":{"link":{"typography":{"textDecoration":"underline"}}}},"core/image":{"filter":{"duotone":"var(--wp--preset--duotone--default-filter)"}},"core/navigation":{"elements":{"link":{":active":{"typography":{"textDecoration":"underline dashed"}},"color":{"text":"var(--wp--preset--color--primary)"},"typography":{"textDecoration":"underline"}}}},"core/paragraph":{"color":{"text":"var(--wp--preset--color--contrast)"},"elements":{"link":{":hover":{"color":{"text":"var(--wp--preset--color--tertiary)"}}}}},"core/post-content":{"elements":{"link":{"color":{"text":"var(--wp--preset--color--primary)"}}}},"core/post-date":{"elements":{"link":{"typography":{"textDecoration":"none","fontStyle":"italic"}}}},"core/post-featured-image":{"filter":{"duotone":"var(--wp--preset--duotone--default-filter)"}},"core/post-title":{"elements":{"link":{":active":{"color":{"text":"var(--wp--preset--color--tertiary)"},"typography":{"textDecoration":"underline"}},"typography":{"textDecoration":"underline"}}}},"core/query-pagination":{"elements":{"link":{"typography":{"textDecoration":"underline"}}}},"core/separator":{"color":{"text":"var(--wp--preset--color--secondary)"}},"core/site-title":{"elements":{"link":{":active":{"color":{"text":"var(--wp--preset--color--primary)"}}}},"typography":{"fontStyle":"italic","fontWeight":"700"}}},"color":{"gradient":"var(--wp--preset--gradient--dots)"},"elements":{"button":{":active":{"color":{"background":"var(--wp--preset--color--secondary)","gradient":"none"}},":focus":{"color":{"gradient":"var(--wp--preset--gradient--secondary-primary)"}},":hover":{"color":{"gradient":"var(--wp--preset--gradient--secondary-primary)"}},":visited":{"color":{"text":"var(--wp--preset--color--base)"}},"border":{"radius":"5px"},"color":{"gradient":"var(--wp--preset--gradient--primary-secondary)","text":"var(--wp--preset--color--base)"}},"h1":{"color":{"text":"var(--wp--preset--color--contrast)"}},"h2":{"color":{"text":"var(--wp--preset--color--contrast)"}},"h3":{"color":{"text":"var(--wp--preset--color--primary)"}},"h4":{"color":{"text":"var(--wp--preset--color--primary)"}},"h5":{"color":{"text":"var(--wp--preset--color--primary)"}},"h6":{"color":{"text":"var(--wp--preset--color--primary)"}},"heading":{"color":{"text":"var(--wp--preset--color--primary)"}},"link":{"color":{"text":"var(--wp--preset--color--primary)"},":hover":{"color":{"text":"var(--wp--preset--color--tertiary)"}},":focus":{"color":{"text":"var(--wp--preset--color--tertiary)"}},":active":{"color":{"text":"var(--wp--preset--color--tertiary)"}}}}},"settings":{"color":{"duotone":{"theme":[{"colors":["#222828","#9EF9FD"],"slug":"default-filter","name":"Default filter"}]},"gradients":{"theme":[{"gradient":"linear-gradient(180deg, var(--wp--preset--color--primary) 0%,var(--wp--preset--color--secondary) 100%)","name":"Primary to Secondary","slug":"primary-secondary"},{"gradient":"linear-gradient(180deg, var(--wp--preset--color--secondary) 0%,var(--wp--preset--color--primary) 100%)","name":"Secondary to Primary","slug":"secondary-primary"},{"gradient":"linear-gradient(180deg, var(--wp--preset--color--primary) 0%,var(--wp--preset--color--tertiary) 100%)","name":"Tertiary to Secondary","slug":"tertiary-secondary"},{"gradient":"linear-gradient(180deg, var(--wp--preset--color--tertiary) 0%,var(--wp--preset--color--primary) 100%)","name":"Tertiary to Primary","slug":"tertiary-primary"},{"gradient":"linear-gradient(180deg, var(--wp--preset--color--base) 0%,var(--wp--preset--color--primary) 350%)","name":"Base to Primary","slug":"base-primary"},{"gradient":"radial-gradient(circle at 5px 5px,#0c0d0d70 2px,#ffffff00 0px,#ffffff00 0px) 0 0 / 8px 8px, linear-gradient(180deg, var(--wp--preset--color--base) 0%,#000000 200%)","name":"Dots","slug":"dots"}]},"palette":{"theme":[{"color":"#222828","name":"Base","slug":"base"},{"color":"#ffffff","name":"Contrast","slug":"contrast"},{"color":"#53ED85","name":"Primary","slug":"primary"},{"color":"#9EF9FD","name":"Secondary","slug":"secondary"},{"color":"#D8E202","name":"Tertiary","slug":"tertiary"}]}}}}' \
--compressed
Thanks. I've created a PR (#16) with a fix. Would you mind testing it? It's for v4.0 but you should be able to simply copy the new rule.
The PR is #18 (#16 is this issue). I have confirmed that both your version of the rule and @azurit's version work correctly/resolve the problem.
Thanks @paulschreiber, much appreciated!
The PR has been merged.
Summary
When attempting to save edits to after changing styles using the full site editor (
/wp-admin/site-editor.php?path=%2Fwp_global_styles
), seven errors are displayed.There are five:
And one each of these two:
Full log: