Skip to content

Software review · public code

Supabase’s React starter: what to fix before you build on it

This report checks real code: the official React and Supabase starter that Supabase publishes for anyone to copy, under the Apache License 2.0. It has the same parts as most Lovable and Bolt apps: email sign-in, a profile page and a photo upload. Supabase did not ask for this check. I read only the public folder and its README, and ran one build on a copy that could not reach any server. No live app or backend was tested. Line numbers refer to commit 7e866ef, so you can check each finding yourself.

Summary

Someone copying this starter to begin a real app wants to know whether it is a safe base. The idea is sound and the profile rules are right, but as published it does not build, and its storage rules let strangers upload files. Two things should be fixed before anyone else signs up. Two more before the first release. Two can wait.

Checked: the sign-in, profile and photo-upload path; the database and storage rules in the README; the build; the dependencies. Each finding says whether it was tested by running or inferred from reading.

Findings, in the order to fix them

  1. 1. Fix before anyone else signs up · Inferred

    Anyone, signed in or not, can upload files to your storage

    What it means for you. The upload rule lets anybody with the app’s public key put files in the avatars bucket. The key is in every visitor’s browser, so a stranger who never signs up can upload as many files as they like, of any type, each up to your project’s global upload size limit. Supabase sets that limit per project and by plan; the starter sets no tighter limit of its own. They can fill your storage allowance, push up your bill, or use your project’s address to host files you would not want linked to your business. The README says only signed-in users can upload; the rule does not do that.

    How I showed it. Inferred: Read from the SQL; not run against a database. The README’s SQL (lines 81-82) is below. A Postgres policy with no “to” clause applies to every role, including anon, the role used by logged-out requests, and the only condition is the bucket name. Nothing ties a file to the person who uploaded it, and accept="image/*" in Avatar.jsx line 75 only filters the browser’s file picker. The README’s own summary (line 300, “Any authenticated user can upload an avatar”) describes a different rule from the one it ships.

    create policy "Anyone can upload an avatar."
      on storage.objects for insert with check (bucket_id = 'avatars');

    Suggested fix and how to check it. Limit uploads to signed-in users and to their own folder. Set the bucket’s limits in the Supabase dashboard under Storage, or from a server or your own machine with the supabase-js bucket API and the service key, never in the browser. A bucket limit can only be tighter than the project’s global limit.

    drop policy "Anyone can upload an avatar." on storage.objects;
    create policy "Users upload to their own folder"
      on storage.objects for insert to authenticated
      with check (bucket_id = 'avatars'
        and (storage.foldername(name))[1] = (select auth.uid())::text);
    await supabaseAdmin.storage.updateBucket('avatars', {
      public: false,
      fileSizeLimit: '2MB',
      allowedMimeTypes: ['image/png', 'image/jpeg', 'image/webp'],
    })

    Then upload to the user’s own folder with a random name, instead of Math.random() (Avatar.jsx lines 35-36). To check: logged out, an upload with the public key should be refused; signed in as one test user, an upload into another user’s folder should be refused; a 10 MB file or an .html file should be refused.

  2. 2. Fix before anyone else signs up · Tested

    The app does not build as published

    What it means for you. Anyone who copies the starter and runs it gets an error instead of an app. If an AI tool is asked to “fix it”, it has to guess what the missing pieces were, and that is how the next problem gets baked in.

    How I showed it. Tested: Reproduced by running. src/App.jsx uses useState, useEffect, supabase, Auth and Account without importing any of them, and has no default export (the whole file is lines 1-28). src/main.jsx line 3 imports that missing default export. On a fresh copy with current dependencies, vite build stops at that import.

    Suggested fix and how to check it. Add the five imports and export default App, matching the README’s own version of the file (README lines 247-280). Check: npm run build finishes without errors, and the same command runs on every change (finding 6) so it cannot break silently again.

  3. 3. Fix before the first release · Inferred

    Once it builds, signing in shows a broken page

    What it means for you. A new user clicks the email link, comes back signed in, and the profile page fails to load. They cannot set their name or photo. This passes a quick look, because the sign-in screen itself works.

    How I showed it. Inferred: Read from the code; not run, because it needs a real sign-in. App.jsx loads the user with getClaims() and passes the result as a prop called claims (line 25). Account.jsx still expects a prop called user (line 5) and reads user.id (line 19) and user.email (line 76), so user is undefined and the first read throws. Even renamed, the claims object calls the id sub, not id. The README still describes the older getUser() version, so the code and its own instructions disagree.

    Suggested fix and how to check it. Pick one version: go back to getUser() as in the README, or keep getClaims() and pass the id from claims.sub and the email from claims.email. Check with one small test that renders App with a signed-in session (a mocked Supabase client is enough) and expects the email field to show the user’s address.

  4. 4. Fix before the first release · Inferred

    Anyone can list and download every uploaded file

    What it means for you. Profile photos are meant to be public, so this may be what you want. But the rule is wider than “anyone can see a photo they have a link to”: anyone with the public key can list every file in the bucket and download all of them. Together with finding 1, that includes files that are not photos at all.

    How I showed it. Inferred: Read from the SQL; not run against a database. README lines 78-79 allow select on storage.objects for every role whenever the bucket is avatars, with no other condition. In Supabase, select on storage.objects is what allows listing and downloading through the API. The bucket is created private (line 76 sets no public flag), which is why the app downloads through the API rather than by plain link.

    Suggested fix and how to check it. Decide what “public profile photo” should mean. If anyone may view a photo by its link, make the bucket public, use getPublicUrl, and drop the broad select rule so the bucket cannot be listed. If only signed-in users should see photos, keep it private and limit the rule to authenticated. Check: logged out, listing the bucket should return nothing, and a photo should still show on the profile page.

  5. 5. Can wait until the next round of changes · Inferred

    If the profile fails to load, pressing Update wipes the saved website

    What it means for you. On a bad connection the profile page can load empty. The user retypes their name and presses Update, and the website they saved earlier is replaced with nothing. Nothing tells them the load failed, and nothing tells them the save worked.

    How I showed it. Inferred: Read from the code; not run. When loading fails, Account.jsx only writes a warning to the browser console (line 24) and shows the form with empty fields. Update then sends website: null (lines 47-55), which overwrites the stored value. A successful save shows no message; a failed one uses a browser alert().

    Suggested fix and how to check it. If the load fails, show an error with a “Try again” button and keep Update disabled until the profile has loaded. Show “Saved” after a successful save. Check: with the network switched off in developer tools, open the page: it should show the error, not an empty form.

  6. 6. Can wait until the next round of changes · Tested

    Nothing stops the next change from breaking it again

    What it means for you. Findings 2 and 3 are what happens when code changes and nothing checks it. The starter’s folder has no test files, no lint setup and no lockfile, so two people installing a month apart can get different library versions. getClaims(), which the current code relies on, only exists in newer 2.x releases of supabase-js.

    How I showed it. Tested: Read package.json (lines 11-21) and the folder listing: no package-lock.json, no tests, no lint setup. The install in finding 2 resolved supabase-js 2.118.0, React 19.3.1 and Vite 7.3.7 from ranges such as "^2". I inspected only this folder, not the rest of the supabase/supabase repository or its CI.

    Suggested fix and how to check it. Commit the lockfile. In your own copy, add one automatic check that runs npm ci, npm run build and the test from finding 3 on every change, and turn on dependency update pull requests so upgrades arrive one at a time with that check run on each. Check: a pull request that deletes an import should fail before it can be merged.

What already holds up

  • The profile rules are right: a user can only create and change their own row (README lines 69-73), written in the form Supabase recommends.
  • Only the public (publishable) key is in the browser. No secret or service key is in the code, and .env.local is kept out of git.
  • Sign-in by email link means there are no passwords to store or leak.

What I did not check

  • The live behaviour of a real Supabase project. Findings 1 and 4 come from reading the SQL. A check on your app would repeat the logged-out upload and list requests on your own project.
  • Email delivery and the sign-in link settings, which live in the Supabase dashboard.
  • The “User Management Starter” in Supabase’s SQL editor, which may differ from the README’s copy.
  • Behaviour under heavy load.
  • Anything outside the starter’s folder, including the supabase/supabase repository’s CI.
  • Upload limits for a particular Supabase plan.

This report is not a penetration test or a security certification. Fixing these six does not mean nothing else is wrong; it means these six are known and can be closed.

What each kind of check found

Kind of checkQuestion it answersFindings
VerificationDoes it build and do what the code says?2, 3
ValidationDoes it do what the owner meant?1, 4, 5
SecurityWho can reach the data and storage?1, 4
ReleasesCan a change ship without breaking it?2, 6
MaintenanceWill it still work next month?6

Next steps

Fix findings 1 and 2 first and repeat the checks in each finding. Use the gaps above to decide what to verify before relying on a live app built from this starter.

Need ongoing help with a live app?

Through Wayrest, I help review changes, test critical workflows and look after your software as you keep building.

Explore managed software

Prefer a short example first? Read the sample report on a made-up Lovable app.