Repository navigation
Develop to main sync for v2.2.3 release - #2126
Merged
Merged
Conversation
Main to Develop sync after v2.2.2 release
…lease post) (#2125) * Fix: strip inline <style>/<script> from What's New release content The What's New admin page (admin.php?page=rtgodam_whats_new) rendered a block of raw CSS as visible text inside the "Preview in one click" feature. Root cause: the godam.io release post renders the GoDAM video block's inline `<style id="godam-player-wrapper-inline-css">` into content.rendered. get_release_post() ran that content through wp_kses_post(), which strips the disallowed <style> tag but keeps its inner text. DOMDocument then re-wrapped the loose CSS in a <p>, so parse_features_from_content() folded it into the feature description that the React page renders with dangerouslySetInnerHTML. Remove <script>/<style> blocks (tag + contents) before sanitizing, in a new testable build_features() helper (mirrors core wp_strip_all_tags()). Adds a PHPUnit regression test that reproduces the real wp_kses_post() tag-stripping behaviour (red without the fix, green with it). * Refactor: parse raw content instead of sanitizing before parse Addresses code review on the What's New CSS-leak fix. Instead of regex-stripping <script>/<style> before wp_kses_post(), remove the sanitize-before-parse ordering that was the root cause: - parse_features_from_content() now takes the raw content.rendered and sanitizes each extracted field (title/description/image), so kses can no longer turn a disallowed inline <style> into loose text that DOMDocument re-wraps into a <p>. Sibling <style>/<script> are ignored because only <p>/<ul>/<ol>/<figure> are collected. - Drop <script>/<style>/<noscript> nodes from the DOM up front as defence in depth (covers a tag nested inside a collected element, and an unclosed <style> that DOMDocument still parses into a node). This removes the regex entirely, so the closed-tag-only and preg_replace() null-return concerns no longer apply. - Remove the build_features() helper; tests now exercise parse_features_from_content() (which existed pre-fix), so the nested <style>/<script> cases fail red against the original parser and pass with the fix. * Test: add real godam.io 2.2 content fixture; document raw-content contract - Add tests/fixtures/release-post-godam-2-2.html (the actual captured content.rendered with the GoDAM video block and its inline <style>) and a test that runs parse_features_from_content() against it, asserting every feature description is leak-free. This is the exact payload that produced the report. - Comment get_release_post() to state it must pass RAW content to the parser (no wp_kses_post() before structural parsing), which is the one part the parse-level tests can't guard because it does the HTTP fetch.
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The tests bypass the caller boundary where the reported sanitize-before-parse regression occurred.
Get a fresh assessment by requesting another Copilot review.
Pull request overview
Fixes raw inline CSS leaking into the What’s New page by parsing release markup before sanitizing extracted fields.
Changes:
- Removes unsafe sanitize-before-parse ordering.
- Drops script, style, and noscript DOM nodes.
- Adds regression fixtures and parser tests.
File summaries
| File | Description |
|---|---|
inc/classes/rest-api/class-release-post.php |
Implements safe structural parsing and field sanitization. |
tests/php/ReleasePostFeatureParsingTest.php |
Adds parser regression tests. |
tests/fixtures/release-post-godam-2-2.html |
Provides the captured release-post fixture. |
tests/bootstrap.php |
Adds parser dependencies and stubs. |
tests/stubs/i18n.php |
Simulates relevant KSES behavior. |
Review details
- Files reviewed: 5/5 changed files
- Comments generated: 1
- Review effort level: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
🔍 WordPress Plugin Check Report
📊 Report
|
| 📍 Line | 🔖 Check | 💬 Message |
|---|---|---|
0 |
missing_composer_json_file | The "/vendor" directory using composer exists, but "composer.json" file is missing. |
📁 readme.txt (2 warnings)
| 📍 Line | 🔖 Check | 💬 Message |
|---|---|---|
0 |
mismatched_plugin_name | Plugin name "GoDAM - Organize WordPress Media Library & File Manager with Unlimited Folders for Images, Videos & more" is different from the name declared in plugin header "GoDAM". |
0 |
trademarked_term | The plugin name includes a restricted term. Your chosen plugin name - "GoDAM - Organize WordPress Media Library & File Manager with Unlimited Folders for Images, Videos & more" - contains the restricted term "wordpress" which cannot be used at all in your plugin name. |
📁 assets/build/blocks/godam-gallery-v2/render.php (2 warnings)
| 📍 Line | 🔖 Check | 💬 Message |
|---|---|---|
15 |
WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound | Global variables defined by a theme/plugin should start with the theme/plugin prefix. Found: "$inner_block_video_ids". |
23 |
WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound | Global variables defined by a theme/plugin should start with the theme/plugin prefix. Found: "$inner_block_video_ids". |
📁 assets/build/css/main.css (1 warning)
| 📍 Line | 🔖 Check | 💬 Message |
|---|---|---|
0 |
EnqueuedStylesScope | This style is being loaded in all contexts. |
📁 assets/src/libs/analytics.min.js (5 warnings)
| 📍 Line | 🔖 Check | 💬 Message |
|---|---|---|
0 |
EnqueuedScriptsScope | This script is being loaded in all frontend contexts. |
0 |
NonBlockingScripts.NoStrategy | This script on http://localhost:8880 (with handle analytics-library) is loaded in the footer. Consider a defer or async script loading strategy instead. |
0 |
NonBlockingScripts.NoStrategy | This script on http://localhost:8880/2026/09/16/hello-world/ (with handle analytics-library) is loaded in the footer. Consider a defer or async script loading strategy instead. |
0 |
NonBlockingScripts.NoStrategy | This script on http://localhost:8880/sample-page/ (with handle analytics-library) is loaded in the footer. Consider a defer or async script loading strategy instead. |
0 |
NonBlockingScripts.NoStrategy | This script on http://localhost:8880/demo-attachment-post/ (with handle analytics-library) is loaded in the footer. Consider a defer or async script loading strategy instead. |
📁 assets/build/js/main.min.js (5 warnings)
| 📍 Line | 🔖 Check | 💬 Message |
|---|---|---|
0 |
EnqueuedScriptsScope | This script is being loaded in all frontend contexts. |
0 |
NonBlockingScripts.NoStrategy | This script on http://localhost:8880 (with handle rtgodam-script) is loaded in the footer. Consider a defer or async script loading strategy instead. |
0 |
NonBlockingScripts.NoStrategy | This script on http://localhost:8880/2026/09/16/hello-world/ (with handle rtgodam-script) is loaded in the footer. Consider a defer or async script loading strategy instead. |
0 |
NonBlockingScripts.NoStrategy | This script on http://localhost:8880/sample-page/ (with handle rtgodam-script) is loaded in the footer. Consider a defer or async script loading strategy instead. |
0 |
NonBlockingScripts.NoStrategy | This script on http://localhost:8880/demo-attachment-post/ (with handle rtgodam-script) is loaded in the footer. Consider a defer or async script loading strategy instead. |
🤖 Generated by WordPress Plugin Check Action • Learn more about Plugin Check
This was referenced Sep 16, 2026
…oundary test (#2127) * Bump version to 2.2.3 and update changelog for the What's New CSS fix * Simplify v2.2.3 changelog entry to user-facing wording * Test: cover get_release_post() caller boundary against pre-parse sanitization
KMchaudhary
approved these changes
Sep 16, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Sync
developtomainfor the v2.2.3 patch release.Includes:
<style>from release post)