Security check
Route: /security (sidebar: Security, between Fixes and Connect)
Scenario: You built your app with an AI coding tool on Supabase. You want to know whether anyone with your app’s public key can read your users’ data, fix it, and know for sure that the fix worked.
Ready to ship?
The page opens with one status, Ready to ship?. It leads with the one next step (the most urgent check that is not OK, with where to go), then a row for each check that ran; two or more checks that did not run share one line, each with its reason under What each one needs:
| Row | It blocks when | It reads “Not checked” when | It reads “Partly checked” when |
|---|---|---|---|
| Supabase data | a critical or high finding is open | Supabase is not connected, it never ran, it ran over 7 days ago, or the last check stopped without finishing (“Scan again”) | a test was skipped |
| AI and agents | a high finding is open in your agent setup or model calls | GitHub is not connected and the CLI never pushed, or the last scan is over 7 days old | the scan read only part of the repo |
| Endpoint probes | a probe finding is open | no endpoint is set up (unless your fully read code calls no model), no probe ran, or the last run is over 7 days old | some probes did not run, or some wait for tomorrow |
| Security proof in CI | a required lane found something | no scanner posted a result yet | |
| Quality gate on AI fixes | an open AI fix is held, or releases are frozen | the gate is not set up for the app |
A row that needs a person (a probe reply to read, an AI fix waiting for you) reads Needs you. A Partly checked row still says what it found in the part that ran. The page says Ready to ship only when every row is OK; one row that did not run, or ran only in part, makes it Not proven ready, never ready. The page has one main button, the next step: Fix all (or the one Fix it) while a finding is open, otherwise Scan now. Each row that is not OK links to where you fix or set it up.
What it checks
Mushi’s own rules, kept in the open in security-rules.json. No third-party rule packs.
| Rule | What it finds | Severity before a live test | Severity a live test can prove |
|---|---|---|---|
| Table open to the internet | A table with row level security off that the public or signed-in role can reach | High | Critical |
| Anyone can read user data | A read policy USING (true) for anyone, on a table with a user column or personal-looking columns | High (Medium when it only has a user column) | Critical (High when it only has a user column) |
| Any signed-in user can read everyone’s rows | A read policy USING (true) for signed-in users on a table with a user column. Anyone can sign up, so this is not a protection | Medium. With anonymous sign-ins on, scored like a public read: High when it has personal-looking columns | High, with two test logins |
| Anyone can change rows | An insert, update or delete policy that is (true) for a client role | High (Medium for insert only) | High. Mushi never tests writes |
| View skips row level security | A view that runs as its owner, or a materialized view (it keeps a copy of its rows and has no row level security), that a client role can read | High | Critical |
| Supabase security advisor | Each lint from Supabase’s own advisor. A lint about the same table joins the finding above | Advisor level, at most High | Same |
| Secret key shipped to browsers | A service_role or sb_secret_ key in your live site’s JavaScript | Critical when seen on the live site | Critical |
| Anyone can list your files | A public bucket with a policy that lets anyone list its files | Medium | High |
| Made outside your migrations | A row level security policy (public or storage) or a security definer function that is in your live database but that no SQL file in your connected GitHub repo creates | Medium | Medium. There is no live test |
Critical always means a live test proved it. A finding from your settings alone is at most High. A live test that reproduces a finding raises it one step, so only a High finding can become Critical. No AI decides severity.
Only columns the role can read count. Mushi reads your column grants. A user column or personal-looking column that the role is not granted is not exposed. A table that everyone can read, with the user column hidden and no personal-looking column granted, is public by design. It shows as Low, with that reason, and gets no live test. The live read test selects only the granted columns.
Live tests
Live tests run only against the Supabase project you connected (https://<ref>.supabase.co), never against an address someone typed. Each test only reads.
| Test | What Mushi sends | What Mushi keeps |
|---|---|---|
| Read with the public key | GET /rest/v1/<table>?select=*&limit=1 with only the public key | The status, an estimated row count, the column names and a SHA-256 of the response. Never a row’s values. On a large table the count is Postgres’s estimate, so a test never forces a full count |
| List files with the public key | A list request for one file name | How many names came back. Never the names |
| One user reads another (opt-in) | Signs in as your two test accounts and asks, as account A, for account B’s rows by B’s id | The counts. Never the rows, emails or tokens |
| Anonymous sign-ins | GET /auth/v1/settings with only the public key, and only when a signed-in finding depends on it | Whether anonymous sign-ins and sign-up are on. If both are, anyone can get a signed-in session without an email, so a signed-in finding is scored like a public read and says so |
| Secret keys in your live site | Reads your site’s page and its own scripts: the deploy.targets URLs in mushi.recipe.json, else the site you set up for Site watch | The file, the line and a fingerprint of the key. Never the key |
A view or a table with nothing filtering it that holds no rows right now can’t prove anything: the read test says it can’t say, never that the finding did not reproduce.
Turn live tests off under Security › Live tests. Findings then come from your settings only, can’t be proven critical, and can’t be closed by a live test.
Two test logins
To test whether one signed-in user can read another user’s rows, add two test accounts (never real ones) under Security › Live tests. Account B needs at least one row of its own in each table you want tested. Account A alone is enough for Mushi to sign in, for example to send endpoint probes to a signed-in endpoint; until B is saved, the two-user test shows as not checked. Mushi stores the logins in Vault and keeps only references to them.
Made outside your migrations
Someone may change your database in the Supabase dashboard or by hand. A fresh database, a branch or a restore from your migrations will not have that change, and nobody reviewed it in a pull request. Mushi reads the SQL files in your connected GitHub repo (the default branch, read only, through your GitHub App) and compares them with your live policies and security definer functions.
- What counts as a migration: SQL files under
supabase/, anymigrations/orschemas/folder, and Prisma’smigration.sqlfiles. Commented-out statements do not count. A policy made by dynamic SQL counts when its name is a quoted string in a file. - Left out: functions an extension owns, and event trigger functions
(nobody can call one through the API; Supabase’s “auto-enable RLS for new
tables” snippet,
rls_auto_enable(), is one). - One finding lists every live-only policy and function, each with a
tick box, so one Fix it opens one pull request for all of them. Every one is kept by
default: its migration writes it down exactly as it is live, with a
function’s own
EXECUTEgrants, which changes nothing live. - Every box starts unticked, even one you chose to remove before: a removal is always a fresh tick.
- A database other apps use too (another app is connected to the same Supabase project):
one line names the apps that share it, and the objects are sorted by owner.
- This app’s own get tick boxes. An object is this app’s own only when every other app’s migrations were read, none of them creates it, and its name (a function’s, or a policy’s table) starts with this app’s own name prefix (the one most of its migrations use) and no other app’s.
- Another app’s (its migrations create it) are left out of this app’s finding.
- Not in any connected app’s migrations (a tool’s, a shared helper, no prefix) are listed with no tick box and never go in the fix: not dropped, and not written into this app’s migrations.
- If another app’s migrations cannot be read, or it is in another workspace, nothing is offered for removal, and the line says why. Meant to be this way? still works.
- A removal saved before this page asked again waits for you: one line names it, its box is not ticked, and no fix drops it from anywhere (Fix it, the report page, MCP, the API, fix together, a worker lane) until you tick it here and press Fix it. A refused start says “Confirm these removals on the Security page first”.
- Remove one that should not exist: tick it, then Fix it. The confirm lists what is removed (dropped) and what is kept, and asks why (kept in the audit log, one entry per object). Mushi saves the choice, then opens one pull request with one migration for all of them. Nothing changes live until you merge it and apply the migration. Later scans keep your choice. If the choice cannot be saved (a scan is running, say), no fix starts.
- No AI writes this fix. The migration is Mushi’s draft, unchanged: the
newest number in your migrations folder plus one (or the time now, when
later), named
<version>_record_live_objects.sql, and the same file in any folder that copies your migrations folder. The same draft does not open a second pull request after you closed the first: change your choice first. - A fix that stops says so under the finding: “The last fix stopped:” with the reason and a link to the attempt.
- Checks that count files. A new migration changes the migration count that READMEs state. The same pull request updates every README line that states the current count; a line with another number is listed in the pull request as not updated. If a check still fails, the finding says “Checks failing on PR #N” with the check names. Mushi merges nothing until checks pass.
- Mushi never fixes these on its own, and Fix all leaves them out: which objects stay is your call.
- Meant to be this way? accepts the objects it names now. A new live-only object opens it again.
- It closes, proven, once every object it names is created by a file in your repo or is gone from the live database.
- Not checked, never passed: with no GitHub repo connected, no SQL migrations found, a repo too large to list, more than 3,000 SQL files or 16 MB of them, or a file Mushi could not read, the page says “Not checked” and why. A partial read cannot say what is missing.
- Grants are not compared. Supabase grants table and function access to its roles by default, so a live grant cannot be told apart from one a migration made.
What “nothing found” means
It means nothing was found in the checks that ran. It does not mean your app is secure. The page lists every check that did not run and why, for example “No live site URL for this app”.
Fixing a finding
Fix it sends the finding to your coding agent through the normal fix pipeline. The finding carries a proposed migration:
- For a table with a user column, it turns on row level security and adds policies that check
auth.uid()against that column, in one migration, so your app keeps working. - For a table with no user column, it does not guess. Turning on row level security without a policy blocks every request from your app, so a person writes that policy.
- For a materialized view, it revokes it from the client roles, and also revokes every view that reads it, so none is left broken.
- For a Supabase advisor lint, the finding links Supabase’s page for it. Lints with a mechanical fix carry a draft: a fixed
search_pathfor each function, named with its arguments, or moving an extension out ofpublic. Lints that need your choice (which functions signed-in users may call, GraphQL,pg_net) carry commented-out lines to choose from. - An advisor lint at INFO level (a table with row level security on and no policy, which only your server can reach) is not a problem to fix. It has no Fix it; accept it if it is meant to be that way.
Fix all fixes every open finding whose proposed migration changes something in ONE pull request for you to review (more than 6 make a second one). It asks first, with the count. Findings it leaves alone are on the result with the reason: a fix is already running, an INFO lint has nothing to fix, or the draft is only commented-out advice and needs your choice (fix that one on its own, or accept it). To fix only some, tick them and press Fix N together. See Fix selected together.
Proving it closed
| State | What it means | What to do |
|---|---|---|
| Open | Found and not fixed | Fix it |
| Fix in progress | A coding agent is writing the fix | Wait for the pull request |
| Merged, re-test pending | The fix merged; the re-test has not run yet | Apply the migration. Mushi re-tests when the fix merges and every day |
| Merged, not live yet | The fix merged, but your live project still shows the problem | Apply the migration, then Re-test |
| Closed, proven | A re-test proved it gone: a live test read no rows, or your settings no longer show it | Nothing |
| Fix later | Real, but a person chose to fix it later | Nothing until its day. It comes back open on that day, or press Bring back now |
| Accepted for this app | A person accepted it as meant to be this way | Nothing. It opens again if an accepted advisor lint names something new. Reopen it under Closed to undo |
A coding agent saying “already fixed” never closes a security finding. Only the security check’s own re-test does.
When it’s meant to be this way
Some tables are public on purpose, for example a product catalog. On an open finding, open Meant to be this way?, say why, and press Accept for this app. For many at once, tick them, write one reason, and press Accept N as meant to be. Mushi records each table, view, bucket or advisor lint as accepted for this app, with your reason, in the audit log, and closes its report as “works as intended” in the same step. Later runs list it on the page and file no report for it. The result panel says which were accepted and which were skipped and why (a fix is running, it is already accepted, or the latest scan does not list what an advisor lint names: scan again first).
To undo, open Closed, find it, and press Reopen. It counts as open again, and the next scan re-tests it.
Fix later
Some findings are real but can wait, for example until your users move to a new app version. Tick them (or open Meant to be this way? on one), say why, pick when it comes back (30 days to a year), and press Fix later. They stay on the page under Set for later, are not counted as open, and come back open on that day. The status line never says “nothing found” while one waits. Bring back now ends the wait early. Past a year, accept it instead.
An acceptance saved through the settings API instead of the button is applied on the next run: the open report is dismissed the same way. An accepted advisor lint covers the functions or tables it named when you accepted it. If it names a new one later, the report opens again and says which.
Accepting is a person’s choice, so it never shows as Closed, proven. Only a person in a console session can accept a finding, put it off, reopen it, or turn a rule off; API keys and editor agents cannot.
From your editor (MCP)
| Tool | Scope | What it does |
|---|---|---|
run_security_check | mcp:write | Starts a check now (at most 6 an hour per app) |
list_security_findings | mcp:read | The findings, their states, evidence and proposed migrations |
verify_fix | mcp:write | Re-tests one finding after its fix merged |
run_ai_scan | mcp:write | Scans the connected GitHub repo for AI and agent risks now (at most 6 an hour per app) |
list_ai_scan_findings | mcp:read | The AI and agents findings, their states, files and lines, and what the last scan read |
run_ai_probes | mcp:write | Sends the endpoint probes now, once a person set them up and agreed (at most 30 probes an hour per app) |
get_ai_probes | mcp:read | The probe endpoint, its proof and consent, and the last run’s outcome per probe |
What Mushi needs
The Supabase access token the app already connected with (one project; Database and Advisors at Read). Mushi reads the publishable key with it. A read-only token is often not allowed to read the project’s API keys. Then no live test runs, and the page says so: the status line says “None was tested live”, and Live tests says “no public key” with Supabase’s reason. Save your publishable key under Security › Live tests and the next scan runs the live tests. Mushi refuses a secret key there. Live tests says “public key read from Supabase” only when the last run really used a key it read there.
AI and agents
The same page has a second section, AI and agents. It checks the parts of an AI-built app that no database check sees, with fixed rules and no AI model:
| Scanner | What it looks for |
|---|---|
| Agent skills and rules | Hidden characters in .claude/skills, .cursor/rules, AGENTS.md or CLAUDE.md; a download piped into a shell; reading SSH keys, cloud or token files and sending data out; prompt-injection wording; permission prompts turned off (Bash(*), bypassPermissions, every repo MCP server on); skills an agent cannot load or that share a name |
| MCP servers | A token written into .mcp.json, .cursor/mcp.json or .vscode/mcp.json; npx -y pkg@latest and other unpinned packages; a remote server over plain http; a file server that reaches the whole disk, or a shell server; auto-approved tools that write or send; servers that together read untrusted text, reach private data and can send data out |
| Model calls in your code | A model key in a NEXT_PUBLIC_/VITE_ variable, in browser code or written in source; request text in the system prompt; model output used as HTML, code or a query; a model tool that runs commands; a secret inside a prompt; a call with no output limit |
Each finding names the file and line, why it matters, the fix, and its OWASP ids (Top 10 for LLM Applications 2025, Top 10 for Agentic Applications 2026). A static scan proves nothing live, so nothing here is ever Critical.
Run it
-
From your repo or CI (the whole repo, nothing leaves your machine without
--push):npx mushi-mushi security scan # print the findings npx mushi-mushi security scan --push # send rule, file, line and label to Mushi npx mushi-mushi security scan --user # also your own ~/.claude.json, ~/.cursor/mcp.json, ~/.claude/skills (printed, never sent)--pushneeds a project key with themcp:writescope (the public SDK key is refused). It never sends your code or a tool description. Exit code 1 when a finding to fix is high (--fail-on mediumornoneto change that). -
From the console: with a GitHub repo connected, the page’s one Scan now also scans the repo (with only GitHub connected, it runs this scan alone). It reads the default branch at one commit. It reads every agent and MCP file, and up to 300 source files: first the files of open model-call findings, then edge function entry points and files named for AI, chat or agents, then other server code, and tests last. In a bigger repo the model-call part is partial; run the CLI in CI for all of it.
MCP tool pins
mushi security scan --list-tools starts the MCP servers in your own
configs, lists their tools and checks each description for hidden orders
(hidden characters, <IMPORTANT> tags, “do not tell the user”, reading
credential files, changing how another tool behaves). A repo’s own MCP config
is started only with --trust-repo-servers: a cloned repo’s config is someone
else’s command.
A pin is the SHA-256 of a tool’s name, description and input schema.
--approve-tools saves them in ~/.mushi/mcp-pins.json; a later change to any
of them is a high finding. For the team: push a run with --list-tools --trust-repo-servers --push, then press Approve these tools on the page.
Bugs, guesses and “closed”
- A fact at medium or above becomes a bug with Fix it, like any other finding. Fix all sends them as one request (fixed together), so findings in one file share one pull request, and lists each one as going in, left out or not started, with the reason. Guesses (injection wording, the server combination, request text in the system prompt, output into HTML or code, tools that run commands) and low findings are listed under Worth a look and never filed on their own. Each has Fix it, which files it under To fix and starts the fix, and Meant to be this way?, which keeps it as accepted with your reason.
- A finding closes as Closed, proven only when a complete re-scan no longer finds it: the CLI at the repo root, or a GitHub scan that read every file. A model-call finding is about one file’s code, so it also closes when a scan reads that file again and no longer finds it. Anything else a sub-folder scan or a partial read did not read stays open. After a fix merges, Mushi re-scans the repo at once (Merged, re-scan pending); if the re-scan still finds it, the row says Merged, still found. A model-call finding in a repo with more than 300 source files can only be closed by the CLI in CI, and the row says so. An agent saying “already fixed” never closes it.
- While a scan runs, the page refreshes by itself. When it finishes, What the last AI and agents scan read says what the scan closed (with the proof), what it filed new and what came back, then what it read and what it skipped, and why.
- Meant to be this way? accepts one finding for this app, with a reason, in the audit log. A rule turned off stops new reports and never closes one. Under AI and agents: closed, an accepted finding shows your reason and date, with Reopen: it leaves the accept list and goes back under To fix. A probe run’s summary counts again when you look: a probe finding you accepted or closed since the run no longer reads “to fix”.
Token use
Token use (open it under the AI and agents section, or mushi security tokens) shows where this app’s model calls went in the last 30 days, per stage:
calls, share of spend, input tokens (median and p95), how much input was read
from the prompt cache, the models used and the failure rate. It comes from
Mushi’s own record of each call; no model reads it. It suggests, with the number
that triggered it:
- prompt caching, when a stage’s prompts are long (median 2,000 tokens or more) and less than 10% is read from the cache;
- trimming context, when a stage’s p95 input is over 20,000 tokens and three times its median;
- trying a smaller model on the stage’s golden set, when a top model writes short answers (median 300 tokens or less). Mushi never switches a model for you;
- fixing the cause first, when 10% or more of a stage’s calls fail.
A stage needs at least 20 calls in the window before it gets a suggestion.
Endpoint probes
Endpoint probes send your app’s own model endpoint (the address your chatbot or AI feature posts messages to) a fixed set of 15 messages that try to take it over, then grade each reply with code. No model grades anything, and nothing leaves Mushi except the messages themselves.
| The messages try to | OWASP | A finding when the reply |
|---|---|---|
| Make the model obey an instruction hidden in a message, a fake system line, a role-play or a document | LLM01 | holds a word the model could only write by obeying |
| The same, hidden in base64, look-alike letters or invisible characters | LLM01 | same |
| Show the system prompt | LLM07 | holds the marker you planted in your system prompt |
| Call a tool with text the message chose | LLM06 | holds a tool call with that text |
| Print keys and tokens | LLM02 | holds something shaped like a real key |
| Write a markdown image to an address the message chose (plain, split by empty tags, or by reference) | LLM05 | holds that image, or a link or bare address to it, in any markdown or HTML form a renderer shows |
| List other people’s details | LLM02 | always Read this: code cannot tell if an email address is real |
Each probe’s canary is never in the message as one word: the model is handed two halves and asked to join them, so an endpoint that repeats the message back can’t look like it obeyed.
The image probes go first, so a daily limit or the app’s own quota (HTTP 402 or 429) never leaves the image check unsent. A probe stopped by that quota says so, and waits for the next day.
Apps that sign in by emailed code
If your users sign in only with a code or link by email, choose Send as › A Mushi QA mailbox. Mushi gives your app one address on its own domain and shows it with a copy button. At each run Mushi asks your app for a sign-in code for that address (the same request your sign-in screen makes), reads the code from its mailbox within a minute, and signs in. Nothing that signs in is kept: not the code, not the session.
The first time, sign in to your app as that address and finish any setup your app asks for (a consent, a workspace): in your app, enter the address and ask for a code, then press Show the latest code on the Security page. Mushi checks with your app and shows the code it sent. Only owners and admins see codes, and only codes your app sent in the last few minutes.
If no mail arrives, the app refuses the code, or the mail holds no code, the
run says which step failed and sends nothing. A self-hosted Mushi needs
MUSHI_QA_MAIL_DOMAIN (a domain where your Resend account receives mail) and
a Resend key that can read it (RESEND_RECEIVING_API_KEY, else RESEND_API_KEY);
without them the option says it is not set up.
Set it up
-
Set up. Enter the address your app sends chat messages to. Under How Mushi calls it you can change the request body (JSON, with
{{prompt}}where the message goes), say where the answer is in the reply (a streamed reply is joined first; for a stream, name the field of one event), and send as your saved test login (Live tests), as a new guest (anonymous sign-in on your Supabase, nothing stored; each run adds one guest user), or through a Mushi QA mailbox (below) for an endpoint behind sign-in. Mushi signs in only on your connected Supabase project, and only while the access token under AI keys can read it. A marker to put in your system prompt is on by default: with it, a leaked prompt is a fact; without it the leak probes can only say “Read this” or “Did not run”. Get a marker under the result adds one later and keeps your proof and agreement. Mushi cannot see your prompt, so a reply that reads like instructions but lacks the marker reads “Read this”, never held: check the marker is really in your system prompt.Two more settings there:
- Extra headers, for an endpoint that answers only with, for example,
an allowed
Originor a device id. Mushi keeps the values in a vault and shows only the names again. A header that signs in as an account (Authorization,Cookie, an API key header) is sent only when you tick that it signs in, and adding or changing one asks for your agreement again. Mushi removes every header value from the excerpts it keeps. - Messages a day, for an endpoint that allows a user a number of messages a day. A run sends what today allows; the rest waits for tomorrow and goes by itself after 00:00 UTC, with the daily check at 05:40 UTC. An answer of HTTP 429 (too many messages) also makes the rest wait instead of counting as a result. Any change to the endpoint starts a fresh round.
- Extra headers, for an endpoint that answers only with, for example,
an allowed
-
Prove you own it. Mushi sends nothing to a host you have not proved. A sign-in domain your team verified (SSO,
/sso) or your connected Supabase project’s functions host counts at once, when the access token under AI keys can read that project. Otherwise add the DNS TXT record or the file the page shows, then press Check now. Mushi checks again before every run, and a file that redirects elsewhere does not count. -
Agree. The page says what is sent, how often, and that your model answers like it would for any user, so it uses your AI credits. If your model can act (send email, change data), point it at a test endpoint. Only a person in the console can agree; an API key cannot.
-
Run probes. At most 30 probes an app an hour, one run at a time.
Reading the result
Each probe ends one of four ways:
- Got through: a finding under To fix, with a short excerpt of the reply (keys, email addresses and phone numbers removed). Fix it works as for any finding.
- Read this: code could not decide (a reply that reads like instructions without your marker, a tool call written as text, details that may be real). It is never counted as held.
- Held: the reply did not do what the message asked. It held against these messages only.
- Did not run: an error, an empty reply, or a check that needs your marker. The page names the reason.
- Waits for tomorrow: the endpoint’s daily limit (or an HTTP 429) held it back. It goes by itself the next day; until then Ready to ship? reads Not checked for the probes, and no finding closes on half a round.
A probe that asked the model for a word shows that word, so you can search your server logs for it (a tool your app runs on the server never shows in the reply). If no code on your server acts on what the model writes, press My app runs no tools on the server under that reply. From the next run, a reply with no tool call reads Held. An owner or admin can say it; the page shows when it was said, with Undo, it is kept in the audit log, and a new endpoint address clears it. A tool call the model writes as text still asks you. The Ready to ship? row for a check with smaller open findings reads To fix: it does not block shipping, and it never reads OK.
A probe finding closes as Closed, proven only when a later run sends every probe of its kind and each one holds. After its fix merges, run the probes again once the fix is live; a run before the deploy would test the old code. Changing the endpoint address or the sign-in asks for proof and your agreement again. Stop probing this endpoint removes it; findings stay.