Skip to content
Book a call

(01) ServicesSample audit

What an audit looks like.A full sample report.

You get a report like this for your app. It has a summary in plain words and a scorecard. It shows each problem with the code that proves it, and a plan with hours.

Sample, not a client

This is a sample. The app, its owner and its numbers are made up. But each problem here is a real kind I see in apps built with AI tools.

Skip to findings

Report cover

App
Mealbox, a weekly meal-kit subscription (fictional)
Built with
Lovable: React and Vite, Supabase (database, sign-in, edge functions), Stripe
Scope
The code, the Supabase project and the live site, signed in as a test customer
Date
October 2026
Auditor
Hansraj Saini, HS
Time spent
4 days

(02) Summary

Is it safe to launch?The short answer first.

Verdict

Not safe to launch yet.

Fix the three critical problems before you take another payment. That is about one day of work.

Mealbox works well for a customer. Sign-up, meal choice and payment all do their job. Card details never touch your servers, because payment happens on Stripe's own page.

The trouble is behind the screens. Anyone who looks can read three database tables. The website carries the database master key. The payment code believes a fake 'paid' message.

You don't need to rebuild anything. Each fix below keeps your code. I'd do safety in week one, code health in week two, and speed and Google in week three.

Findings by severity

  • Critical

    3

    Fix before your next user joins.

  • High

    3

    Fix this week.

  • Medium

    3

    Fix before you grow.

  • Low

    1

    Fix when you work on that part.

Fix first

  1. Anyone can read customer addresses and orders (MB-01)
  2. The website gives away the database master key (MB-02)
  3. Anyone can fake a 'payment received' message (MB-03)

Already good

  • Sign-in uses Supabase Auth the right way, with no home-made password system.
  • Stripe Checkout takes card payments, so card numbers never reach your code.
  • Git holds the code with a clear history, which makes each fix below easier.

(03) Scorecard

Eight areas, checked.Where the app stands on each.

  • Who can read data

    Fail

    Three tables have rules off.

    MB-01
  • Secret keys

    Fail

    Master key in the website.

    MB-02
  • Server checks

    Fail

    Server trusts the browser twice.

    MB-04MB-05
  • Payment messages

    Fail

    No check on payment messages.

    MB-03
  • Code libraries

    Needs work

    One known hole, twelve behind.

    MB-07
  • Limits and alerts

    Fail

    No limits, no alerts.

    MB-06MB-08
  • Google

    Needs work

    Pages start out empty.

    MB-09
  • Speed

    Needs work

    About 7 seconds to show content.

    MB-10

(04) Findings

10 findings,each with proof and a fix.

  1. MB-01

    Critical

    Effort 3 h

    Anyone can read customer addresses and orders

    WhereSupabase: public.profiles, public.orders, public.addresses

    What's wrong

    Supabase uses rules to decide who sees which rows in a table. Three tables have these rules off. So the database answers anyone who has the public key, and anyone can copy that key from your website.

    Why it matters

    One request can download every customer's name, phone number, home address and order history. You would likely have to report such a data leak. It can also end up on social media.

    Evidence

    -- Supabase SQL editor
    select tablename, rowsecurity
    from pg_tables where schemaname = 'public';
    
     tablename   | rowsecurity
    -------------+------------
     profiles    | false
     orders      | false
     addresses   | false
     meal_plans  | true
    
    -- From any laptop, with the key from the site's JavaScript:
    -- curl "https://<project>.supabase.co/rest/v1/addresses?select=*" \
    --   -H "apikey: <anon key>"
    -- → 1,240 rows, every customer's address

    The fix

    Turn on the rules for all three tables, with one rule each: customers see and change only their own rows. Then sign in as two customers and prove neither sees the other.

    For your developer

    Enable row level security on each table, then a policy per table: for all using (auth.uid() = user_id) with check (auth.uid() = user_id). profiles keys on id, not user_id. Check that the admin dashboard still works. It should use an edge function (see MB-02), not the anon client.

    Evidence and developer notes
    -- Supabase SQL editor
    select tablename, rowsecurity
    from pg_tables where schemaname = 'public';
    
     tablename   | rowsecurity
    -------------+------------
     profiles    | false
     orders      | false
     addresses   | false
     meal_plans  | true
    
    -- From any laptop, with the key from the site's JavaScript:
    -- curl "https://<project>.supabase.co/rest/v1/addresses?select=*" \
    --   -H "apikey: <anon key>"
    -- → 1,240 rows, every customer's address

    For your developer

    Enable row level security on each table, then a policy per table: for all using (auth.uid() = user_id) with check (auth.uid() = user_id). profiles keys on id, not user_id. Check that the admin dashboard still works. It should use an edge function (see MB-02), not the anon client.

  2. MB-02

    Critical

    Effort 3 h

    The website gives away the database master key

    Where.envsrc/lib/adminClient.tsdist/assets/index-*.js

    What's wrong

    Supabase gives two keys: a public one for the browser and a secret one that skips every rule. Your secret key sits in a VITE_ setting. Vite copies each such setting into the code that visitors download.

    Why it matters

    This key lets anyone read, change or delete anything in your database, even the MB-01 rules. So the MB-01 fix alone isn't enough. The .env file is in the code folder too, so anyone who ever saw the code has the key.

    Evidence

    # .env (committed to the repo)
    VITE_SUPABASE_URL=https://<project>.supabase.co
    VITE_SUPABASE_ANON_KEY=eyJhbGciOiJIUzI1NiIs...
    VITE_SUPABASE_SERVICE_ROLE_KEY=eyJhbGciOiJIUzI1NiIs...
    
    // src/lib/adminClient.ts
    export const admin = createClient(
      import.meta.env.VITE_SUPABASE_URL,
      import.meta.env.VITE_SUPABASE_SERVICE_ROLE_KEY,
    );
    
    $ grep -c "service_role" dist/assets/index-*.js
    1

    The fix

    Make a new secret key in Supabase, so the leaked one stops working. Move the few admin actions that need it to the server. Remove the .env file from the code folder.

    For your developer

    Rotate the service_role key (or move to the new secret API keys) in the Supabase dashboard. Move the three admin queries in adminClient.ts into an edge function that checks the caller is an admin, reading the key from Deno.env. Add .env to .gitignore and purge it from history with git filter-repo; treat the old key as public regardless.

    Evidence and developer notes
    # .env (committed to the repo)
    VITE_SUPABASE_URL=https://<project>.supabase.co
    VITE_SUPABASE_ANON_KEY=eyJhbGciOiJIUzI1NiIs...
    VITE_SUPABASE_SERVICE_ROLE_KEY=eyJhbGciOiJIUzI1NiIs...
    
    // src/lib/adminClient.ts
    export const admin = createClient(
      import.meta.env.VITE_SUPABASE_URL,
      import.meta.env.VITE_SUPABASE_SERVICE_ROLE_KEY,
    );
    
    $ grep -c "service_role" dist/assets/index-*.js
    1

    For your developer

    Rotate the service_role key (or move to the new secret API keys) in the Supabase dashboard. Move the three admin queries in adminClient.ts into an edge function that checks the caller is an admin, reading the key from Deno.env. Add .env to .gitignore and purge it from history with git filter-repo; treat the old key as public regardless.

  3. MB-03

    Critical

    Effort 2 h

    Anyone can fake a 'payment received' message

    Wheresupabase/functions/stripe-webhook/index.ts

    What's wrong

    When someone pays, Stripe tells your server, and the server marks the order as paid. Stripe signs each message to prove it is real. Your server never checks that signature, so it believes any message that looks right.

    Why it matters

    The server's address is easy to guess. A person can send a fake 'paid' message and get a food box every week for free. You'd notice only when Stripe payouts don't match the orders.

    Evidence

    Deno.serve(async (req) => {
      const event = await req.json();   // no signature check
      if (event.type === "checkout.session.completed") {
        await markOrderPaid(event.data.object.metadata.order_id);
      }
      return new Response("ok");
    });

    The fix

    Check Stripe's signature on every message and reject any that fail. Before you mark an order paid, also confirm it with Stripe.

    For your developer

    Read the raw body with req.text(), then stripe.webhooks.constructEventAsync(body, req.headers.get("stripe-signature"), STRIPE_WEBHOOK_SECRET, undefined, Stripe.createSubtleCryptoProvider()). Return 400 on failure. Stripe can deliver the same event twice, so make markOrderPaid idempotent on the event id.

    Evidence and developer notes
    Deno.serve(async (req) => {
      const event = await req.json();   // no signature check
      if (event.type === "checkout.session.completed") {
        await markOrderPaid(event.data.object.metadata.order_id);
      }
      return new Response("ok");
    });

    For your developer

    Read the raw body with req.text(), then stripe.webhooks.constructEventAsync(body, req.headers.get("stripe-signature"), STRIPE_WEBHOOK_SECRET, undefined, Stripe.createSubtleCryptoProvider()). Return 400 on failure. Stripe can deliver the same event twice, so make markOrderPaid idempotent on the event id.

  4. MB-04

    High

    Effort 2 h

    The customer's browser sets the price

    Wheresrc/pages/Checkout.tsxsupabase/functions/create-checkout/index.ts

    What's wrong

    The payment page tells the server the price, and the server passes it straight to Stripe. Anyone can change that number in their browser before it goes.

    Why it matters

    A customer can buy the family plan for ₹1 a week. Stripe charges ₹1, the order looks paid, and nothing warns you.

    Evidence

    // src/pages/Checkout.tsx
    await supabase.functions.invoke("create-checkout", {
      body: { planId: plan.id, amount: plan.price * 100 },
    });
    
    // supabase/functions/create-checkout/index.ts
    line_items: [{
      price_data: {
        currency: "inr",
        unit_amount: body.amount,        // from the browser
        recurring: { interval: "week" },
        product_data: { name: "Mealbox plan" },
      },
      quantity: 1,
    }],

    The fix

    Save a fixed price for each plan in Stripe. The server finds the price for the chosen plan. The browser sends only which plan, never how much.

    For your developer

    Create one Stripe Price per plan and store its id in meal_plans.stripe_price_id. In create-checkout, accept only planId, look up the price id server-side and pass line_items: [{ price, quantity: 1 }]. Ignore any amount in the body.

    Evidence and developer notes
    // src/pages/Checkout.tsx
    await supabase.functions.invoke("create-checkout", {
      body: { planId: plan.id, amount: plan.price * 100 },
    });
    
    // supabase/functions/create-checkout/index.ts
    line_items: [{
      price_data: {
        currency: "inr",
        unit_amount: body.amount,        // from the browser
        recurring: { interval: "week" },
        product_data: { name: "Mealbox plan" },
      },
      quantity: 1,
    }],

    For your developer

    Create one Stripe Price per plan and store its id in meal_plans.stripe_price_id. In create-checkout, accept only planId, look up the price id server-side and pass line_items: [{ price, quantity: 1 }]. Ignore any amount in the body.

  5. MB-05

    High

    Effort 3 h

    One customer can change another's plan

    Wheresupabase/functions/update-subscription/index.ts

    What's wrong

    To pause or change a plan, the app sends a customer ID to the server. The server trusts that ID and never checks who signed in. It uses the master key, so no database rule stops it.

    Why it matters

    A signed-in customer can change one value and pause, cancel or upgrade someone else's plan. Other server replies show customer IDs, so they're easy to find.

    Evidence

    const { user_id, plan_id, pause_until } = await req.json();
    const supabase = createClient(URL, SERVICE_ROLE_KEY);  // skips every rule
    
    await supabase
      .from("subscriptions")
      .update({ plan_id, pause_until })
      .eq("user_id", user_id);   // whoever the request says

    The fix

    On the server, read who is signed in from their login. Change only that person's plan. Use the normal key, so the database rules from MB-01 apply too.

    For your developer

    Create the client with the anon key and the caller's Authorization header, call supabase.auth.getUser() and use user.id. Drop user_id from the request body. Add an RLS policy on subscriptions, so the database enforces it even if a function gets it wrong.

    Evidence and developer notes
    const { user_id, plan_id, pause_until } = await req.json();
    const supabase = createClient(URL, SERVICE_ROLE_KEY);  // skips every rule
    
    await supabase
      .from("subscriptions")
      .update({ plan_id, pause_until })
      .eq("user_id", user_id);   // whoever the request says

    For your developer

    Create the client with the anon key and the caller's Authorization header, call supabase.auth.getUser() and use user.id. Drop user_id from the request body. Add an RLS policy on subscriptions, so the database enforces it even if a function gets it wrong.

  6. MB-06

    High

    Effort 3 h

    No limit on SMS code requests

    Wheresupabase/functions/send-sms-code/index.ts

    What's wrong

    At payment, an SMS code checks the phone number. Anyone can ask for a code, for any number, as often as they like, with no sign-in.

    Why it matters

    Bots use open SMS forms to send thousands of texts to costly numbers that earn them money. Your Twilio account gets the bill. People can also guess codes or flood a stranger's phone.

    Evidence

    const { phone } = await req.json();       // no sign-in needed
    const code = Math.floor(100000 + Math.random() * 900000);
    
    await twilio.messages.create({
      to: phone,
      from: TWILIO_FROM,
      body: `Your Mealbox code: ${code}`,
    });
    // no limit per phone, per IP or per hour

    The fix

    Send codes only to signed-in customers. Allow a few an hour for each phone and device, and only in countries you deliver to. Set a spending alert in Twilio.

    For your developer

    Require a valid user JWT. Rate-limit by phone and IP (a small table with timestamps, or Upstash). Prefer Twilio Verify with Fraud Guard and a country allow-list over hand-rolled codes; if you keep your own, use crypto.getRandomValues, expire codes after 10 minutes and lock after 5 wrong tries.

    Evidence and developer notes
    const { phone } = await req.json();       // no sign-in needed
    const code = Math.floor(100000 + Math.random() * 900000);
    
    await twilio.messages.create({
      to: phone,
      from: TWILIO_FROM,
      body: `Your Mealbox code: ${code}`,
    });
    // no limit per phone, per IP or per hour

    For your developer

    Require a valid user JWT. Rate-limit by phone and IP (a small table with timestamps, or Upstash). Prefer Twilio Verify with Fraud Guard and a country allow-list over hand-rolled codes; if you keep your own, use crypto.getRandomValues, expire codes after 10 minutes and lock after 5 wrong tries.

  7. MB-07

    Low

    Effort 3 h

    Old code libraries, one with a known security hole

    Wherepackage.json

    What's wrong

    Twelve packages (ready-made code) are at least one major version behind. One lets the app call other services. Its old version has a publicly reported security hole that newer versions fix.

    Why it matters

    Mealbox doesn't use the weak part today, so the risk now is low. But old packages pile up. The longer you wait, the bigger and riskier each update gets.

    Evidence

    $ npm audit --omit=dev
    axios  <1.x
      1 published advisory, fixed in 1.x
      fix available via `npm audit fix --force`
    
    $ npm outdated | wc -l
    13   # 12 packages behind, plus the header

    The fix

    Update the one with the known hole now. Then update the rest in small groups, and test sign-up and payment after each.

    For your developer

    Bump axios to the current 1.x and check the two call sites for changed defaults. Then update in batches (Supabase client, router, UI kit), running the checkout flow by hand after each. Turn on Dependabot or Renovate so this stays small.

    Evidence and developer notes
    $ npm audit --omit=dev
    axios  <1.x
      1 published advisory, fixed in 1.x
      fix available via `npm audit fix --force`
    
    $ npm outdated | wc -l
    13   # 12 packages behind, plus the header

    For your developer

    Bump axios to the current 1.x and check the two call sites for changed defaults. Then update in batches (Supabase client, router, UI kit), running the checkout flow by hand after each. Turn on Dependabot or Renovate so this stays small.

  8. MB-08

    Medium

    Effort 5 h

    When something breaks, nobody finds out

    Wheresupabase/functions/stripe-webhook/index.tssrc/pages/Account.tsx

    What's wrong

    A payment update fails. The error goes to a log nobody reads. Stripe hears that all went well, so it never tries again. Customers see raw database errors on screen.

    Why it matters

    A customer pays, the order fails, and an angry email tells you a week later. The raw errors also show an attacker the names of your tables and columns.

    Evidence

    // stripe-webhook/index.ts
    try {
      await markOrderPaid(orderId);
    } catch (e) {
      console.log(e);             // nobody reads this
    }
    return new Response("ok");    // Stripe won't retry
    
    // Account.tsx
    if (error) toast.error(error.message);
    // 'null value in column "user_id" of relation
    //  "orders" violates not-null constraint'

    The fix

    Use an error tracker that emails you. Tell Stripe about each failure, so it tries again. Show customers a simple message, not the database error.

    For your developer

    Return a 500 from the webhook on failure so Stripe retries. Add error tracking (Sentry or similar) to the app and the edge functions, with an alert on webhook errors. Map Supabase errors to friendly copy and log the original.

    Evidence and developer notes
    // stripe-webhook/index.ts
    try {
      await markOrderPaid(orderId);
    } catch (e) {
      console.log(e);             // nobody reads this
    }
    return new Response("ok");    // Stripe won't retry
    
    // Account.tsx
    if (error) toast.error(error.message);
    // 'null value in column "user_id" of relation
    //  "orders" violates not-null constraint'

    For your developer

    Return a 500 from the webhook on failure so Stripe retries. Add error tracking (Sentry or similar) to the app and the edge functions, with an alert on webhook errors. Map Supabase errors to friendly copy and log the original.

  9. MB-09

    Medium

    Effort 10 h

    Google first sees an empty page

    Whereindex.htmlsrc/main.tsx

    What's wrong

    JavaScript builds each page inside the visitor's browser. Until it runs, the page is empty. Every page has the same title: 'Mealbox'. Google can run JavaScript, but slowly and not always. Link previews and most AI search tools never do.

    Why it matters

    People search for your menu, price and recipe pages, but these barely show in results. A link shared on WhatsApp or LinkedIn shows no title or image.

    Evidence

    $ curl -s https://mealbox.example/menu
    <!doctype html>
    <html lang="en">
      <head><title>Mealbox</title></head>
      <body>
        <div id="root"></div>
        <script type="module" src="/assets/index-4f9a1c.js"></script>
      </body>
    </html>
    # same title and empty body on all 14 public pages

    The fix

    Build the home, menu, price and recipe pages in advance, so their text arrives with them. Give each its own title and description. Add a sitemap (a list of your pages).

    For your developer

    Smallest change: pre-render the public routes at build time (Vike, or a prerender step) and set per-route meta with react-helmet-async. If you plan more marketing pages, move them to Next.js or Astro. Keep the signed-in app as it is. Add sitemap.xml, robots.txt and Open Graph images.

    Evidence and developer notes
    $ curl -s https://mealbox.example/menu
    <!doctype html>
    <html lang="en">
      <head><title>Mealbox</title></head>
      <body>
        <div id="root"></div>
        <script type="module" src="/assets/index-4f9a1c.js"></script>
      </body>
    </html>
    # same title and empty body on all 14 public pages

    For your developer

    Smallest change: pre-render the public routes at build time (Vike, or a prerender step) and set per-route meta with react-helmet-async. If you plan more marketing pages, move them to Next.js or Astro. Keep the signed-in app as it is. Add sitemap.xml, robots.txt and Open Graph images.

  10. MB-10

    Medium

    Effort 8 h

    Slow on an ordinary phone

    Wheresrc/App.tsxpublic/images/

    What's wrong

    The site sends 2.1 MB of code before it shows anything. All screens load at once, even the admin dashboard. The top photo on the home page is 3.4 MB.

    Why it matters

    On a mid-range Android phone with 4G, the main content takes about 7 seconds to show. Many visitors leave first, and Google ranks slow pages lower on phones.

    Evidence

    Lighthouse, mobile (mid-range phone, slow 4G)
    
    Largest Contentful Paint    6.8 s     target < 2.5 s
    Total Blocking Time         1,240 ms  target < 200 ms
    JavaScript                  2.1 MB    640 KB gzipped
    hero-bowl.png               3.4 MB    2400 × 1600

    The fix

    Load each screen's code only when someone needs it. Keep admin code off the customer site. Shrink photos to their display size and save them in a modern format.

    For your developer

    Route-level React.lazy + Suspense, admin in its own chunk; check with rollup-plugin-visualizer (two charting libraries and a full icon set are the biggest chunks). Convert images to AVIF/WebP with srcset, preload the hero image, lazy-load the rest. Aim for LCP under 2.5 s on the same test.

    Evidence and developer notes
    Lighthouse, mobile (mid-range phone, slow 4G)
    
    Largest Contentful Paint    6.8 s     target < 2.5 s
    Total Blocking Time         1,240 ms  target < 200 ms
    JavaScript                  2.1 MB    640 KB gzipped
    hero-bowl.png               3.4 MB    2400 × 1600

    For your developer

    Route-level React.lazy + Suspense, admin in its own chunk; check with rollup-plugin-visualizer (two charting libraries and a full icon set are the biggest chunks). Convert images to AVIF/WebP with srcset, preload the hero image, lazy-load the rest. Aim for LCP under 2.5 s on the same test.

(05) Fix plan

Three weeks to ready.Riskiest work first.

(06) Your app

Want this for your app?Send me the link.

You get the same report for your own code. ₹15,000 – ₹40,000. Quoted by app size, report in 3 to 5 days.

Reply within a day

Want more calls and bookings?

Tell me about your business on WhatsApp, or send a few lines. I reply within a day with honest next steps, even if I'm not the right fit.

Free 30-minute call · No commitment · Reply within a day

Pick a time on my Cal.com page. Calls are on Google Meet. Or email me.

  1. Step 1

    You message me on WhatsApp

    A few lines is enough.

  2. Step 2

    I reply within a day

    I ask questions or share a first view.

  3. Step 3

    A free 30-minute call

    Then a written quote.