darvis/livewire-injection-stopper
Protect your Laravel + Livewire app from spam bots and injection attacks. This package blocks automated bots, audits Livewire components for manipulable public properties, and silences bot-triggered exceptions so your Sentry logs stay clean.
Documentation only; the package itself is unchanged.
CLAUDE.md said a nested key is never blocked. A name with a dot skips the block_all_array_injections rule, but it is still blocked when the whole name starts with a fixed prefix (activeFilters.tags, hidden.0). And scalar_properties is compared with the whole name, so email in the list does not cover form.emailscalar_properties must be lowercase. The property name is lowercased before the comparison and the entries are not, so firstName never matchesuse Livewire\Attributes\Locked gets a warning. The command never prints that warning#[Locked] public bool $x = false; on one line "is not recognised", which read as a false positive. Such a line is not seen at all. The limits now also name what else the scan skips: components that extend an own base class (the file must contain extends Component), properties without a default value, the types float, array, ?string, ?int and namespaced classes, and #[Locked, Url]Total: and 📖 See https://livewire.laravel.com/docs/locked … lines. Now also documented: ✅ No security issues found! appears as well when app/Livewire does not exist, so it is not proofContent-Type, text/html; charset=utf-8Livewire::test() never goes through the HTTP layer. It does, with all middleware disabled; the result is the same, and a component test therefore does not show that a top-level array update is blocked in the browser. The example no longer sends a CSRF token, because Laravel does not verify tokens while running testsTypeErrorrenderable(). Since 1.3.0 it hooks dontReport() and reportable() only; the block response comes from the middlewareweb group, so a POST without a valid CSRF token gets Laravel's 419 before the package sees it; a request without a User-Agent is never blocked; * in whitelist_routes also matches slashes; a published list replaces the default list completelyprice is not one of them. The FAQ went from 11 to 10 questions #[Locked] unquoted, which YAML reads as a comment, so both were cut off at that point. They are quoted nowCache or Log without importing themDocumentation: https://arviddejong.github.io/livewire-injection-stopper/
TypeError exceptions (for example: Cannot assign array to property ...) when they originate from Livewire update flowsdontReport, reportable, and renderable hooks for stronger compatibility with Laravel exception pipelinesapp/Exceptions/Handler.php integration guidanceblocked_user_agents config by using single 'python' pattern instead of multiple variantsstr_contains() for wildcard matchingpython-requests, python/requests, python requests, python requests 2., python-urllib (all now covered by 'python')Protect your Laravel + Livewire application from spam bots and security vulnerabilities.
This package protects your Laravel application in two ways:
Automatically blocks automated spam bots (like Python scripts, curl, wget) from accessing your website. No more spam form submissions!
Scans your Livewire components and tells you which properties attackers could manipulate. For example, if you have public $isAdmin = false, an attacker could change it to true in their browser!
composer require darvis/livewire-injection-stopper
That's it! The spam bot blocking is now active.
Run this command to scan your Livewire components:
php artisan livewire-injection-stopper:audit
It will show you which properties need protection.
Before (Vulnerable):
class CheckoutComponent extends Component
{
public $price = 100.00; // ⚠️ Attacker can change this to $0.01!
}
After (Secure):
use Livewire\Attributes\Locked;
class CheckoutComponent extends Component
{
#[Locked] // ✅ Now protected!
public $price = 100.00;
}
By default, these bots are blocked:
python-requests)curl, wget)scrapy)Real browsers and users are never blocked.
Want to customize? Publish the config file:
php artisan vendor:publish --tag=livewire-injection-stopper-config
Now you can:
For detailed documentation, see the /docs folder:
MIT License - feel free to use in any project!
Created by Arvid de Jong
Need help? Check the documentation or email [email protected]
How can I help you explore Laravel packages today?