Skip to content

Put nonce and capability checks where Plugin Check can see them - #4

Open
jeffreyvr wants to merge 12 commits into
mainfrom
cursor/nonce-capability-checks-8244
Open

Put nonce and capability checks where Plugin Check can see them#4
jeffreyvr wants to merge 12 commits into
mainfrom
cursor/nonce-capability-checks-8244

Conversation

@jeffreyvr

@jeffreyvr jeffreyvr commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

This should land via the wporg-ready work (open PR #2). Do not merge #2 from here; this branch is based on wporg-ready and targets main.

Nonces (original)

WordPress.org / Plugin Check flagged Nonces and User Permissions Before Processing Requests. The handlers already had CSRF and capability checks; WPCS does not follow into helpers, so $_POST reads in Ajax::connect(), Ajax::syncId(), AddToCart::requestPayload(), and HostNavigation::requestPayload() looked unprotected.

  • Admin AJAX: check_ajax_referer('datalumo_admin') and current_user_can('manage_options') are now in the same function as the $_POST read.
  • Guest AJAX: requestPayload() calls check_ajax_referer only (still wp_ajax_nopriv_*).
  • OAuth callback unchanged: hashed state vs the per-user transient + manage_options. No WP nonce.

Out of date libraries

  • automattic/jetpack-autoloader ^3.0^6.0 (resolves to v6.0.0). Bootstrap is still vendor/autoload_packages.php.
  • woocommerce/action-scheduler ^3.0^4.1 (resolves to 4.1.0). action-scheduler.php path and as_enqueue_async_action / as_schedule_single_action / as_unschedule_all_actions / as_has_scheduled_action are unchanged. Hooks remain datalumo_push_page, datalumo_push_batch, datalumo_delete_page.
  • Action Scheduler 4.1 requires WordPress 6.8, so the plugin header and readme Requires at least is now 6.8 (was 6.0).
  • composer.lock stays gitignored (existing release convention: composer install on the tag). The GitHub release zip still builds vendor/ from these constraints.

Translation files included

  • Removed bundled languages/*.po and languages/*.mo (nl_NL, zh_CN, zh_HK, zh_TW).
  • Kept languages/datalumo.pot (template, not a locale) and languages/index.php.
  • Text domain datalumo and Domain Path: /languages unchanged. No load_plugin_textdomain (WordPress just-in-time loading). Source esc_html__ / __ calls unchanged.
  • .distignore, .gitignore, and the release zip excludes now drop languages/*.po, languages/*.mo, and *.l10n.php.

Tests

composer test — 90 passed (264 assertions).

Open in Web Open in Cursor 

jeffreyvr and others added 11 commits August 28, 2026 14:07
Drop the GitHub update checker, add a license and dist ignore list, and tighten settings, notices, and logging for Plugin Check.

Co-authored-by: Cursor <cursoragent@cursor.com>
Owners can grant access from WordPress instead of pasting keys. Products now send short description, categories, tags, visible attributes, and SKU.

Co-authored-by: Cursor <cursoragent@cursor.com>
Connect with Datalumo stays the main action. The URL field is still there for self-hosted installs, and opens when a non-cloud URL is already stored.

Co-authored-by: Cursor <cursoragent@cursor.com>
fresh-site and ensure-index-php are maintainer tools, not something a WordPress site should receive.

Co-authored-by: Cursor <cursoragent@cursor.com>
Keep directory listing prep (no GitHub updater, documented service, dismissible notice) on top of 0.2.0 thumbnails and Connect/Woo work.

Co-authored-by: Cursor <cursoragent@cursor.com>
Add translators comments, use wp_parse_url, and document the remaining scanner false positives.

Co-authored-by: Cursor <cursoragent@cursor.com>
List jeffreyvr as the only contributor, document the remaining data sent, and treat visitor identity as an optional hook.

Co-authored-by: Cursor <cursoragent@cursor.com>
Keep them in .wordpress-org so the release zip does not ship directory assets.

Co-authored-by: Cursor <cursoragent@cursor.com>
…nch.

Co-authored-by: Cursor <cursoragent@cursor.com>
… operator.

Co-authored-by: Cursor <cursoragent@cursor.com>
Plugin Check / WPCS does not follow helper methods, so Ajax connect and
syncId, plus the add-to-cart and host-navigation payload readers, now
call check_ajax_referer (and manage_options where the action is admin)
inline. Public guest handlers and the OAuth callback stay unchanged.

Co-authored-by: Jeffrey van Rossum <rossum.jeffrey@gmail.com>
@jeffreyvr
jeffreyvr marked this pull request as ready for review August 31, 2026 13:37
Require Jetpack Autoloader 6.0.0 and Action Scheduler 4.1.0. Raise
Requires at least to 6.8 to match Action Scheduler. Drop bundled
.po/.mo translations so WordPress.org can supply them via
translate.wordpress.org; keep the .pot template and exclude locale
files from the distribution zip.

Co-authored-by: Jeffrey van Rossum <rossum.jeffrey@gmail.com>
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