Skip to content

fix: reject cyclic serialized chart data in decode_content()#1345

Merged
Soare-Robert-Daniel merged 1 commit into
developmentfrom
fix/reject-cyclic-serialized-data
Jul 16, 2026
Merged

fix: reject cyclic serialized chart data in decode_content()#1345
Soare-Robert-Daniel merged 1 commit into
developmentfrom
fix/reject-cyclic-serialized-data

Conversation

@Soare-Robert-Daniel

@Soare-Robert-Daniel Soare-Robert-Daniel commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Summary

Ports the contains_references() guard from Visualizer Pro (Codeinwp/visualizer-pro#600) into the free plugin. unserialize() with allowed_classes => false blocks object injection but not references, so a self-referential serialized array survived decoding and drove strip_incomplete_objects() into unbounded recursion — a memory/stack-exhaustion DoS reachable from any render/export/clone path.

decode_content() now walks the decoded value with ReflectionReference::fromArrayElement() (PHP 7.4+, matching the plugin's declared minimum) and returns false when any array element is a reference. Cyclic structures necessarily contain a reference, and rejecting all references also prevents shared references from becoming cycles later.

Will affect visual aspect of the product

NO

Test instructions

  • vendor/bin/phpunit --filter Test_Security_Object_Injection — a cyclic serialized array is rejected by decode_content() instead of recursing.
  • Manually: charts with existing (non-cyclic) serialized data still render, export, and clone.

Check before Pull Request is ready:

🤖 Generated with Claude Code

Ports the contains_references() guard from Visualizer Pro (#600) into the
free plugin. unserialize() with allowed_classes=false blocks object
injection but not references, so a self-referential serialized array
survived and drove strip_incomplete_objects() into unbounded recursion
(memory/stack exhaustion DoS) on any render/export/clone path.

Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
@pirate-bot

Copy link
Copy Markdown
Contributor

Plugin build for f63ee10 is ready 🛎️!

@pirate-bot pirate-bot added the pr-checklist-complete The Pull Request checklist is complete. (automatic label) label Jul 16, 2026
@Soare-Robert-Daniel
Soare-Robert-Daniel merged commit 766adef into development Jul 16, 2026
14 of 16 checks passed
@Soare-Robert-Daniel
Soare-Robert-Daniel deleted the fix/reject-cyclic-serialized-data branch July 16, 2026 09:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr-checklist-complete The Pull Request checklist is complete. (automatic label)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants