-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256 NEFARIOUSPLAN-CANONICAL-V1 {"body_md":"## The `permission_callback` returns true. The nonce is the gate.\n\nThe REST route is registered in `ComponentLibrary/controller/CompLibFormHandler.php`:\n\n```php\npublic function init_rest_api_endpoint( $endpoint, $methods, $callback ) {\n add_action(\n 'rest_api_init',\n function () use ( $endpoint, $methods, $callback ) {\n register_rest_route(\n $this->namespace,\n '/' . $endpoint,\n array(\n array(\n 'methods' => $methods,\n 'callback' => $callback,\n 'permission_callback' => array( $this, 'get_item_permissions_check' ),\n // ...\n ),\n )\n );\n }\n );\n}\n\npublic function get_item_permissions_check( $request ) {\n return true;\n}\n```\n\n`permission_callback` is the WordPress REST API's official authorization hook. Returning `true` declares the route open to any caller. Six endpoints register through `init_rest_api_endpoint`: `kirki-login`, `kirki-register`, `kirki-forgot-password`, `kirki-change-password`, `kirki-retrieve-username`, `kirki-comment`. All six share this `permission_callback`. All six are open by REST routing.\n\nThe gate moved into each handler as a call to `validate_nonce()`:\n\n```php\npublic function validate_nonce( $element_name ) {\n $nonce = isset( $_SERVER['HTTP_X_WP_ELEMENT_NONCE'] )\n ? sanitize_text_field( wp_unslash( $_SERVER['HTTP_X_WP_ELEMENT_NONCE'] ) )\n : null;\n\n if ( ! $nonce ) {\n wp_send_json_error( 'Missing nonce', 400 );\n exit;\n }\n\n $action = KIRKI_COMPONENT_LIBRARY_APP_PREFIX . '_' . $element_name;\n\n if ( ! wp_verify_nonce( $nonce, $action ) ) {\n wp_send_json_error( 'Not authorized', 400 );\n exit;\n }\n return true;\n}\n```\n\n`KIRKI_COMPONENT_LIBRARY_APP_PREFIX` is the literal string `'KirkiComponentLibrary'`. For the forgot-password endpoint the verified action is `'KirkiComponentLibrary_kirki-forgot-password'`.\n\nThe nonce that satisfies this check is minted by `ElementGenerator::add_nonce_to_element()` in the same plugin:\n\n```php\nprivate function add_nonce_to_element( $element ) {\n if ( empty( $element['name'] ) ) {\n return false;\n }\n $action = KIRKI_COMPONENT_LIBRARY_APP_PREFIX . '_' . $element['name'];\n // Always returns consistent nonce for same user + action for ~12 hours.\n return wp_create_nonce( $action );\n}\n```\n\nThe comment on the return is the developer's own note. `wp_create_nonce()` for an unauthenticated request mints a nonce against WordPress user ID 0, the anonymous identity. Every anonymous visitor that loads a page rendering the `kirki-forgot-password` element gets the same nonce, valid for the next twelve hours. The nonce is then serialized into a global JavaScript variable on the page by `add_component_library_script()` in `ComponentLibrary/index.php`:\n\n```php\n$script = 'var ' . KIRKI_COMPONENT_LIBRARY_APP_PREFIX\n . ' = window.' . KIRKI_COMPONENT_LIBRARY_APP_PREFIX\n . \" === undefined? {form: $val, root_url:'\" . KIRKI_COMPONENT_LIBRARY_ROOT_URL . \"'} : {...\"\n . KIRKI_COMPONENT_LIBRARY_APP_PREFIX . ', form:{...(' . KIRKI_COMPONENT_LIBRARY_APP_PREFIX . \".form || {}), ...$val}};\";\n```\n\n`$val` is `wp_json_encode( $this->component_lib_forms )`. `$this->component_lib_forms[$id]['nonce']` is the value returned by `add_nonce_to_element()`. The page now contains a `