Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [1.9.3] - 2026-12-03

### Fixed

- The core guidelines and the REST and AJAX skill no longer announce a future major version of `pollora/ajax`: 2.0 is out. They say that an action which chose no nonce runs unchecked in a Pollora project unless `pollora.ajax.nonce_by_default` is `true`.

## [1.9.2] - 2026-11-27

### Changed
Expand Down
2 changes: 1 addition & 1 deletion resources/boost/guidelines/core.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ class InternalHelper {}
- **Which template answered?** With `WP_DEBUG` on, every page carries `<!-- pollora:template="single" path="themes/x/resources/views/single.blade.php" -->` (hierarchy responses only, not `Route::wp()` or Laravel routes)
- **Debugging**: `composer require --dev pollora/debugbar` adds Pollora's and WordPress's tabs to Laravel Debugbar — what answered the request (route, or hierarchy view and condition), `$wpdb` queries, hooks, WordPress phases, and REST/admin-ajax calls in the bar's request list. Prefer it to Query Monitor. Plugins add data with the `pollora/debugbar/register` action (no dependency), packages by extending `Pollora\Debugbar\Collector`; `wp_*` and `pollora*` tab names are reserved
- **Meta, roles, bindings**: declare a meta with `#[Meta]` on a typed property rather than calling `register_meta()` and casting `get_post_meta()` by hand (`pollora-typed-meta` skill); declare roles with `#[Role]` / `#[ModifyRole]` rather than `add_role()`, and check a capability (`can:`, `@can`) rather than a role (`pollora-roles` skill); bind core blocks to a `#[BlockBinding]` source or `pollora/post-meta` before writing a custom block (`pollora-block-bindings` skill)
- **CSRF and nonces**: WordPress endpoints are excluded from Laravel CSRF — WordPress uses its own nonce system. Say how every `#[Ajax]` action is protected (pollora/ajax 1.2+): `nonce: true` verifies a nonce (create it with `wp_create_nonce('action')`, send it as `_ajax_nonce`) before the method runs, `nonce: false` turns it off on purpose; an action that does not say still runs unchecked for now and is reported with `WP_DEBUG`, and the next major version of `pollora/ajax` verifies a nonce by default. Never leave an action open to guests without deciding. A REST route is protected by its permission callback
- **CSRF and nonces**: WordPress endpoints are excluded from Laravel CSRF — WordPress uses its own nonce system. Say how every `#[Ajax]` action is protected (pollora/ajax 1.2+): `nonce: true` verifies a nonce (create it with `wp_create_nonce('action')`, send it as `_ajax_nonce`) before the method runs, `nonce: false` turns it off on purpose; an action that does not say runs unchecked in a Pollora project, and is reported with `WP_DEBUG`, unless `pollora.ajax.nonce_by_default` is `true` (`config/pollora/ajax.php`, set by the skeleton from 13.45.0), which verifies it like `nonce: true`. Never leave an action open to guests without deciding. A REST route is protected by its permission callback
- **Modules**: Use `nwidart/laravel-modules` for large projects — `pollora:make:module` creates a lean module (no provider: discovery works inside modules), built with `@pollora/vite-config`; switch modules with `module:enable|disable` or Plugins › Modules (see the `pollora-modules` skill)

### Available Artisan Commands
Expand Down
2 changes: 1 addition & 1 deletion resources/boost/skills/pollora-rest-api/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ The `nonce` parameter:
| `true` | Verifies a nonce named after the action before the method runs. A request without a valid one gets a 403 (`pollora_ajax_invalid_nonce`) and the method does not run |
| `'notes_form'` | Verifies the nonce of that name |
| `false` | No nonce, on purpose (a public beacon, a webhook that signs its own requests) |
| not given | Not chosen yet: the action runs **without a check** and WordPress is told (`_doing_it_wrong()`, visible with `WP_DEBUG`). The next major version of `pollora/ajax` verifies a nonce by default |
| not given | Depends on the project: verified like `true` when `pollora.ajax.nonce_by_default` is `true` (`config/pollora/ajax.php`, set by the skeleton from 13.45.0). Otherwise the action runs **without a check** and WordPress is told (`_doing_it_wrong()`, visible with `WP_DEBUG`) |

The page creates the nonce for the same name, `wp_create_nonce('subscribe')`, and sends it in the `_ajax_nonce` field. Always choose `true` or `false` when you write an action: never leave it out, and never write `nonce: false` for an action that changes data without another protection. A guest's nonce is tied to no user and a cached page can serve an old one, so prefer another protection for an action open to guests. A `check_ajax_referer()` call in a method that declares `nonce: true` is redundant; a method that verifies the nonce by hand says `nonce: false`, so that Pollora does not report it.

Expand Down
6 changes: 4 additions & 2 deletions tests/Feature/Guidelines/CoreGuidelinesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ public function render(string $path): string
->toContain('Say how every `#[Ajax]` action is protected (pollora/ajax 1.2+)')
->toContain('`nonce: true` verifies a nonce')
->toContain('`nonce: false` turns it off on purpose')
->toContain('the next major version of `pollora/ajax` verifies a nonce by default')
->toContain('unless `pollora.ajax.nonce_by_default` is `true`')
->not->toContain('next major version of `pollora/ajax`')
->toContain('Never leave an action open to guests without deciding');
});

Expand All @@ -73,7 +74,8 @@ public function render(string $path): string
->toContain('pollora_ajax_invalid_nonce')
->toContain('wp_create_nonce(\'subscribe\')')
->toContain('->requireNonce()')
->toContain('The next major version of `pollora/ajax` verifies a nonce by default')
->toContain('verified like `true` when `pollora.ajax.nonce_by_default` is `true`')
->not->toContain('next major version of `pollora/ajax`')
->not->toContain("check_ajax_referer('newsletter')");
});

Expand Down
Loading