On a university team project I reviewed a lot of pull requests, and the findings I was proudest of had one thing in common. The code in the diff was correct. The bug was in what the code did when it met something the diff did not show: a running system, a different layer, a bigger table, or a file nobody opened.

These are four of them, from a FastAPI and Supabase invoicing app. The names of people and the ticket numbers are left out on purpose, since the lesson is the same for any team.

The PDF That Was Public, Then Expired

The first change generated an invoice PDF and stored it in Supabase Storage. It used the bucket’s public URL and never marked the bucket private. The PDFs contained a tax ID (NPWP in Indonesia), which I treat as sensitive personal data, plus invoice amounts. A public URL means anyone who has it can open it with no login. I blocked the merge until the bucket was private and the file was served through a signed URL.

The follow-up change did exactly that, and it looked right: private bucket, create_signed_url(...), the result stored on the invoice row. I could have approved it by reading it. Instead I ran the flow end to end on a local Supabase with Playwright, copied the stored URL from the database row, and decoded the token in its query string:

import base64, json
token = url.split("token=")[1].split("&")[0]
payload = json.loads(base64.urlsafe_b64decode(token.split(".")[1] + "=="))
print(payload["exp"] - payload["iat"])
# 3600

An hour. The code asked for a one-hour signed URL and got one, so there is nothing wrong with the source. The bug is that the row outlives the URL. Every payment or status change re-ran the worker, which minted a fresh URL, so active invoices looked healthy. A quiet invoice would stop working an hour after creation and stay broken.

The fix is to store the storage path and sign on read:

def to_response(invoice):
    path = invoice.get("pdf_storage_path")
    pdf_url = bucket.create_signed_url(path, 60 * 60)["signedURL"] if path else None
    return InvoiceResponse(..., pdf_url=pdf_url)

The same review found a second problem in the storage path. Files were written to {invoice_id}/{invoice_number}.pdf with upsert=True, so regenerating an invoice overwrote the file in place. A link emailed earlier would then point at a different document. I asked for a version number in the path and no upsert.

What I took from it: a URL with a token in it is an artifact, not a string. Decode it and read the expiry.

The Policy That Was Only Advice

A change added a storage bucket for payment proofs, with row-level security policies on insert, select, and delete. They looked airtight, checking that the signed-in user created the payment.

The API did not upload as the signed-in user, though. It used the service-role key, and Supabase documents that role as bypassing row-level security. So for the upload path the policies did nothing. The real enforcement was an ownership check in the Python service.

That is not an exploitable hole today, because the service-layer check works. It is a trap for the next person. Anyone reading the migration believes the database enforces access, and a later refactor to user-token uploads would be built on that belief. The fix was a three-line comment in the migration saying the policies are advisory for this path and where the real check lives.

The same review found a second bug in that ownership check. It treated anyone who ever appeared as created_by on a payment version as an owner. That column means “who edited”, not “who owns”, so any admin who had touched a payment became its owner forever. Scoping the query to the first version fixed it.

What I took from it: read a security rule together with the credential that will actually exercise it.

The Dashboard That Lied Past 1,000 Rows

A change added an analytics dashboard that computed totals, aging buckets, and risk distribution from several tables. Every query was correct against our test data.

By default, Supabase projects return at most 1,000 rows per request. The dashboard’s total-invoices metric selected everything with no range or limit. The first day the table crossed 1,000 invoices, every number built on that query would be undercounted, and no error would appear anywhere. Counts that only need a number should ask for an exact count with count="exact" and head=True instead of fetching rows. Anything that needs the rows should page with .range().

Two sibling bugs had the same shape. A “top five overdue clients” widget fetched the whole clients table and sliced it in the browser. Several query handlers returned an empty list on failure, so a backend 500 rendered the same “No data” state as a genuinely empty table.

What I took from it: for every query in a metrics change, ask what it returns at ten times and a hundred times the test data, and whether a failure can look like an empty result.

The Files Outside the Diff

A large UI change had 56 review notes by the time I finished, and the worst findings were not in the UI code. The branch included a binary database snapshot from someone’s local machine, several directories generated by local tools, and an edit to the CI config that lowered the coverage threshold from 80 to 60.

Git history keeps a committed binary forever, even after you delete it. A lowered threshold is worse, because it moves the bar for every later change while the pipeline keeps saying it passed. None of this is visible if you read the changed lines of source code.

What I took from it: for a big change, read the file list before the diff, and check the CI and config files on purpose.

What I Do Now

  1. Run the thing if I can. The signed-URL bug took five minutes of setup to find and was invisible in the code.
  2. Look at boundaries between layers, such as storage and database, policy and credential, URL lifetime and row lifetime.
  3. Ask what happens at scale and what happens on failure for every query.
  4. Read the file list, not just the diff.
  5. Start the review with what the author got right. It changes how the rest lands.

Limits of This

This was a student team, and I found these by hand. I did not measure whether review caught more than our test suite or CI would have. Some of these have mechanical checks: a CI rule can reject a lowered coverage threshold, and a lint can flag an unbounded select. The signed-URL expiry and the advisory-policy problem do not have one that I know of, and those are the two I would want a reviewer for.

The code here is trimmed from the originals and was reviewed against Supabase in April 2026. Check the current docs before relying on the row cap or the role behavior.