AI App Rescue Order the diagnosis

This is the automated part of the diagnosis, produced by my scanner on a demo app I built to fail on purpose (synthetic code, fake keys). The dependency advisories are real, from OSV.dev. A paid diagnosis adds a human review of your business logic, auth and payments, and a fix plan in order.

AI App Rescue: automated diagnosis

Project: Demo app built to fail (Lovable-style, synthetic)
Date: 2026-11-29
Files read: 14
Tool: rescue_scan 0.1.0 (static, read-only: your code was read, never run)

Verdict

Not safe for real users or payments yet. 5 critical problem(s) below can expose or destroy data today.

Summary

SeverityProblems
CRITICAL5
HIGH6
MEDIUM6
LOW4
INFO1

Fix these first

  1. [CRITICAL] Supabase service_role key is in the code (1x)
  2. [CRITICAL] Browser code creates a Supabase client with the service_role key (1x)
  3. [CRITICAL] Table without Row Level Security (2x)
  4. [CRITICAL] Firebase security rules allow anyone to read or write (1x)
  5. [CRITICAL] Live Stripe secret key is in the code (1x)

Findings

1. [CRITICAL] Supabase service_role key is in the code

Where:

Why it matters: This key skips every Row Level Security rule. Whoever has it can read, change and delete all data in the database.

How to fix: Rotate the key in Supabase (Settings > API) now. Keep it only in server-side secrets (Edge Function secrets, your host's env vars), never in frontend code or VITE_/NEXT_PUBLIC_ variables.

2. [CRITICAL] Browser code creates a Supabase client with the service_role key

Where:

Why it matters: Code that runs in the browser is public. A service_role client there gives every visitor full database access.

How to fix: Use the anon key in the browser; move privileged operations to an Edge Function that checks the user's JWT.

3. [CRITICAL] Table without Row Level Security

Where:

Why it matters: With RLS off, anyone who has your public anon key (it is in your website's JavaScript) can read, change and delete every row of this table.

How to fix: alter table public.<table> enable row level security; then add policies that only let users reach their own rows (e.g. using (auth.uid() = user_id)).

4. [CRITICAL] Firebase security rules allow anyone to read or write

Where:

Why it matters: Open rules mean the whole database or storage is public and writable.

How to fix: Replace with rules that require request.auth != null and check ownership, e.g. request.auth.uid == userId.

5. [CRITICAL] Live Stripe secret key is in the code

Where:

Why it matters: With this key anyone can issue refunds, read customer data and create charges on your account.

How to fix: Roll the key in the Stripe Dashboard (Developers > API keys), then move it to a server-side secret.

6. [HIGH] Policy lets anyone on the internet read a whole table

Where:

Why it matters: using (true) for anon/public on select exposes every row to anyone. Fine for truly public content (blog posts, product list); a data leak for anything personal.

How to fix: If the table holds personal or business data, limit the policy to the owner: using (auth.uid() = user_id).

7. [HIGH] Any logged-in user can change every row

Where:

Why it matters: A policy with true for authenticated on insert/update/delete lets any user who signs up edit or delete other users' data.

How to fix: Add an ownership condition: using (auth.uid() = user_id) with check (auth.uid() = user_id).

8. [HIGH] Stripe webhook handler does not verify the signature

Where:

Why it matters: Without constructEvent, anyone can POST a fake 'checkout.session.completed' and get the product without paying.

How to fix: Verify every event with stripe.webhooks.constructEvent(rawBody, signature, endpointSecret) (or constructEventAsync in Deno) before acting on it.

9. [HIGH] A secret is stored in a browser-exposed variable

Where:

Why it matters: Variables starting with VITE_, NEXT_PUBLIC_, REACT_APP_, EXPO_PUBLIC_ or PUBLIC_ are copied into the JavaScript every visitor downloads.

How to fix: Rename the variable without the public prefix and read it only in server-side code (Edge Function, API route).

10. [HIGH] AI provider API key (OpenAI / Anthropic) is in the code

Where:

Why it matters: Leaked AI keys are found by bots within hours and used to run up your bill.

How to fix: Revoke the key in the provider's console, set a spending cap, and call the AI API only from a server-side function.

11. [HIGH] Dependency with a known vulnerability

PackageVersionFixed inAdvisories
lodash4.17.154.18.0GHSA-29mw-wpgm-hmr9 (CVE-2020-28500): Regular Expression Denial of Service (ReDoS) in lodash; GHSA-35jh-r3h4-6jhm (CVE-2021-23337): Command Injection in lodash; GHSA-p6mc-m468-83gw (CVE-2020-8203): Prototype Pollution in lodash and 2 more

Why it matters: Published advisories (OSV / GitHub) list this exact version as vulnerable.

How to fix: Upgrade to the fixed version shown, run the tests, and redeploy.

12. [MEDIUM] .env file is in the repository

Where:

Why it matters: Anything in a committed .env file stays in git history even after you delete it.

How to fix: Rotate every secret that was in the file, remove the file from git, and add .env* to .gitignore.

13. [MEDIUM] Dependency with a known vulnerability

PackageVersionFixed inAdvisories
vite (dev only)5.0.06.4.4GHSA-356w-63v5-8wf4 (CVE-2025-32395): Vite has an server.fs.deny bypass with an invalid request-target; GHSA-4r4m-qw57-chr8 (CVE-2025-31125): Vite has a server.fs.deny bypassed for inline and raw with ?import query; GHSA-4w7w-66w2-5vf9 (CVE-2026-39365): Vite Vulnerable to Path Traversal in Optimized Deps .map Handling and 20 more

Why it matters: Published advisories (OSV / GitHub) list this exact version as vulnerable.

How to fix: Upgrade to the fixed version shown, run the tests, and redeploy.

14. [MEDIUM] SECURITY DEFINER function without a fixed search_path

Where:

Why it matters: These functions run with the owner's rights and skip RLS. Without set search_path, a caller can make them run objects they control (Supabase lint 0011).

How to fix: Add set search_path = '' (and schema-qualify names) or set search_path = public to the function definition.

15. [MEDIUM] Edge Function with JWT verification turned off

Where:

Why it matters: verify_jwt = false means anyone can call this function. Right for webhooks that check their own signature; wrong for anything that acts on behalf of a user.

How to fix: Turn verify_jwt back on, or make sure the function verifies a signature or token itself.

16. [MEDIUM] Anyone on the internet can add rows to a table

Where:

Why it matters: Normal for a contact form or a waitlist; otherwise it lets bots fill your database with junk or fake records.

How to fix: If only users should add rows, restrict to authenticated with with check (auth.uid() = user_id); if it is a public form, add rate limiting or a captcha in an Edge Function.

17. [MEDIUM] View in the public schema that bypasses RLS

Where:

Why it matters: Postgres views run with the creator's rights by default, so a view over a protected table can show all rows to anyone (Supabase lint 0010).

How to fix: Create it with (security_invoker = true) (Postgres 15+), or move it out of the exposed schema.

18. [LOW] Raw HTML is injected without a sanitiser

Where:

Why it matters: dangerouslySetInnerHTML / v-html with user content allows script injection (XSS), which can steal sessions.

How to fix: Sanitise with DOMPurify before rendering, or render as text.

19. [LOW] .gitignore does not exclude .env files

Where:

Why it matters: The next .env created on this project will be committed by accident.

How to fix: Add .env and .env*.local to .gitignore.

20. [LOW] Public storage bucket

Where:

Why it matters: Files in a public bucket can be downloaded by anyone who has or guesses the URL. Fine for avatars and images, not for invoices, IDs or uploads.

How to fix: Make the bucket private and serve files with signed URLs if they are not meant to be public.

21. [LOW] RLS is on but the table has no policies

Where:

Why it matters: Safe (nobody can reach it through the API), but if the app reads or writes this table from the browser it will fail silently: the classic 'it saves but nothing appears'.

How to fix: If the browser needs it, add owner-scoped policies; if only the server uses it, leave as is.

22. [INFO] Supabase anon (public) key found: expected, and only safe with RLS

Where:

Why it matters: The anon key is meant to be public. Your data is protected only by Row Level Security policies, so the database checks in this report decide whether this is safe.

How to fix: Nothing to do for the key itself. Make sure every table has RLS on with correct policies.

What this scan does not cover

Back to AI App Rescue