Incident response for data exposure in a Supabase app
A pre-written runbook for suspected data exposure in Supabase: containment order, honest scope assessment, notification considerations, fix and verify.
Discovering your Supabase app exposed data is not the moment to design a response process. This runbook walks the phases - contain, assess scope honestly, consider notification duties, fix root cause, verify - so the decisions are already framed when pressure arrives.
Nobody plans their first incident. It arrives as a bug report that reads wrong ("why do I see someone else's orders?"), a scan result you can't unsee, or a message from a researcher who found more than they should have. What happens next depends almost entirely on decisions made before — not tools, process: who does what, in which order, with what evidence.
This runbook covers data-exposure incidents specifically: situations where rows, files, or keys were reachable by parties who shouldn't have had them. It's written for small teams without dedicated security staff, ordered by what actually limits damage, and honest about which parts are engineering versus judgment versus law. Read it now, once, calmly — that's what makes it work later. The companion pieces live elsewhere on this site — containment patterns per defect class, verification probes; this page is the sequence that stitches them under pressure.
Before anything: the runbook mindset
Two principles govern everything below.
Containment precedes understanding. The instinct to fully understand before acting wastes the window where action matters. Rotate first, investigate second — a key rotated during investigation costs nothing if it turned out fine; an exposure left open while you build certainty compounds hourly.
Write timestamps as you go. Every phase below produces notes: when discovered, when contained, what evidence was gathered when. These aren't bureaucracy — they're how scope assessment works later, how you answer compliance questions credibly, and how post-incident review distinguishes process failure from bad luck.
Assign roles even if it's one person wearing two hats: an incident lead deciding sequence, and an operator executing. In teams, these must differ — the lead needs to think while hands are busy.
And one cultural note for teams: incidents are moments when hierarchy helps or hurts most. If the person who wrote the vulnerable code is the only one allowed to touch containment, you've made response slower and scarier for them simultaneously. The runbook exists partly to de-personalize the moment: we follow phases, not blame chains. Analysis of how the vulnerability arrived belongs in phase five, calmly, with documentation — never in phase one's chat thread.
Phase one: contain
Stop ongoing exposure before measuring it. Order operations by reversibility-cheapest first:
If a service-role key leaked (bundle, repo, logs): rotate immediately. Provision replacement credentials to legitimate server contexts, revoke the exposed key, redeploy. Supabase's key model supports this lifecycle directly (rotation mechanics); treat the old credential as hostile from rotation time onward, because you cannot know who copied it or when.
If tables were readable that shouldn't be: enable RLS on the affected tables now, even though features will break. Default-deny stops the bleeding; broken features are recoverable in hours and visibly tracked, whereas continued silent exposure has neither property. Write the correct policies immediately after — containment buys time, not closure.
If a function endpoint did privileged work for unauthenticated callers: disable the function or add the missing verification gate. Same logic — fail closed first.
If Storage objects were exposed: flip bucket visibility or object policies, then audit what was uploaded into newly-scopeable paths.
If the exposure came through a view or definer function: drop or replace the view (or add security_invoker = true), and revoke execute on the function until its access contract is re-verified. Indirect surfaces need their own containment step — fixing underlying tables doesn't close a bypass that skips them.
One containment anti-pattern deserves naming: adding application-layer filtering ("we'll just hide it in the UI") instead of database-level fixes. The API surface remains open; only its easiest doorway closed. Containment means changing what the database permits, verified from outside.
The whole phase compresses into a first-hours checklist:
| Finding | Containment action | Verify containment |
|---|---|---|
| Service key exposed | Rotate, redeploy, revoke old | Old key rejected; bundle clean |
| Table readable by anon | Enable RLS immediately | Probe returns empty |
| Cross-tenant reads possible | Correct/replace policies | Two-account battery on affected tables |
| Unauthenticated function access | Disable or gate function | URL returns 401/403 |
| Public bucket with private objects | Flip visibility / move objects | Object URL denied without credentials |
The right-hand column is what makes this a checklist rather than a to-do list: every containment action carries its own verification, so "done" means proven stopped, not "changes applied and hopefully effective." Print this table; tape it somewhere; the middle of an incident is the wrong time to reconstruct containment options from documentation.
Phase two: assess scope honestly
With exposure stopped, establish what was actually reachable and for how long. This phase determines everything downstream — notification duties, user communication, severity classification — so honesty here is not optional virtue but practical necessity. Underestimating scope to feel better produces worse incidents twice.
Three questions bound the assessment:
- What was exposed? Catalog state plus probe evidence names the surfaces: which tables returned cross-tenant rows, which buckets served publicly, which endpoints performed privileged work. Your findings from any prior manual audit provide the "before" picture.
- For how long? Migration history, deployment logs, and dashboard edit trails date the change that opened the window. Where records don't reach — the honest limit of this exercise — say so rather than guessing optimistically.
- Was it accessed, or merely accessible? This is the hardest question, answered through whatever logging exists: API logs showing anomalous bulk reads, request patterns against affected tables, access from unexpected sources. Absence of logging is itself a scope finding — you cannot prove absence of access you didn't record, and your write-up should say exactly that.
Evidence sources to check, in rough order of value:
- API request logs — volume and pattern anomalies against affected tables: large result sets, systematic ID enumeration, user agents that don't match your app.
- Auth logs — token issuance spikes, sessions from unexpected geographies or times.
- Deployment and migration history — dating the opening of the window precisely.
- Storage access logs — object downloads during the exposure window for affected buckets.
- External signals — researcher reports, paste-site mentions, customer reports of wrong data.
Each source answers a different slice of "who saw what, when," and each has blind spots. Which sources exist at all is decided long before any incident: API request logs retained long enough to reconstruct an access window, deployment and migration history kept in git, and alerts on authorization-relevant transitions (RLS flags, policy changes, new public surfaces) are the instrumentation that makes this phase's questions answerable rather than speculative. The discipline is assembling them without overclaiming: "logs show 4,200 requests from three IP addresses during the window" is evidence; "three attackers" is inference dressed as fact.
Resist two symmetrical errors: assuming access implies theft (bulk scans often come from researchers or crawlers), and assuming no evidence implies no access. Both overreach the evidence. Report what the data shows, mark inference as inference, and preserve raw logs before rotating anything that would invalidate them.
Phase three: notification considerations
Data-protection regimes — GDPR in Europe, state laws like CCPA in California, sector rules elsewhere — generally impose obligations when personal data is exposed, typically on short timelines measured in days. This article cannot give legal advice, and timelines vary by jurisdiction and circumstance; what it can do is make sure the decision is made consciously and early:
- Flag the question during containment, not after fixing. Notification deadlines can run faster than root-cause analysis, so counsel or your privacy officer needs awareness from hour one.
- Document the scope assessment rigorously — it is precisely what determines whether obligations trigger and what must be communicated.
- Prepare honest user communication regardless of legal thresholds. Even where formal notification isn't required, users harmed by an exposure deserve a clear account: what happened, what data was involved, what changed, what they might consider doing. Plain language beats reassurance; specifics beat hedging.
The engineering contribution to this phase is factual support: timeline, surfaces, evidence, remediation status. Deliver facts promptly; let qualified people make the notification calls.
When communication does go out, the structure that serves users best is five short parts: what happened, in one plain sentence; what data was and wasn't involved; what we did (contained, fixed, verified); what you can consider doing (password reuse elsewhere, watch for phishing); and how to reach us with questions. Written once, reviewed by whoever owns communications, published where users actually look. The temptation to minimize — vague timelines, "out of an abundance of caution" — reliably backfires; specifics are what turn a bad day into a survivable one.
Phase four: fix the root cause
Now — and only after containment — repair properly. The distinction matters: containment stops today's leak; root-cause fix prevents next month's recurrence through the same path.
For each finding, trace from symptom to cause. A table readable by anon traces to either a missing policy (write it), a migration that dropped protection (find why review missed it), or a workflow that ships unprotected surfaces (fix the pipeline). A leaked key traces to an entry point (committed file, env prefix mistake, build artifact) that will leak the next key identically unless closed.
The trace matters because symptoms repeat across causes. Three different incidents can all present as "table was readable by anon": one needs a missing alter table enable row level security line added; one needs a migration template fixed so tables stop shipping without it; one needs CI to fail builds when the flag is absent. Fixing only the first level means the second incident arrives through a different table. Ask "why did our process allow this to exist?" until the answer is something you can change — a checklist line, an assertion, an alert — rather than a person you can blame.
Apply the standard fixes with their full patterns — policy sets per command with both clauses, indexes under predicates, definer functions with pinned search paths, function verification gates — all documented across this site's guides. Then convert every fix into regression tests: the five adversarial probes between two accounts, plus catalog assertions in CI (every public table RLS-enabled, no tautologies, no unconstrained writes). Fixes without tests recur silently; fixes with tests become permanently guarded doors.
Phase five: verify and institutionalize
Before declaring the incident closed, prove containment and fixes hold:
- Re-run every probe from outside — anonymous sweeps, two-account battery, storage checks — expecting clean results everywhere the incident touched.
- Confirm credentials: old keys rejected, new keys deployed only to legitimate contexts.
- Verify monitoring exists for the defect class: the transition that caused this incident should now generate an alert, not await next quarter's audit.
The verification step deserves the same rigor as containment: not "we changed it" but "we confirmed from outside that the change holds." An exposure closed in the database but missed in a second environment — staging copies, preview deployments, a forgotten backup project — is an incident resuming on a delay. Run the probes against every environment where the affected schema or keys existed.
Then hold the review while memory is fresh. Questions worth answering in writing: how did the exposure arise (which stage of which workflow)? Why didn't existing checks catch it (missing check, check existed but wasn't run, ran but nobody watched)? What single change most reduces recurrence probability? One focused meeting plus a written page — timeline, root-cause chain, what worked, what didn't, and three concrete changes with owners — is the entire deliverable; reviews that produce forty-page documents rarely produce changes. The answers usually point at pipeline gaps rather than individual mistakes — and they feed directly back into hardening checklists and monitoring rules, closing the loop this runbook opened.
Incidents are expensive tuition. Teams that extract the lesson — in tests, alerts, and updated process — get value from fees already paid; teams that rush past the review pay again for the same course.
Common questions
We're a two-person startup. Does this really apply?
The full runbook scales down remarkably well — with one person, "lead" and "operator" collapse into sequenced checklists, and counsel becomes a template letter to a lawyer friend. What doesn't scale down: rotation-first containment, honest scope notes, and converting fixes to tests. Small teams arguably need the discipline more, since nobody else is watching either.
Should we shut down the whole app during containment?
Rarely. Targeted containment — rotate keys, enable RLS on affected tables, disable specific functions — closes the exposed path as soon as it is applied and keeps honest users served. Full shutdown is justified when exposure is broad, containment is unclear, or evidence preservation demands freezing state. If you can't name exactly what's still exposed, that's an argument for the bigger hammer.
How do we test our incident process without an incident?
Tabletop it: walk the phases against a hypothetical (a scan finds an open table tomorrow morning), checking that roles, contact paths, rotation procedures, and probe suites all exist and work. Gaps found in tabletops cost nothing. Also run your verification battery regularly anyway — it doubles as continuous proof that the process's foundation holds.
Where do researchers' reports fit?
Thankfully, usually before damage: a disclosure report means outside eyes found it first and chose cooperation. Take them seriously even when phrased bluntly — verify independently (probes exist for exactly this), contain, fix, and acknowledge per your disclosure policy (a published one helps). Hostility toward finders converts allies into adversaries; gratitude costs nothing and builds the channel you want operating.
What do we do about the exposed data that's already out there?
Assume copies persist. Rotation and policy fixes stop new access; they can't recall what was downloaded. That reality shapes communication (be specific about what users should consider doing) and prioritization (credentials-like data warrants forcing resets; content that was merely visible may warrant notification without action). It also argues for encryption-at-rest conversations happening before incidents, since field-level encryption is the only containment that survives exfiltration.
Close the gap before it becomes an incident: run the free scan — paste your app URL and see what an outsider can reach right now, with fixes proposed per finding.
RowShield is an independent product and is not affiliated with, endorsed by, or sponsored by Supabase, Inc.