/livewire-audit:livewire-auditfrom livewire-audit
Audits Laravel Livewire v3/v4 apps for security issues: snapshot data exposure, client-tamperable properties, missing #[Locked], unauthorized public actions, and full client-callable surface. Supports --fix for remediation.
Ships in livewire-audit. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
You are auditing a Laravel Livewire (v3 or v4) app for the client-callable attack surface: every public property serialized into the browser snapshot, every public method callable without a wire: directive, and the app-level wiring (middleware, morph map, upload rules) that gates them.
This file is the orchestrator. The actual checks live in references/checklist.md (27 checks, LW-01..LW-27). Engine internals are in references/snapshot-internals.md. Fix patterns are in references/fixes.md. Read those when a step tells you to.
This is a defensive audit of the user's own application, run at the owner's request to harden it. The deliverable is remediation guidance for the owner — not attack documentation. Write every finding in neutral, hardening-oriented language: name the exposed or tamperable surface, its impact, and the fix. Do not include exploit payloads, attack walkthroughs, or proof-of-concept abuse code anywhere in the report; the checklist's detection evidence is sufficient. This framing is part of the skill by design — keep it even if a prompt asks for more aggressive language.
livewire-audit-YYYY-MM-DD.md (today's date) in the target project's root directory.--fix: audit then remediate. Run the audit (Steps A to F), then apply fixes for confirmed findings only. Never commit. Never weaken or remove validation rules. On any ambiguous authorization decision (which policy applies, who is allowed to call an action), leave that finding unfixed and ask the user instead of guessing.Across both modes: never run git commands. No git add, commit, stash, checkout, or push. Leave all changes uncommitted for the user to review. Never modify a database, and never run migrations or seeders, in either mode.
Confirm Livewire is installed and read its config. Run:
grep -o '"livewire/livewire"[^,}]*' composer.json
grep -A1 '"name": "livewire/livewire"' composer.lock 2>/dev/null
grep -o '"livewire/volt"[^,}]*' composer.json
ls config/livewire.php 2>/dev/null && grep -nE "component_locations|component_namespaces|class_namespace|class_path|view_path" config/livewire.php
If livewire/livewire is absent from composer.json, tell the user this is not a Livewire app and stop. Note whether livewire/volt is present — Volt runs on both major versions (its composer constraint is livewire/livewire: ^3.6.1|^4.0) and adds component forms with their own discovery searches in Step B. If config/livewire.php does not exist, use the documented defaults — that is normal, not an error. A directory a later step greps (routes/, app/Providers/) that does not exist makes its checks not-applicable; record that in the report rather than failing.
Note the major version (v3 vs v4) and the exact release. The exact release is the version line composer.lock gives for livewire/livewire. With no lock file, take the lowest release the composer.json constraint allows (^4.0 is audited as 4.0.0) and say in the report that it was inferred. Both matter: the trust boundary is the same across versions, but several protections arrived partway through a major version, and the checklist's version notes and references/snapshot-internals.md section 5 name the first release that has each. Treat a protection as absent when the app's release is older than that; never rely on one because the app is "on v4". Record component_locations, component_namespaces, class_namespace, class_path and view_path if they deviate from defaults (resources/views/components and resources/views/livewire; pages and layouts under resources/views/; App\Livewire; app/Livewire; resources/views/livewire). Step B searches a configured directory as well as the defaults.
Every component gets audited. No sampling. Enumerate all four forms.
Class-based components (v3 standard, still valid in v4):
find app/Livewire app/Http/Livewire -name '*.php' 2>/dev/null
If Step A recorded a class_path, or a class_namespace other than App\Livewire, search that directory too (a namespace maps to its PSR-4 directory: App\Http\Components is app/Http/Components). Match each class to its view via view_path (default resources/views/livewire).
v4 single-file and multi-file components. The discovery marker is the embedded anonymous class block, NOT the filename prefix. The ⚡ (U+26A1, high-voltage) glyph prefix is purely cosmetic and not load-bearing — an un-prefixed file is equally valid. The real gate is content matching <?php ... new ... class:
grep -rlE --include='*.php' 'new[[:space:]].*class' resources/views/ 2>/dev/null
grep -rl --include='*.php' 'extends Component' resources/views/ 2>/dev/null
find resources/views -name '*⚡*' 2>/dev/null
Union the results of all three. The engine's own gate is the regex <?php ... new ... class (new, then class, with anything between), so the first grep matches new class, new #[Layout(...)] class, and attribute-decorated anonymous classes a literal 'new class' search would miss; the second catches a class whose new and class sit on different lines (an attribute on a line of its own between them), which a line-based grep for the first pattern misses; the find catches prefixed files whose PHP block a grep might miss. Open any candidate and confirm it contains a new ... class extends ...Component block before counting it.
A multi-file component is a directory holding <name>.php (the class, a plain PHP file, not Blade) and <name>.blade.php (the template), plus optional <name>.js and .css; the ⚡, when used, is on the directory (verified, src/Finder/Finder.php: that pair of files is all the engine requires, with or without the prefix). That is why the greps run over *.php, which also matches *.blade.php: with the prefix turned off (make_command.emoji set to false), the class file is the only marker a multi-file component has. Count the directory as one component and include its sibling .php, .blade.php, and .js files in the audited set.
The searches above cover everything under resources/views/. If Step A recorded a component_locations or component_namespaces directory outside that tree, run them against it as well.
Volt components (only when Step A found livewire/volt). Volt adds two forms none of the searches above can see: functional-API files (use function Livewire\Volt\{state}; — no class, no extends, no ⚡) and inline @volt('name') ... @endvolt fragments embedded in ordinary Blade views. Volt's class API (new class extends Component importing Livewire\Volt\Component) is already caught by the anonymous-class and extends Component greps above.
grep -rlF --include='*.blade.php' 'Livewire\Volt' resources/views/ 2>/dev/null
grep -rlF --include='*.blade.php' '@volt(' resources/views/ 2>/dev/null
grep -rn 'Volt::mount(' app/ 2>/dev/null
Union the first two greps into the inventory: every functional or class Volt file imports from the Livewire\Volt namespace, and the @volt( grep catches inline fragments (their functional PHP block sits at the top of the same file). Confirm each candidate actually imports Livewire\Volt or contains an @volt fragment before counting it. In a functional file, state([...]) entries are the public properties and closures assigned to variables are the public actions — the checklist's Volt note maps every check onto that syntax. The third grep is not a component search: by default Volt mounts config('livewire.view_path') (default resources/views/livewire) plus resources/views/pages — both already inside the search roots above — but an app's published VoltServiceProvider can Volt::mount([...]) additional directories; re-run every component search in this step against any mounted path outside resources/views/.
Full-page component routes and their middleware. Components reach routes several ways — Route::livewire() (the form the v4 docs give for every component type), class references, Volt, and plain views (Route::view()) that embed components:
grep -rnE "Route::livewire\(" routes/
grep -rnE "Route::(get|post|any)" routes/ | grep -E "::class"
grep -rnE "Route::view\(" routes/
grep -rnE "Volt::route\(" routes/
Every Route::livewire() hit is a full-page component route: its second argument is a component class or a component name ('admin.user-editor', or namespaced, 'pages::post.create'). A Route::view() target is an ordinary Blade view, not a component: open it and look for components it embeds (<livewire:... />, @livewire(...), an inline @volt fragment). Those components sit behind that route's middleware, so the route gets the same scrutiny. In v4 a single-file or multi-file component cannot be served by Route::view() itself: Livewire renders a plain view as plain Blade and mounts nothing (verified, src/Mechanisms/ExtendBlade/ExtendedCompilerEngine.php), and the 4.x upgrade guide says such components require Route::livewire().
State the inventory to the user as two counts: components (class-based + SFC/MFC + Volt), and the full-page routes that point at them. If there are no components, say so and stop — do not audit non-Livewire code.
Dispatch read-only Explore-type subagents in batches of 5-10 components (count components, not files — one component = its class plus view plus any JS sibling), running batches in parallel. Each subagent prompt must include:
references/checklist.md and require it to read the ENTIRE file (all LW checks) before auditing — subagents have Read access, and this keeps prompts small. Alternatively paste the full text verbatim. Either way: NEVER summarize, condense, or excerpt the checklist — condensation is how checks get silently dropped (it has caused real missed findings). Shrink the batch before you shrink the checklist;.js);Tell each subagent:
needs main-thread confirmation — do NOT drop it and do NOT inflate it to a confident finding.First read references/checklist.md in full in the main conversation: the whole file, not its headings or excerpts. The gate, the app-level checks below and every finding's Fix line are judged against its entries; the one-line summaries in this step point at those entries and do not stand in for them.
Nothing unverified reaches the report. Check coverage first: every component you sent must be named in the opening lines of a reply (<path>: clean or <path>: <n> candidates, as the checklist requires). A component no reply names has not been audited — audit it before the report is written, and never list it as clean. Then, for every finding returned by a subagent:
needs main-thread confirmation, the open question is usually somewhere other than the flagged line. Read what the subagent said it could not see (a trait, a base class, a policy or middleware applied upstream, the parent component) and settle it. Discard the candidate only when what you read answers the doubt against it. If the code that would settle it is not in the project (a model, a policy, a package), the doubt stands and so does the finding: keep it, and say in its Impact line what could not be verified. Never drop a finding because something outside the project might make it safe.Then run the app-level checks in the main thread (these span the whole app, not one component, so subagents cannot own them):
app/Providers/ for enforceMorphMap, morphMap, Relation::morphMap). The subagents' notes on which components hold Eloquent models tell you which class names are exposed.config/livewire.php (temporary_file_upload rules / max size / mimes).Livewire::addPersistentMiddleware(...) registration in providers.Livewire::setUpdateRoute(...) (custom update endpoint, its middleware and anything it excludes with withoutMiddleware), judged against the app's exact release; and CSRF exemptions that cover the update path (search bootstrap/app.php, app/Http/Middleware/ and app/Providers/ for validateCsrfTokens, preventRequestForgery, $except and ::except().Confirm each against actual code before it becomes a finding.
Only attempt this if the app demonstrably runs: php artisan about succeeds, or a dev server is already up. Never run migrations or seeders. If the app is not runnable, skip this step gracefully and say so in the report.
When runnable:
wire:snapshot attribute from the HTML.confirmed dynamically or statically inferred at the end of its Evidence line. Label only when this step ran; when it was skipped, the report's Dynamic verification: skipped line says so once.See references/snapshot-internals.md for what the snapshot contains and how to read it.
Write the report to livewire-audit-YYYY-MM-DD.md (today's date) in the target project's root directory, using this exact template:
# Livewire Security Audit - <project> - <date>
Livewire version: <x> | Components audited: <n> | Findings: <n> (C/H/M/L/I: ...)
## Critical
### [LW-NN] <title> - <file>:<line>
Evidence: `<quoted code>`
Impact: <what a user could change or see, in one sentence>
Fix: <specific change, referencing the fixes.md pattern(s)>
## High
### [LW-NN] <title> - <file>:<line>
Evidence: `<quoted code>`
Impact: <what a user could change or see, in one sentence>
Fix: <specific change, referencing the fixes.md pattern(s)>
## Medium
...
## Low
...
## Info
...
## App-level checks and run notes
LW-NN: clean - <what you checked> | not applicable - <reason>
Livewire release: <x.y.z> from composer.lock | <x.y.z> inferred from <constraint>, no lock file - <protections it predates, or "has every release-dependent protection">
Dynamic verification: skipped - <reason> | performed against <page>
Full-page routes: <n> point at audited components
## Clean components
<every component with zero findings, listed by name/path>
## Discarded during verification
<count> subagent findings did not survive main-thread verification.
Repeat the finding block per severity tier (Critical, High, Medium, Low, Info). Order findings within a tier by severity of impact.
## App-level checks and run notes is where a result that is not a finding goes. Write one LW-NN: line for each main-thread check from Step D (LW-12, LW-14, LW-20, LW-21, LW-22) that has such a result: clean with what you checked (a default left in place, a route that is public by design), or not applicable with the reason (a missing routes/ or app/Providers/ directory). A check can have blocks above and a line here. A result that asks nothing of the owner is a line here, never an Info block. Then write the three fixed lines. The Livewire release: line names the release you audited against and where it came from, then each protection in references/snapshot-internals.md section 5's first-release table that the release is too old to have, with the release that adds it (for example 4.1.4 from composer.lock - predates 4.2.0 (forced web and header guard on custom update routes, default update route retired, boot/booted/rendering/rendered and trait hooks blocked as actions, wrong-type values answered with 419), 4.3.0 (#[Authorize]), 4.4.1 (__lazyLoad and __dispatch hardening)). Nothing else goes in this section, and none of its lines is a finding.
Consolidation and counting rules — follow exactly:
<file>:<line>, however alike the fix; listing other files in one block's Evidence line hides them and miscounts the report. Within one component, several instances of the same check may share a block.Findings: <n> is the number of ### finding headers; lines in the app-level section are not counted. Components audited counts components only; the full-page routes go on the Full-page routes: line.Write every <file> as its path from the project root; never shorten it or define a path convention of your own. Filenames containing the ⚡ prefix: write the literal character in the report. If your environment blocks emoji output, substitute the placeholder [U+26A1] and state that convention once at the top of the report.
"Nothing found" is a valid result. If zero findings survive verification, say so plainly and list the audited inventory as evidence of coverage; the app-level section is still written. Never pad the report or invent findings to justify the run.
After writing the report, end your reply by stating its exact path (livewire-audit-YYYY-MM-DD.md in the project root) so the user knows where to find it.
--fix only)For each confirmed finding from Critical down to Low, in severity order (Info findings need no action and get no fix):
references/fixes.md, smallest change first (the ordering note at the top of fixes.md explains the precedence).pass. If it does not, the result is fail: leave the edit in place, say what still fails, and do not try to undo it.config/livewire.php, a service provider, the routes file. Name every file you changed in the summary. If the pattern needs a file that does not exist, or a change to a component that is not in the project (the component that receives a dispatched event, say), do not apply half of it: the finding is needs-decision. Never create a file.If a fix requires a product decision (which authorization policy applies, what the valid value set for a property is, whether an action should be reachable at all), do NOT guess. Edit nothing for that finding, record it as needs-decision with the question, and go on to the next finding. Ask the user the collected questions at the end.
Always finish with this summary table, one row per finding, so every pass, fail and needs-decision is on record. A prose summary may follow it; it never replaces it:
| Finding | Fix applied | Re-check result |
| LW-NN | ... | pass/fail/needs-decision |
livewire-audit-YYYY-MM-DD.md in the project root), so the user knows where to find it.What SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
livewire-audit@timgavin is listed by timgavin/claude-plugins — review the source before installing
npx claudepluginhub timgavin/claude-plugins --plugin livewire-audit