Skip to content

Fix chart creation nonce verification mismatch#1261

Merged
vytisbulkevicius merged 3 commits intodevelopmentfrom
bugfix/fix-chart-creation-nonce-clean
Mar 4, 2026
Merged

Fix chart creation nonce verification mismatch#1261
vytisbulkevicius merged 3 commits intodevelopmentfrom
bugfix/fix-chart-creation-nonce-clean

Conversation

@vytisbulkevicius
Copy link
Contributor

Summary

Fixes the nonce verification mismatch that broke chart creation in the development branch.

Problem

The security PR added nonce action parameters but had a bug in _handleTypesPage():

  • Nonces are created WITH action: wp_create_nonce('visualizer-upload-data')
  • But _handleTypesPage() verified WITHOUT action: wp_verify_nonce($nonce)
  • Result: Nonce verification failed, preventing chart creation

Solution

Updated _handleTypesPage() nonce verification to include the action parameter:

wp_verify_nonce( filter_input( INPUT_POST, 'nonce' ), 'visualizer-upload-data' )

Changes

  • 1 line changed in classes/Visualizer/Module/Chart.php
  • All other security improvements from the original PR remain intact

Testing

✅ Charts can now be created successfully
✅ Security vulnerability remains fixed (CVE)

🤖 Generated with Claude Code

The security PR that was merged to development added nonce action
parameters to nonce creation and uploadData verification, but forgot
to update _handleTypesPage verification. This caused a mismatch where:

- Nonces were created WITH action: wp_create_nonce('visualizer-upload-data')
- But _handleTypesPage verified WITHOUT action: wp_verify_nonce($nonce)
- Result: Nonce verification failed, chart creation broken

This fix updates _handleTypesPage to verify WITH the action parameter
to match the nonce creation, allowing charts to be created successfully
while maintaining all security improvements.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@pirate-bot
Copy link
Contributor

💂‍♂️ PR Error! No Linked Issue found. Please link an issue or mention it in the body using #<issue_id>

@pirate-bot
Copy link
Contributor

pirate-bot commented Mar 4, 2026

Plugin build for 805544d is ready 🛎️!

vytisbulkevicius and others added 2 commits March 4, 2026 11:54
Layout.php line 983 was unconditionally accessing Visualizer_Pro::ACTION_FETCH_DATA
even in the free version, causing a fatal error when creating charts.

The nonce creation now checks if PRO version is active before accessing
the Visualizer_Pro class, matching the pattern used for the action parameter.

Security fix from previous commit remains intact:
- Chart.php line 958: Nonce verification with 'visualizer-upload-data' action
- uploadData() method: Capability checks and per-chart ownership validation

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Fixed incorrect case usage: Visualizer_PRO -> Visualizer_Pro
This resolves the PHPStan check failure that was blocking CI.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@vytisbulkevicius vytisbulkevicius merged commit 7414479 into development Mar 4, 2026
5 of 8 checks passed
@vytisbulkevicius vytisbulkevicius deleted the bugfix/fix-chart-creation-nonce-clean branch March 4, 2026 10:06
vytisbulkevicius added a commit that referenced this pull request Mar 4, 2026
Merged PR #1261 security fixes from development:
- Fix chart creation nonce verification mismatch
- Fix Visualizer_Pro class not found error in free version
- Fix PHPStan class name case error

Resolved conflict in Types.php by accepting the security fix
(nonce with 'visualizer-upload-data' action parameter).

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@pirate-bot
Copy link
Contributor

🎉 This PR is included in version 3.11.15 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

@pirate-bot pirate-bot added the released Indicate that an issue has been resolved and released in a particular version of the product. label Mar 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

released Indicate that an issue has been resolved and released in a particular version of the product.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants