Skip to content

Develop to main sync for v2.2.3 release - #2126

Merged
subodhr258 merged 3 commits into
mainfrom
develop
Sep 16, 2026
Merged

subodhr258 merged 3 commits into
mainfrom
develop

Conversation

@subodhr258

Copy link
Copy Markdown
Collaborator

Sync develop to main for the v2.2.3 patch release.

Includes:

KMchaudhary and others added 2 commits September 15, 2026 13:28
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.
Copilot AI balanced review requested due to automatic review settings September 16, 2026 08:53

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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.

@github-actions

Copy link
Copy Markdown

🔍 WordPress Plugin Check Report

⚠️ Status: Passed with warnings

📊 Report

🎯 Total Issues ❌ Errors ⚠️ Warnings
16 0 16

⚠️ Warnings (16)

📁 composer.json (1 warning)
📍 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

…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
Copilot AI review requested due to automatic review settings September 16, 2026 10:03

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The targeted parser fix is field-sanitized and covered by focused regression and caller-boundary tests.

Review details
  • Files reviewed: 11/12 changed files
  • Comments generated: 0 new
  • Review effort level: Balanced

@subodhr258
subodhr258 merged commit af62be1 into main Sep 16, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants