livewire-audit
/livewire-audit
Use when auditing or hardening the security of a Laravel Livewire (v3 or v4) app - snapshot data exposure, client-tamperable properties, missing #[Locked], unauthorized public actions, and the full client-callable surface. Triggers on /livewire-audit, "audit livewire", "harden livewire", "check livewire security", or questions about whether Livewire components leak data or are tamper-proof. Append --fix to apply fixes rather than only report them.
- Author
- timgavin ↗
- Repository
- livewire-audit ↗
- Licence
- MIT
- Last repository change
- 09.10.2026
Assessment and security
- Files in this package
- 4
- Scripts
- 0
- HTML comments
- 0
- URLs in SKILL.md
- 0
No signals detected. Repository changed on 09.10.2026, without references to retired models or APIs.
MIT, open: use and modify while retaining author attribution.
What it does and when to use it
Use when auditing or hardening the security of a Laravel Livewire (v3 or v4) app - snapshot data exposure, client-tamperable properties, missing #[Locked], unauthorized public actions, and the full client-callable surface. Triggers on /livewire-audit, "audit livewire", "harden livewire", "check livewire security", or questions about whether Livewire components leak data or are tamper-proof. Append --fix to apply fixes rather than only report them.
Triggers from the description
Original author description
Use when auditing or hardening the security of a Laravel Livewire (v3 or v4) app - snapshot data exposure, client-tamperable properties, missing #[Locked], unauthorized public actions, and the full client-callable surface. Triggers on /livewire-audit, "audit livewire", "harden livewire", "check livewire security", or questions about whether Livewire components leak data or are tamper-proof. Append --fix to apply fixes rather than only report them.
How it works
- Authorization context and report language
- Modes
- Step A: Detect version and paths
- Step B: Build the component inventory
- Step C: Fan out audit subagents
- Step D: Verification gate (MANDATORY)
- Step E: Optional dynamic verification
- Step F: Report
- Fix mode (--fix only)
- Reminders
SKILL.md preview
---
name: livewire-audit
description: 'Use when auditing or hardening the security of a Laravel Livewire (v3 or v4) app - snapshot data exposure, client-tamperable properties, missing #[Locked], unauthorized public actions, and the full client-callable surface. Triggers on /livewire-audit, "audit livewire", "harden livewire", "check livewire security", or questions about whether Livewire components leak data or are tamper-proof. Append --fix to apply fixes rather than only report them.'
---
# Livewire Security Audit
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.
## Authorization context and report language
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.
## Modes
- **No args (default): read-only audit.** Make no changes to application code. The only file you write is the report at `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.
## Step A: Detect version and paths
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.
## Step B: Build the component inventory
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.
## Step C: Fan out audit subagents
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:
- the checklist. Preferred: give the subagent the ABSOLUTE PATH to `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;
- the detected Livewire release (exact, or the inferred lowest, saying which), and whether Volt is installed;
- the batch's file paths (class + view + any `.js`);
- the reply shape, as a pointer and not a copy: tell the subagent to reply in the shape the checklist's "How to report" section defines. Do not restate or shorten that section's field list in the prompt — the checklist is its one definition.
Tell each subagent:
- Read every file in the batch completely. Do not skim.
- Report only findings backed by a quotable line of evidence from the source.
- If uncertain whether something is a real finding, mark it `needs main-thread confirmation` — do NOT drop it and do NOT inflate it to a confident finding.
## Step D: Verification gate (MANDATORY)
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:
- **Re-read** the flagged file at the flagged location in the main conversation.
- Confirm the quoted evidence actually exists at that location and the vulnerability logic holds.
- For a candidate marked `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.
- Discard false positives. Keep a running count of how many you discarded.
Then run the **app-level checks** in the main thread (these span the whole app, not one component, so subagents cannot own them):
- **LW-12** — morph map / model alias registration in service providers (search `app/Providers/` for `enforceMorphMap`, `morphMap`, `Relation::morphMap`). The subagents' notes on which components hold Eloquent models tell you which class names are exposed.
- **LW-14** — global upload rules in `config/livewire.php` (`temporary_file_upload` rules / max size / mimes).
- **LW-20** — `Livewire::addPersistentMiddleware(...)` registration in providers.
- **LW-21** — `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(`).
- **LW-22** — middleware applied to full-page component routes (cross-reference the routes enumerated in Step B).
Confirm each against actual code before it becomes a finding.
## Step E: Optional dynamic verification
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:
- Fetch a page that renders an affected component.
- Extract its `wire:snapshot` attribute from the HTML.
- Confirm exposure findings against the real serialized payload.
- Label each exposure finding `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.
## Step F: Report
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:
- Merge checks into one block ONLY when they fire on the same code AND share the same fix, meaning one edit to that code resolves both (an unlocked untyped id = LW-02 + LW-23: one edit to the declaration, one block). Checks with DIFFERENT fixes always get separate blocks, even on the same component or the same template (LW-16 bind-not-interpolate and LW-17 escape-output are two blocks; LW-10 cache: and LW-11 persist: on the same component are two blocks).
- A block never spans components. The same check in five components is five blocks, each with its own `<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.
- A merged block's severity tier is the HIGHEST severity among its merged checks — never place a block below its worst check's tier. If you write "treat its true severity as Critical," the block belongs in Critical.
- Name every applicable check ID inside its block so each is traceable; nothing gets silently absorbed into another finding's prose. Before writing the report, walk LW-01..LW-27 once more and confirm each ID is either in a block, on a line in the app-level section, or genuinely clean.
- The headline `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 mode (`--fix` only)
For each confirmed finding from Critical down to Low, in severity order (Info findings need no action and get no fix):
- Apply the matching pattern from `references/fixes.md`, smallest change first (the ordering note at the top of `fixes.md` explains the precedence).
- Re-run the relevant check against the changed file. If it passes, the result is `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.
- Leave the change uncommitted.
- Never weaken or remove validation.
- A fix may edit an existing file the pattern needs besides the flagged one: the component's own template, `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 |
```
## Reminders
- Read-only mode writes exactly one file (the report). Fix mode additionally edits flagged source files and the existing files a fix pattern requires. Nothing else, and never a new file. A run that stops in Step A or B (not a Livewire app, no components) writes no file.
- When you wrote a report, always 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.
- Never run git commands at any point. Leave all work uncommitted.
- Never modify a database. Never run migrations or seeders.
Files in this package (4)
- SKILL.md 22 KB
- references/checklist.md 57 KB
- references/fixes.md 20 KB
- references/snapshot-internals.md 22 KB
Versions
The database has no other skills named livewire-audit.
Database snapshot: 13.11.2026 · package version 071c94cf4fb2 (SHA-256 digest of the entire package)
Downloads in the last 30 days: 0 · ranking
Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.
Similar skills
- 100laravel-livewire
Livewire 4 reactive components on Laravel 13 - wire:model, actions, events, Volt, Folio. Use when building reactive UI without JavaScript. - 100laravel-review
Review existing PHP, Laravel, Livewire, and Blade code for clean architecture, Eloquent performance, N+1 queries, OWASP security vulnerabilities, and maintainability, and produce a prioritized report where every finding cites the rule it breaks and provides a concrete drop-in… - 100livewire-development
Use for any task or question involving Livewire. Activate if user mentions Livewire, wire: directives, or Livewire-specific concepts like wire:model, wire:click, invoke this skill. Covers building new components, debugging reactivity issues, real-time form validation, loading… - 100livewire-development
Use for any task or question involving Livewire. Activate if user mentions Livewire, wire: directives, or Livewire-specific concepts like wire:model, wire:click, wire:sort, or islands, invoke this skill. Covers building new components, debugging reactivity issues, real-time form… - 90livewire
Use when the project's frontend stack is Livewire — dispatched by `directives/ui/{apply,review,polish}.ts`. Covers reactive state, events, lifecycle hooks, and component/view separation. - 82livewire-flux
Livewire 4 + Flux UI component scaffolder and pattern guide for Laravel projects. Generates Livewire components using Flux UI primitives — forms, data tables, modals, notifications, file uploads with Spatie Media Library, and role-gated UI with Spatie Permission. Supports both…