# Write policies for inserts and updates
*Exposure*
Check that inserts and updates verify the owner or the logged-in user, not just that a user is signed in.

## Why it matters
A policy that only checks 'is logged in' lets any user write rows that belong to someone else.
Most data leaks through a missing check on write, not read. Naming the owner in the policy closes it.

## How to fix it
1. List every insert and update policy
2. Check that the row's owner matches the logged-in user
3. Do not allow clients to set the owner column freely

## Prompt for an AI assistant
Copy the text below and paste it into an AI assistant.
```text
You are the person improving this website. Check the item below and fix it if it applies to the site.

Item: Write policies for inserts and updates
Summary: Check that inserts and updates verify the owner or the logged-in user, not just that a user is signed in.
Steps:
1. List every insert and update policy
2. Check that the row's owner matches the logged-in user
3. Do not allow clients to set the owner column freely
References:
- Row Level Security (Supabase) (https://supabase.com/docs/guides/database/postgres/row-level-security)

Constraints:
- Keep the existing design and tone of voice.
- Show the file or section you changed and the suggested final wording.
- Do not decide ambiguous points alone; give options and a recommendation.
- Do not change anything outside the listed item.
```

## Related checks
- **[Row Level Security (RLS)](https://ismyappok.com/en/checks/database-rls)** — Turn on Row Level Security for every table and write policies that match who may read or write each row.
- **[Endpoints without authentication](https://ismyappok.com/en/checks/unauthenticated-endpoint)** — Make sure every server function checks who is calling before it reads or writes data.

## References
- **[Row Level Security (Supabase)](https://supabase.com/docs/guides/database/postgres/row-level-security)** — Supabase documentation（Official）

## Check your site now
Enter a URL and find what is missing before launch, for free.
[Run audit](https://ismyappok.com/en/audit/check)