Skip to content

Protect the chart meta keys - #1424

Open
vytisbulkevicius wants to merge 1 commit into
developmentfrom
bugfix/pro/652
Open

vytisbulkevicius wants to merge 1 commit into
developmentfrom
bugfix/pro/652

Conversation

@vytisbulkevicius

Copy link
Copy Markdown
Contributor

Chart configuration is stored in post meta that only the chart editor is meant to write. WordPress now treats those keys as protected, and the database source refuses three more file statements.

What changed

  • Chart meta — post meta keys that start with visualizer- are protected. The Custom Fields panel, XML-RPC and the REST API no longer accept them. The chart editor, imports, schedules and abilities write through update_post_meta() and work as before.

  • Database source — a query that contains INTO OUTFILE, INTO DUMPFILE or LOAD_FILE is refused, like the other statements on the disallow list.

Note

Tracked in Codeinwp/visualizer-pro#652.

QA

  1. Go to WP Admin → Visualizer → Chart Library. Create a chart, change a setting and save it.

    Expect: the chart saves, and it shows the new setting after a page reload.

  2. Go to WP Admin → Posts → Add New. Open Options (⋮) → Preferences → General → Advanced and turn on Custom fields. In the Custom Fields panel, add a field with the name visualizer-test and any value.

    Expect: WordPress does not add the field.

  3. In the same panel, add a field with the name my-test and any value.

    Expect: WordPress adds the field.

🤖 Generated with Claude Code

Chart meta selects the data source of a chart. Mark the keys as protected,
so that only the plugin writes them, and refuse file access in a stored query.

Co-Authored-By: Claude Mythos 5.2 <noreply@anthropic.com>
@pirate-bot

Copy link
Copy Markdown
Contributor

Plugin build for 94cbd14 is ready 🛎️!

@pirate-bot pirate-bot 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.

🟢 Approved

This approves the change: chart meta keys are protected on every core meta route, and the database source refuses the three file statements.

Validation details
  • Files reviewed: 3/3 changed files.
  • The new PHPUnit file passed at HEAD on PHP 8.3.37 and WordPress 7.1.5 cd /repo && (phpunit --do-not-cache-result --filter 'Test_Visualizer_Chart_Meta_Protection::' --testdox 2>&1 | tee /work… (run R6, exit 0).
  • All 10 cases failed with the pr-base versions of Setup.php and Query.php set -o pipefail; B=/workspace/checks/C1/base; rm -rf $B; mkdir -p $B && git -C /repo archive HEAD | tar -x -C $B && cp -… (run R3, exit 0).
  • INTO#c plus newline OUTFILE and INTO -- c plus newline DUMPFILE were refused cd /workspace/checks/C1/probe && mv probe-c1.php Probe_C1.php && cd /repo && (phpunit --do-not-cache-result --bootstrap … (run R5, exit 2).
  • Every core caller of is_protected_meta() passes 'post' in WordPress 5.2 and 7.1.
  • Every CF_* chart meta key starts with visualizer-.
Untested areas
  • Visualizer Pro handlers and SQL filters were not checked, because their source is not available.
  • File writes could not be observed, because the sandbox database user has no FILE privilege.
  • The variant pass did not settle these places, where the fixed cause may still reach:
    • classes/Visualizer/Source/Query/Params.php:103-112,254-262,291-304 — unverified: Column discovery interpolates $table into SQL before the inherited SELECT check. Whether request-controlled table expressions reach these methods depends on unavailable Pro callers…
    • classes/Visualizer/Module/Chart.php:1719-1739 — unverified: Pro callbacks receive filter-save requests, REST action records, and post-validation SQL. Their authorization, accepted fields and possible SQL replacement cannot be settled withou…
    • classes/Visualizer/Module/Frontend.php:269 — unverified: Pro callbacks receive filter-save requests, REST action records, and post-validation SQL. Their authorization, accepted fields and possible SQL replacement cannot be settled withou…
    • classes/Visualizer/Source/Query.php:153-159 — unverified: Pro callbacks receive filter-save requests, REST action records, and post-validation SQL. Their authorization, accepted fields and possible SQL replacement cannot be settled withou…
    • classes/Visualizer/Module.php:731-744 — unverified: Chart editors reach visualizer_save_filter; unavailable Pro callbacks determine whether request fields can configure privileged sources without additional authorization.
    • classes/Visualizer/Module/Chart.php:1191-1196,1371-1372,1385-1405 — unverified: the table/excel editor branch passes submitted data to visualizer_pro_handle_chart_data, then fetches and stores the returned source. Missing Pro implementation determines whether …

🤖 Automated review · run code-review-agent_6b09d1a0421d31.79092034.


🤖 Review agent — review posted ✅ on 94cbd144 · approved · 0 findings · 18 min

Run code-review-agent_6b09d1a0421d31.79092034 · trail

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.

2 participants