# Inertia props are public, even the ones you hide

> Everything a Laravel controller passes to Inertia ends up in the page source. How whole models and shared props leak data you never show.

Published 2026-12-01, by Lockhound. Source: https://lockhound.app/blog/inertia-props-are-public

Inertia makes it easy to pass data from a Laravel controller to a React or Vue page. That's the danger: everything you pass is sent to the browser, whether the page shows it or not.

On the first page load, Inertia writes your props into the HTML as JSON. On later visits it fetches them as a JSON response instead. Partial reloads, deferred props and once props change which props travel on a given request, but anything that is sent can be read by the person using the browser.

Inertia v3 puts the first page's props in a `<script data-page>` tag. Inertia v2 uses a `data-page` attribute on the root element by default, with the script tag as an option. Either way they are in View Source, and later visits show up in the browser's network tab.

## Passing whole models

This is the most common leak:

```php
return Inertia::render('Profile', ['user' => $request->user()]);
```

The page might only show the name, but the browser gets every attribute that isn't in the model's `$hidden` list. Depending on your schema that can include:

- two-factor secrets and recovery codes
- API tokens or third-party OAuth tokens stored on the user
- Stripe customer IDs, internal notes, IP addresses
- the same for every related model you eager-loaded

Laravel's starter `User` model hides `password` and `remember_token`. That comes from the model's own hidden list, not from the framework, so it doesn't cover columns you add later, or any other model.

## Shared props

`HandleInertiaRequests::share()` adds data to every page, including public ones. A shared prop like this sends your whole services config to every visitor:

```php
'config' => config('services'),
```

## Fix it

Pass only what the page needs, picked explicitly:

```php
return Inertia::render('Profile', [
    'user' => $request->user()->only('id', 'name', 'email'),
]);
```

For anything used in more than one place, an API Resource makes the shape explicit and easy to review.

Then add sensitive columns to `$hidden` on the model as a second line of defence, so a careless `toArray()` somewhere else doesn't send them.

## Check your app

Open a few pages while signed in. View the source, find `data-page`, and search that JSON for `token`, `secret`, `key` and `password`. Then click around with the network tab open and search the JSON responses the same way, because later visits never appear in View Source. Do it as each kind of user you have, and signed out on your public pages. It takes a few minutes and it's usually surprising.
