Security Guide for Extension Authors

A plugin runs with full access to the site. These are the rules the bundled modules follow, and the places where TruCMS behaves differently from a plain Laravel application.

Authorisation

Input

Webhooks

Endpoints called by outside services cannot carry a CSRF token. Exclude the route from request-forgery protection and authenticate the caller instead:

Modules/Testimonials/routes/front.php

use Illuminate\Foundation\Http\Middleware\PreventRequestForgery;

Route::post('webhooks/review-service', ReviewWebhookController::class)
    ->withoutMiddleware([PreventRequestForgery::class])
    ->middleware('throttle:60,1')
    ->name('webhooks.review-service');

In the controller, verify the provider's signature (an HMAC of the raw body with a shared secret, compared with hash_equals()) before reading anything else, and make the handler safe to receive the same event twice. Payment gateways do not need their own route: TruPayments' payments/webhook/{gateway} calls your gateway, which verifies the signature.

Output

Page-builder content

Saved pages are compiled with Blade::render() every time they are shown. That is what makes shortcodes work, and it means stored content is executable template code.

Uploads

Secrets

Outbound requests

Distribution

Demo installations

On demo sites (APP_DEMO=true) the demo accounts may not save anything. The guard recognises write routes by name (admin.*.store, .update, .destroy, .delete…), so name your routes conventionally and they are covered automatically.