Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Livewire Injection Stopper Laravel Package

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.

View on GitHub
Deep Wiki
Context7

Product Decisions This Supports

  • Security Hardening: Justifies investment in proactive bot/spam mitigation to reduce support overhead and prevent data manipulation (e.g., form submissions, Livewire property tampering).
  • Developer Experience (DX): Enables faster debugging by eliminating noise in error logs (e.g., Sentry) caused by bot-driven exceptions, allowing teams to focus on legitimate issues. v1.3.1 strengthens this with troubleshooting docs that map literal log messages → cause → fix, an installation page with a "check that it works" step, a copy-paste feature test, and a quick-start page — cutting time-to-first-value and the support burden of onboarding.
  • Compliance/Trust: Aligns with security best practices for SaaS platforms handling user-generated data or sensitive operations (e.g., admin flags, payments). Caveat now documented: the audit command is a static, best-effort scan with named blind spots (see below), so it is supporting evidence for a security review — not a compliance artifact or a clean bill of health.
  • Build vs. Buy: Avoids reinventing middleware for bot detection or Livewire security scans, leveraging a lightweight, MIT-licensed solution with minimal maintenance burden. v1.3.1 ships documentation only — no runtime changes — reinforcing the low-maintenance profile.
  • Roadmap Prioritization: Validates security audits as a low-effort, high-impact feature for new Livewire-heavy products or migrations to Laravel Livewire. Scope the audit task realistically: it is a fast triage pass over app/Livewire, not a full component inventory.

When to Consider This Package

  • Adopt if:

    • Your Laravel app uses Livewire and exposes public forms, user inputs, or component properties that could be manipulated (e.g., public $isAdmin, public $userRole).
    • You experience spam bot submissions (e.g., fake signups, form spam) or high volumes of CannotUpdateLockedPropertyException in logs.
    • Your team lacks dedicated security resources to manually audit Livewire components for injection risks.
    • You rely on Sentry/Error Tracking and want to reduce noise from bot-driven exceptions.
    • Your app is public-facing (not internal-only) and handles user-generated data.
    • You want a fast, low-ceremony first pass on Livewire property exposure before a deeper security sprint.
  • Look elsewhere if:

    • Your app doesn't use Livewire (this package is Livewire-specific).
    • You need enterprise-grade bot protection (e.g., CAPTCHA, rate limiting, or IP reputation services like Cloudflare Bot Management). Note the documented limitation: a request with no User-Agent is never blocked, and the default list is deliberately conservative — it is a noise filter, not a gate.
    • Your security requirements exceed this package's scope (e.g., CSRF protection, SQL injection, or advanced DDoS mitigation). The middleware runs at the end of the web group, so a POST without a valid CSRF token receives Laravel's 419 before the package ever sees it.
    • You're already using a dedicated WAF (e.g., Cloudflare, AWS WAF) that overlaps with this middleware's functionality.
    • Your team prefers custom solutions for security audits or has existing tools (e.g., PHPStan, Psalm) for property analysis.
    • You need audit coverage of a codebase with a shared base component. The scan only inspects files containing extends Component; components extending your own base class are skipped entirely. It also skips properties without a default value, the types float, array, ?string, ?int and namespaced classes, combined attributes like #[Locked, Url], and single-line declarations such as #[Locked] public bool $x = false;. A ✅ No security issues found! message is also printed when app/Livewire does not exist, so a green result is not proof of safety.
  • Configuration gotchas worth knowing before you ship (all newly documented in v1.3.1):

    • scalar_properties entries must be lowercase, and are matched against the whole property name — so email does not cover form.email.
    • A dotted/nested key skips the array-injection rule, but is still blocked when the whole name begins with a fixed prefix (activeFilters.tags, hidden.0).
    • A published config list replaces the default list completely rather than merging.
    • * in whitelist_routes also matches slashes — a broad pattern can open more surface than intended.
    • Livewire::test() does traverse the HTTP layer but with middleware disabled, so a component test will not demonstrate that a top-level array update is blocked in the browser — validate that path with a real request.

How to Pitch It (Stakeholders)

For Executives (Business/Leadership)

*"This package adds a lightweight, automated shield against two costly security risks in our Laravel/Livewire apps:

  1. Spam bots clogging forms and support queues (e.g., fake signups, contact submissions), which waste team time and degrade user trust.
  2. Hidden vulnerabilities in Livewire components where attackers could manipulate critical properties (e.g., bypassing admin checks or altering user roles) without our knowledge.

By installing this in 5 minutes, we'll:

  • Reduce support overhead from spam by ~30% (based on similar tools).
  • Surface risky Livewire properties for a fast triage pass, lowering compliance risk exposure.
  • Clean up error logs, saving DevOps time debugging bot noise.

The v1.3.1 release is documentation-only — no code changes, no migration risk — and adds a step-by-step install guide with a verification check, a 5-minute quick start, and a troubleshooting page that turns error messages into fixes. That lowers the cost of adoption and the ongoing support burden. It's a no-code, low-risk upgrade with immediate ROI — think of 'set-and-forget' noise reduction and a security smoke test for our Livewire features. Important framing: it complements, and does not replace, our WAF or a proper security review — and its audit is a triage tool with known gaps, not a certification."*

For Engineering (Devs/Architects)

*"This package solves two pain points with minimal friction:

  1. Bot Blocking: Adds middleware to reject non-browser traffic (e.g., curl, Python scripts) via user-agent/headers checks — no CAPTCHA or rate-limiting complexity. It sits at the end of the web group, so Laravel's CSRF 419 fires first, and requests with no User-Agent are never blocked — budget for that when sizing the spam reduction.
  2. Livewire Security Audit: Scans components for public properties attackers could hijack (e.g., $isAdmin = true), with a CLI tool to flag risks. Example:
    php artisan livewire:audit
    
    Output: Lists vulnerable properties like public $userTier in ProfileComponent.
  3. Error Log Hygiene: Silently catches bot-triggered CannotUpdateLockedPropertyException errors via dontReport()/reportable() (not renderable() since 1.3.0), preventing Sentry noise; the block response itself comes from the middleware and uses Laravel's default text/html content type.

Tradeoffs & limits (now explicitly documented in 1.3.1):

  • Not a replacement for WAFs or advanced DDoS tools; no CAPTCHA, rate limiting, or IP reputation.
  • Audit is static analysis and will not catch runtime logic flaws. It only sees files containing extends Component, so components extending your own base class are invisible to it; it also skips properties without defaults, float/array/?string/?int/namespaced-typed properties, #[Locked, Url], and single-line #[Locked] declarations. ✅ No security issues found! also prints when app/Livewire is absent.
  • Config footguns: scalar_properties must be lowercase and matches the whole name; published lists replace defaults rather than merge; * in whitelist_routes matches slashes.
  • Dotted/nested keys bypass the block_all_array_injections rule but are still blocked when the name starts with a fixed prefix (activeFilters.tags, hidden.0).
  • Livewire::test() runs through the HTTP layer with middleware disabled, so component tests do not prove a top-level array update is blocked in the browser — add a request-level test.

Recommendation: Add to new Livewire projects, and run livewire:audit during the next security sprint as a fast triage pass — then supplement with a manual review of base-class components and non-defaulted/typed properties it skips. Start from the new Quick start and run the install page's "check that it works" step; consult the Troubleshooting page (symptom → cause → fix) before filing issues. Composer install + middleware registration = done."*

Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
ably/pubsub-server
mstfkhazaal/defender
mfonte/base62x
karnoweb/metapilot
tobya/bcsapiwrapper
swalker2/cpanel
vish4395/laravel-translation-manager
morningtrain/economic
teksite/systeminfo-laravel
atomcms/voting
run6/weather
siokas/laravelembeddirectives
adamlien/pkuuids
gilsonsouza/lara-doc-generator
manelgavalda/enrollment_mobile
unabomber/timezone
delatbabel/contacts
astritzeqiri/g-recaptcha
kevinongko/laravel-genode
developeruz/laravel-analytics