Three checks that would have caught a six-figure data leak
Here's a story that's a composite, not one company's. I've put it together from mistakes that keep turning up at small startups, because each one is common and they tend to arrive together. A small software startup has
Here's a story that's a composite, not one company's. I've put it together from mistakes that keep turning up at small startups, because each one is common and they tend to arrive together.
A small software startup has a few engineers and nobody on security. One Supabase table has row-level security switched off. An AWS access key sits in a public GitHub repository. Months later, customers report fraud they can't explain, the AWS bill jumps, the app goes down and a customer leaves. In this story, by the time anyone works out why, the bill is somewhere between $100,000 and $200,000.
That's the expensive end. Verizon's 2026 Breach Impact Study, built from cyber-insurance claims, says "In the SMB segment, the impact median approximates a modest $38,000", and calls its figures "a potential floor – not a ceiling".
Three findings would have explained the whole story:
- A Supabase table with row-level security switched off, readable with the public key every visitor's browser already has
- An AWS access key in a public GitHub repository
- That key creating a second access key, from an address the account had never seen
Each one has a check you can run this afternoon. Here they are, with what I tested and what I didn't.
Check 1: tables without row-level security
Why this one hurts
Supabase gives your frontend a public API key. It ships in your JavaScript bundle, and that's by design. What keeps it from reading everything is row-level security (RLS): Postgres policies that decide which rows a request may see.
Without it, Supabase's docs are blunt: "A table in an exposed schema without RLS is readable and writable by any role with a grant on it." On many projects, new tables in public get those grants automatically, and everyone who has loaded your site holds the key.
This isn't rare. In 2025 a researcher scanned the homepages of 1,645 apps built with Lovable and found 170 with inadequate RLS, which became CVE-2025-48757.
The check
In the Supabase SQL editor (or psql against your database):
-- Tables in the public schema with row-level security switched off
select schemaname, tablename
from pg_tables
where schemaname = 'public'
and not rowsecurity
order by tablename;
I ran this read-only against Postgres 16, where pg_tables.rowsecurity exists (it has since 9.5). I didn't run it against a live Supabase project, so if you expose schemas other than public, add them to the where clause.
The Supabase dashboard's Security Advisor reports the same thing without SQL, and it's worth opening anyway because it checks more than RLS.
The fix
alter table public.your_table enable row level security;
Read this before you run it in production. The same docs say: "Once RLS is enabled, no data is accessible through the API when using a publishable key, until you create policies." That's the safe default, and it may also break the part of your app that relied on the table being open. Write the policies your app needs first, test them, then switch RLS on. The Supabase RLS guide has examples for "users can read their own rows", which covers most cases.
Check 2: cloud keys in your GitHub history
Why this one hurts
Attackers scan public GitHub for keys around the clock. When Palo Alto Networks' Unit 42 published working AWS keys on GitHub as a test, attackers found and used them within five minutes. Deleting the file doesn't help, because the key is still in the history.
The check
Search your organization's public code for files that shouldn't be there:
gh search code --owner your-org --filename .env
Then search each repository's full history, not just the current files. Long-term AWS access key IDs start with AKIA:
# Every commit, on every branch, that added or removed a string starting with AKIA
git log --all -p -S 'AKIA' --format='%h %ad %an %s' --date=short
-S is git's "pickaxe": it lists commits where the number of times that string appears changed. Any hit is worth reading in full.
Turn on GitHub secret scanning and push protection while you're there. Both are free for public repositories, and push protection stops the next key before it lands.
The fix
Rotate first, clean up second. Removing a key from the code does nothing if the key still works.
# 1. Make a new key and switch your app to it (not shown: update your secrets store)
aws iam create-access-key --user-name app-user
# 2. Switch the leaked key off. This is reversible, so do it now.
aws iam update-access-key --user-name app-user --access-key-id AKIAOLDKEYEXAMPLE --status Inactive
# 3. Once nothing breaks, delete it
aws iam delete-access-key --user-name app-user --access-key-id AKIAOLDKEYEXAMPLE
app-user and the key ID are placeholders. I checked these flags against the AWS CLI v2 help; I didn't run them, because they change a real account.
Check 3: what the key did while it was out
Why this one hurts
A leaked key isn't the whole story. A careful attacker's first move is to make sure they keep access after you rotate, and in AWS that usually means a new access key. Rotate only the one you found and the door stays open.
The check
List every key on the user, and when each was last used:
aws iam list-access-keys --user-name app-user
aws iam get-access-key-last-used --access-key-id AKIAOLDKEYEXAMPLE
A key nobody on the team remembers creating is the finding.
Then ask CloudTrail what the leaked key did. lookup-events searches the last 90 days of management events, one region at a time:
aws cloudtrail lookup-events \
--region us-east-1 \
--lookup-attributes AttributeKey=AccessKeyId,AttributeValue=AKIAOLDKEYEXAMPLE \
--max-results 50 \
--query 'Events[].{time:EventTime,event:EventName,user:Username}' \
--output table
IAM events land in us-east-1, so start there, then repeat for every region you use. Look for CreateAccessKey, CreateUser, AttachUserPolicy, RunInstances in regions you don't use, and anything touching S3 buckets you care about.
The fix
Deactivate every key you don't recognise (same update-access-key command as above), check for new IAM users, and revoke active sessions if the leaked key could assume roles.
Make the next one arrive by itself
The checks above find what already happened. The real problem in stories like this is that nothing tells anyone while it's happening. If you'd rather not run these by hand every week, here's the cheapest alarm I know for check 3: an EventBridge rule on IAM changes.
{
"source": ["aws.iam"],
"detail-type": ["AWS API Call via CloudTrail"],
"detail": {
"eventSource": ["iam.amazonaws.com"],
"eventName": ["CreateAccessKey", "CreateUser", "AttachUserPolicy"]
}
}
I validated this pattern with aws events test-event-pattern: it returns True for a CreateAccessKey event and False for ListUsers. I didn't deploy it. Two things to know before you do: IAM events are delivered to EventBridge in us-east-1 only, and the rule needs a CloudTrail trail recording management events. Point it at an SNS topic that emails or Slacks a person who reads it.
The traps
- Enabling RLS with no policies. It's safe, but it can take your app down. Write the policies first.
- Closing a GitHub secret-scanning alert. Closing it revokes nothing. Rotate at the provider first.
- Rotating only the key you found. Check for keys and users the attacker created.
-
Looking in one region.
lookup-eventsis regional, and attackers like regions you never use. - Alerts nobody reads. An email to an unmonitored inbox is the same as no alert.
Where Jutsu fits
Disclosure: I'm the lead engineer at Jutsu. It runs checks like these continuously, which is the part a five-person team can't do by hand.
It has a rule for each of the three findings: Supabase's security advisor reporting a table without RLS (read every hour), a live credential reported by GitHub secret scanning, and a new IAM access key in CloudTrail. Here are two of them in Jutsu's Demo Sandbox, which runs on simulated data:
What it doesn't do: it doesn't watch your cloud bill, it can't see which rows someone read from Supabase, and it doesn't fix anything without a person approving it. The longer version of this story, with the costs, is on my blog, and Jutsu's page for startups lists what it connects to.
Which of these three would you have found first in your own stack? And has anyone here had a Supabase RLS scare they'd share?
Originally published by Dev.to Security. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.
