Summary
| ID | Finding | Severity | Confidence | Location |
|---|---|---|---|---|
| H-1 | Checkout trusts the whole price object sent by the browser, so any user can give themselves a long free trial | High | Confirmed | utils/stripe/server.ts:21-23, 59, 75-76 |
| H-2 | next@14.2.3 has 38 published advisories (4 critical); Supabase libraries are also outdated | High | Confirmed (version match); exploitability needs runtime check | package.json:33, pnpm-lock.yaml:2542 |
| M-1 | The "Manage" button on the pricing page starts a second paid subscription, and the app then shows the user as unsubscribed | Medium | Confirmed | components/ui/Pricing/Pricing.tsx:189-192, utils/supabase/queries.ts:15-16 |
| M-2 | A new account inherits any existing Stripe customer with the same email (billing portal access) | Medium | Confirmed in code; exploitability needs runtime check | utils/supabase/admin.ts:141-144 |
| M-3 | The webhook returns 400 for every unhandled event while the README says "Select all events" | Medium | Confirmed (code + docs); Stripe-side effect is likely | app/api/webhooks/route.ts:90-93, README.md:77 |
| M-4 | No rate limiting or CAPTCHA on sign-up, magic-link and password-reset actions | Medium | Likely | utils/auth-helpers/server.ts:35-62, 89-108, 166-188 |
| M-5 | README recommends a wildcard auth redirect URL on *.vercel.app | Medium | Needs runtime check | README.md:50 |
| L-1 | Server-action validation doesn't stop the request (password mismatch still changes the password) | Low | Confirmed | utils/auth-helpers/server.ts:231-242 |
| L-2 | Account enumeration through sign-up and sign-in messages | Low | Confirmed (sign-up) / Likely (magic link) | utils/auth-helpers/server.ts:198-207, 58, 64-69 |
| L-3 | No security headers or CSP (there is no next.config.js at all) | Low | Confirmed in repo; what is actually served needs runtime check | repo root |
| L-4 | Users can overwrite server-managed columns on their own users row | Low | Confirmed | supabase/migrations/20230530034630_init.sql:11-17 |
| L-5 | Anyone can put arbitrary text in the site's toast messages through a URL | Low | Confirmed | components/ui/Toasts/toaster.tsx:21-33 |
| L-6 | Foreign keys to auth.users block deleting users | Low | Confirmed | init.sql:7, 40, 109 |
| L-7 | Stripe API version is unpinned (null + @ts-ignore), and the code reads fields that newer API versions removed | Low | Needs runtime check | utils/stripe/config.ts:8-9, utils/supabase/admin.ts:248-253 |
| I-1 | The service-role client has no server-only guard (it is not exposed today) | Info | Confirmed | utils/supabase/admin.ts:15-18 |
| I-2 | A SECURITY DEFINER trigger function has no fixed search_path | Info | Confirmed | init.sql:22-29 |
| I-3 | Errors are swallowed and there is no alerting path | Info | Confirmed | utils/supabase/queries.ts, utils/supabase/middleware.ts:74-82 |
Counts: Critical 0 · High 2 · Medium 5 · Low 7 · Info 3
Fix these before launch: H-1 (free trials on demand), M-1 (double billing), H-2 (framework CVEs). M-2 and M-3 should follow in the same sprint.
Severity and confidence scale
- Critical: remote compromise of data or money with no preconditions. High: direct loss of revenue or a security boundary, easy to exploit. Medium: real harm, but it needs a precondition or a specific config. Low: limited impact or a defense-in-depth gap. Info: hygiene, no current exploit.
- Confirmed: traced in the code; behavior follows from the code and well-documented platform semantics. Likely: the code path is confirmed, but the outcome depends on platform behavior not verified here. Needs runtime check: depends on deployment settings or third-party behavior that has to be tested on a real environment.
High
H-1Checkout trusts the whole price object sent by the browser, so any user can give themselves a long free trial
Severity: High. Any signed-in user can get months of paid service free, with no tooling beyond browser devtools.
Confidence: Confirmed (trial manipulation). The "any active price" part is Likely (it relies on Stripe rejecting archived prices in Checkout).
Location: utils/stripe/server.ts:21-23, 59, 75-76; caller components/ui/Pricing/Pricing.tsx:57-60; utils/helpers.ts:52-68
export async function checkoutWithStripe(price: Price, redirectPath = '/account') // server.ts:21-24 (condensed), 'use server'
price: price.id, // server.ts:59
subscription_data: {
trial_end: calculateTrialEndUnixTimestamp(price.trial_period_days) // server.ts:75-76
checkoutWithStripe is a Server Action, which makes it a public POST endpoint. The browser serializes the entire price row into the request body (Pricing.tsx:57-60). The server uses three fields from it without re-reading them from the database:
trial_period_daysbecomes the Stripetrial_end.calculateTrialEndUnixTimestamphas a lower bound (2 days) and no upper bound (helpers.ts:56-68).idbecomes the Checkout line item. It is never checked against thepricestable or foractive = true.typeselectssubscriptionorpaymentmode.
Impact: A customer can edit one number in the request and subscribe to your top plan with a trial as long as Stripe allows (Stripe caps trial length; at the time of writing the cap is about two years). They can then cancel before ever being charged. They can also buy any other active price in your Stripe account that you don't show on the pricing page, such as a grandfathered "$5 founders" price kept active for old subscribers, or a price belonging to another product on the same Stripe account. They cannot change the amount of a price, because Stripe uses the price's own amount.
Fix: Send only the price ID from the browser and load everything else on the server.
// utils/stripe/server.ts
export async function checkoutWithStripe(priceId: string, redirectPath = '/account') {
const supabase = createClient();
const { data: price } = await supabase
.from('prices').select('id, type, trial_period_days')
.eq('id', priceId).eq('active', true).maybeSingle();
if (!price) return { errorRedirect: getErrorRedirect(redirectPath, 'Invalid plan.') };
// ...build Stripe params from this server-side `price` only
}
// Pricing.tsx:57 -> checkoutWithStripe(price.id, currentPath)
For tighter control, also keep an allow-list of purchasable price IDs, and take trial length from your own server config.
H-2next@14.2.3 has 38 published advisories (4 critical); Supabase libraries are also outdated
Severity: High. The production framework has publicly known critical advisories, and attackers scan for these versions automatically.
Confidence: Confirmed that the pinned version falls inside the advisory ranges. Whether each advisory can be exploited against this app needs a runtime check; I did not reproduce any of them.
Location: package.json:33 ("next": "14.2.3", exact pin), pnpm-lock.yaml:2542; also @supabase/ssr@0.1.0, @supabase/supabase-js@2.43.4
next 14.2.3: 38 advisories (4 critical, 13 high, 17 moderate, 4 low), e.g.
GHSA-f82v-jwr5-mffw critical Authorization Bypass in Next.js Middleware (<14.2.25)
GHSA-2xp9-vwfh-vxw4 critical Unauthenticated RCE in Image Optimization API (AVIF)
GHSA-2464-fhr4-w9xw critical Unauthenticated RCE in Image Optimization API (SVG)
GHSA-7m27-7ghc-44w9 / GHSA-m99w-x7hq-7vfj / GHSA-p3m5-59mp-jv5r DoS via Server Actions
Relevance to this app:
- Middleware bypass (GHSA-f82v-jwr5-mffw): the impact is low today.
middleware.tsonly refreshes the session, and/accountchecks the user itself (app/account/page.tsx:20-22). It becomes critical the day someone adds "protect/dashboardin middleware", which is the most common next step for forks. - Server Action DoS advisories: in scope, because every auth and billing flow here is a Server Action.
- Image Optimization advisories: the app never imports
next/image, but Next.js enables the/_next/imageendpoint by default unlessimages.unoptimizedis set. Exploitability was not verified, and Vercel-hosted deployments may be shielded at the platform level where self-hosted ones are not. - The fourth critical (GHSA-p293-qw3h-jr36) applies only to Windows-hosted servers.
- Supabase:
@supabase/ssr@0.1.0pullscookie@0.5.0(GHSA-pxg6-pf52-xh8x, low), and@supabase/auth-js@2.64.2has GHSA-8r88-6cj9-9fh5 (low). Version 0.1.0 also uses the per-cookieget/set/removeAPI that later@supabase/ssrreleases deprecated in favor ofgetAll/setAll. stripe@14.25.0: no advisories.
The rest of the audit output (cross-spawn, tar, glob, minimatch, postcss, eslint, the supabase CLI and others) is build and development tooling reached through tailwindcss, eslint-config-next and the supabase dev dependency. It is worth cleaning up but is not part of the running app.
Impact: You would be launching on a framework version with publicly documented holes, some of them rated "remote code execution". Even where a given issue doesn't apply, a customer's security questionnaire or a pentest will flag it immediately.
Fix: Upgrade next to a currently supported, patched release. Several advisories, as reported, have no 14.x fix in their ranges, so plan for 15.x or later. Next 15 makes cookies() async, which touches utils/supabase/server.ts:8 and app/signin/**. Also upgrade @supabase/ssr (and migrate to the getAll/setAll cookie API), @supabase/supabase-js and stripe. Re-run pnpm audit --prod until it is clean, and turn on Dependabot or Renovate.
Medium
M-1The "Manage" button on the pricing page starts a second paid subscription, and the app then shows the user as unsubscribed
Severity: Medium. Real customers get double-billed through normal UI use, which means refunds and chargeback risk. It needs no attacker.
Confidence: Confirmed
Location: components/ui/Pricing/Pricing.tsx:189-192; utils/stripe/server.ts:21-100 (no existing-subscription check); utils/supabase/queries.ts:11-19
onClick={() => handleStripeCheckout(price)} // Pricing.tsx:189, runs for subscribed users too
{subscription ? 'Manage' : 'Subscribe'} // Pricing.tsx:192
.in('status', ['trialing', 'active']) // queries.ts:15
.maybeSingle(); // queries.ts:16, returns an error on 2+ rows (ignored)
Impact: A paying customer who clicks "Manage" on the pricing page is sent to Stripe Checkout for a new subscription. Stripe allows several subscriptions per customer, and nothing on the server blocks it. If they complete it, they are billed twice. The app then finds two active rows, maybeSingle() errors, the error is discarded, and /account says "You are not currently subscribed to any plan." The customer has paid twice and appears to have paid nothing.
Fix:
// utils/stripe/server.ts, inside checkoutWithStripe, after getUser()
const { data: existing } = await supabase.from('subscriptions')
.select('id').in('status', ['trialing', 'active', 'past_due']).limit(1);
if (existing?.length) return { errorRedirect: '/account' }; // send them to the portal instead
In Pricing.tsx, when subscription is set, call createStripePortal() instead of checkout. In getSubscription, add .order('created', { ascending: false }).limit(1) and log the error instead of dropping it.
M-2A new account inherits any existing Stripe customer with the same email (billing portal access)
Severity: Medium. It exposes another person's billing portal (invoices, address, card last-4, cancel or change plan), but it needs a precondition.
Confidence: Confirmed in code. Exploitability needs a runtime check: it depends on your Supabase "Confirm email" setting and on whether your Stripe account holds customers that this app didn't create.
Location: utils/supabase/admin.ts:141-144 (also reached from createStripePortal, utils/stripe/server.ts:139); init.sql:42; supabase/config.toml:94
// If Stripe ID is missing from Supabase, try to retrieve Stripe customer ID by email
const stripeCustomers = await stripe.customers.list({ email: email });
stripeCustomerId =
stripeCustomers.data.length > 0 ? stripeCustomers.data[0].id : undefined;
When a user has no row in customers, the first Stripe customer whose email matches theirs is adopted and saved as theirs. That user can then click "Open customer portal" on /account and gets a portal session for that customer.
Impact: This becomes an account takeover of billing when any of these hold:
- Email confirmation is off. It is off in the bundled local config (
config.toml:94 enable_confirmations = false). An attacker then signs up asvictim@company.comand opens the victim's billing portal. - The Stripe account is shared with another product, Payment Links or an older app. Indie founders often do this.
- A user changed their email. The template never updates the Stripe customer's email, so whoever registers the old address next inherits the customer.
A second effect: there is no unique constraint on customers.stripe_customer_id (init.sql:42), so two users can map to the same Stripe customer. The webhook lookup .single() (admin.ts:217-221) then fails on every event for that customer, and their subscription silently stops syncing.
Fix: Drop the email fallback. Always create a fresh Stripe customer tagged with metadata.supabaseUUID, and link legacy customers manually. Make the mapping unique and make sure "Confirm email" is on in the hosted project.
const stripeIdToInsert = existingSupabaseCustomer?.stripe_customer_id
?? await createCustomerInStripe(uuid, email);
alter table customers add constraint customers_stripe_customer_id_key unique (stripe_customer_id);
M-3The webhook returns 400 for every unhandled event while the README says "Select all events"
Severity: Medium. It can stall subscription syncing in production (people who pay don't get access, people who cancel keep it), and it buries real failures in noise.
Confidence: Confirmed for the code and docs. That Stripe eventually disables a persistently failing endpoint is Likely (Stripe-side behavior, not tested here).
Location: app/api/webhooks/route.ts:90-93, route.ts:83-87; README.md:77
} else {
return new Response(`Unsupported event type: ${event.type}`, {
status: 400
});
README.md:77: "Click Select all events in the Select events to send section."
Impact: Following the setup guide subscribes the endpoint to every Stripe event type. The code handles 10 of them and answers 400 to the rest (charges, invoices, payment intents, customer updates and so on). Stripe treats any non-2xx as a failure, retries each one for days, and sends "endpoint failing" alerts. A persistently failing endpoint risks being disabled, and once that happens subscription changes stop reaching your database. Real handler failures also return 400 (line 86), so they look the same as noise.
Fix: Acknowledge events you ignore, signal real failures with a 5xx, and subscribe the endpoint only to the 10 events in relevantEvents.
if (!relevantEvents.has(event.type)) {
return new Response(JSON.stringify({ received: true }), { status: 200 });
}
// ...in the catch block:
return new Response('Webhook handler failed', { status: 500 });
M-4No rate limiting or CAPTCHA on sign-up, magic-link and password-reset actions
Severity: Medium. One script can exhaust your project's auth-email quota and lock real users out of sign-up and password resets, and it can send email to arbitrary inboxes from your domain.
Confidence: Likely. The code has no throttling. The impact depends on your Supabase Auth rate-limit, SMTP and CAPTCHA settings.
Location: utils/auth-helpers/server.ts:35-62 (signInWithEmail), 89-108 (requestPasswordUpdate), 166-188 (signUp); also utils/stripe/server.ts:21 (checkout)
const supabase = createClient(); // server.ts:104-108
const { data, error } = await supabase.auth.resetPasswordForEmail(email, {
redirectTo: callbackURL
});
These Server Actions are unauthenticated public endpoints that trigger emails. None of them check a CAPTCHA token or apply a per-IP or per-email limit. The calls reach Supabase from your Next.js server, so Supabase's per-IP auth limits most likely see your server's IP rather than the attacker's, which makes them less useful as protection.
Impact: A bot can sign up thousands of fake addresses, use up the project-wide email allowance (very low on Supabase's built-in SMTP), and stop real customers from receiving confirmation, magic-link and reset emails. Your sending domain's reputation suffers too.
Fix: Enable Supabase Auth CAPTCHA (Cloudflare Turnstile or hCaptcha) and pass options: { captchaToken } on signUp, signInWithOtp, signInWithPassword and resetPasswordForEmail. Add an app-level limit keyed by client IP (headers().get('x-forwarded-for')) plus email, for example with @upstash/ratelimit. Use custom SMTP and review Supabase's Auth rate limits before launch.
M-5README recommends a wildcard auth redirect URL on *.vercel.app
Severity: Medium. If a third party can get a hostname that matches the wildcard, this becomes an OAuth or magic-link account takeover. That precondition is unverified, so this is not rated High.
Confidence: Needs runtime check. I did not verify whether Vercel lets another account claim a hostname matching *-<your-slug>.vercel.app.
Location: README.md:50
...add the following wildcard URL to "Redirect URLs": `https://*-username.vercel.app/**`.
Supabase uses the Redirect URLs list as the allow-list for redirect_to in OAuth and magic-link flows. If an attacker controls any host that matches the pattern, they can start a PKCE login holding their own verifier, send the victim the link, and receive the victim's auth code on their host. The code is then exchanged for the victim's session. PKCE does not help here, because the attacker started the flow.
Impact: If the precondition holds, an attacker can log in as any user who clicks one link.
Fix: Keep the production Supabase project's redirect list exact (https://yourdomain.com/**). Point preview deployments at a separate Supabase project, or serve previews from a domain you own.
Low
L-1Server-action validation doesn't stop the request (password mismatch still changes the password)
Severity: Low. It only affects the user's own account (lock-out and support load). There is no cross-user impact.
Confidence: Confirmed
Location: utils/auth-helpers/server.ts:231-242 (same pattern at 42-48, 96-102, 173-179); updateName 308-315
if (password !== passwordConfirm) {
redirectPath = getErrorRedirect(/* ...'Passwords do not match.' */); // condensed
} // no return, so execution continues
const supabase = createClient();
const { error, data } = await supabase.auth.updateUser({ password });
The form uses noValidate (UpdatePassword.tsx:28), so this server check is the only check, and it has no effect. The invalid-email checks fall through the same way. updateName enforces "64 characters maximum" only in the browser (NameForm.tsx:52).
Impact: A user who mistypes the confirmation field gets their password set to the first value anyway. The page shows "Passwords do not match", but the change has already happened, so they're locked out until they reset it.
Fix: return the error redirect immediately. Better, validate every Server Action input with a schema:
if (password !== passwordConfirm) {
return getErrorRedirect('/signin/update_password', 'Your password could not be updated.', 'Passwords do not match.');
}
L-2Account enumeration through sign-up and sign-in messages
Severity: Low. Anyone can confirm whether an email has an account, which is useful for phishing and credential stuffing.
Confidence: Confirmed for sign-up. Likely for magic link (it depends on Supabase's error text).
Location: utils/auth-helpers/server.ts:198-207; 58 + 64-69
} else if (data.user && data.user.identities && data.user.identities.length == 0) {
redirectPath = getErrorRedirect('/signin/signup', 'Sign up failed.',
'There is already an account associated with this email address. Try resetting your password.');
Supabase deliberately returns a fake user with no identities to hide existing accounts. The template turns that back into an explicit "account exists" message. Magic-link sign-in runs with shouldCreateUser = false (line 58) and shows Supabase's raw error.message for unknown emails.
Fix: Use one neutral message, such as "If this email can be used, we've sent you a link," for sign-up, magic link and reset.
L-3No security headers or CSP (there is no next.config.js at all)
Severity: Low. This is defense in depth. There is no XSS sink in the current code, but the account and password pages can be framed (clickjacking).
Confidence: Confirmed that the repo has no next.config.*, vercel.json or header middleware. What is actually served (Vercel adds HSTS by default) needs a runtime check.
Location: repository root (file absent)
Impact: There is no protection against your pages being embedded in another site, no CSP to contain a future XSS, and responses advertise X-Powered-By: Next.js.
Fix: Start with a report-only CSP, because Stripe and Supabase need allow-listed origins.
// next.config.js
module.exports = { poweredByHeader: false, async headers() { return [{ source: '/(.*)', headers: [
{ key: 'X-Frame-Options', value: 'DENY' },
{ key: 'X-Content-Type-Options', value: 'nosniff' },
{ key: 'Referrer-Policy', value: 'strict-origin-when-cross-origin' },
{ key: 'Content-Security-Policy-Report-Only', value: "default-src 'self'; script-src 'self' 'unsafe-inline' https://js.stripe.com; frame-src https://js.stripe.com https://hooks.stripe.com; connect-src 'self' https://*.supabase.co https://api.stripe.com; frame-ancestors 'none'" },
]}]; } };
L-4Users can overwrite server-managed columns on their own users row
Severity: Low. Today these columns are only displayed, but the policy is a trap for the next column you add.
Confidence: Confirmed
Location: supabase/migrations/20230530034630_init.sql:11-17 (identical in schema.sql)
billing_address jsonb,
payment_method jsonb
);
alter table users enable row level security;
create policy "Can update own user data." on users for update using (auth.uid() = id);
The update policy covers every column. With the public anon key and their own session, a user can rewrite billing_address and payment_method, which the server copies from Stripe (admin.ts:201-207). They cannot touch other users' rows.
Impact: No harm today. But the usual next step is adding plan, credits or is_admin to users, and every such column would be user-writable from the browser on day one.
Fix: Grant column-level privileges and keep entitlement data in tables users can only read.
revoke update on public.users from anon, authenticated;
grant update (full_name, avatar_url) on public.users to authenticated;
L-5Anyone can put arbitrary text in the site's toast messages through a URL
Severity: Low. It allows phishing text inside your own UI. React escapes it, so there is no script execution.
Confidence: Confirmed
Location: components/ui/Toasts/toaster.tsx:21-33
const error = searchParams.get('error');
const error_description = searchParams.get('error_description');
if (error || status) {
toast({ title: error ? error ?? '...' : status ?? 'Alright!', // condensed
description: error ? error_description : status_description,
Impact: A link like https://yourapp.com/?error=Payment+failed&error_description=Re-enter+your+card+at+evil.example shows an official-looking red alert on your real domain.
Fix: Pass short message codes in the URL and map them to fixed strings in the client. Never render free text from the URL.
L-6Foreign keys to auth.users block deleting users
Severity: Low. You can't honor account-deletion requests (GDPR, DPDP, CCPA) without manual SQL.
Confidence: Confirmed (default ON DELETE NO ACTION)
Location: init.sql:7 (users.id), :40 (customers.id), :109 (subscriptions.user_id)
id uuid references auth.users not null primary key, -- :7 and :40
user_id uuid references auth.users not null, -- :109
Impact: Deleting a user from the Supabase dashboard or Admin API fails with a database error as soon as they have a profile row, which is every user, because the trigger creates one.
Fix:
alter table users drop constraint users_id_fkey,
add constraint users_id_fkey foreign key (id) references auth.users on delete cascade;
-- same for customers_id_fkey; for subscriptions decide between cascade and keeping billing history
L-7Stripe API version is unpinned (null + @ts-ignore), and the code reads fields that newer API versions removed
Severity: Low. Sync breaks silently on an SDK upgrade or an API-version change.
Confidence: Needs runtime check. Whether null means "your account's default version" or "the SDK's built-in version" depends on stripe-node internals I could not inspect without installing it.
Location: utils/stripe/config.ts:8-9; utils/supabase/admin.ts:240, 248-253
// @ts-ignore
apiVersion: null,
manageSubscriptionStatusChange reads subscription.current_period_start/end, and also subscription.quantity (under its own @ts-ignore). Recent Stripe API versions moved the billing-period fields onto subscription items. If those fields are missing, toDateTime(undefined).toISOString() throws, every subscription webhook fails, and paying customers never get access.
Fix: Pin apiVersion to the version your installed SDK's types target, and remove the @ts-ignore. When you upgrade, read the period fields from subscription.items.data[0]. Add a test that runs a recorded customer.subscription.created payload through the handler.
Info
I-1The service-role client has no server-only guard (it is not exposed today)
Confidence: Confirmed. utils/supabase/admin.ts:15-18 creates the RLS-bypassing client. It is imported only by app/api/webhooks/route.ts:9 and the 'use server' module utils/stripe/server.ts:6, so client components get Server Action references, never the module. The variable is not NEXT_PUBLIC_-prefixed, so Next.js would not inline it into a browser bundle anyway. Fix: add import 'server-only'; to utils/supabase/admin.ts and utils/stripe/config.ts, so an accidental client import fails at build time.
I-2A SECURITY DEFINER trigger function has no fixed search_path
Confidence: Confirmed (Supabase's database linter flags this). init.sql:22-29, handle_new_user(). It is not exploitable by app users, because the table reference is schema-qualified and users cannot set the trigger session's search_path. Fix: add set search_path = '' to the function definition.
I-3Errors are swallowed and there is no alerting path
Confidence: Confirmed. queries.ts discards every error (lines 12, 22). utils/supabase/middleware.ts:74-82 catches everything and continues silently. The webhook only console.logs (route.ts:82). In production a billing failure shows up as "user looks unsubscribed", not as an alert. Fix: add error monitoring (Sentry or similar) and alerts on webhook non-2xx rates, and surface query errors.
What the template does well
- Webhook signature verification is correct. It reads the raw body (
req.text()), callsstripe.webhooks.constructEvent, and rejects requests with a missing signature or secret (app/api/webhooks/route.ts:25-38). Unsigned or forged events cannot reach the database. - Subscription state is re-fetched from Stripe, not taken from the event.
manageSubscriptionStatusChangecallsstripe.subscriptions.retrieveand upserts the result (utils/supabase/admin.ts:228-268). Duplicate, retried and out-of-order subscription events therefore converge on the true state without an event-ID table. (Product and price events do use the event payload, so an out-of-order delivery there could briefly write stale catalog data.) - RLS is on for every table, with sensible policies.
customershas RLS and no policies, so it is fully private.subscriptionslets users read only their own rows and gives them no write access. Products and prices are read-only, and Realtime is published only forproductsandprices(init.sql:15-17, 44-45, 65-66, 98-99, 137-138, 144-145). Users cannot grant themselves a subscription from the browser. - Checkout and the billing portal are bound to the server-verified user. Both derive the Stripe customer from
supabase.auth.getUser()(a server-validated token, notgetSession()), never from client input (utils/stripe/server.ts:27-48, 122-156). One user cannot open a checkout or portal session for another through these actions (M-2 is a separate data-mapping issue).success_urlgoes throughgetURL, which strips leading slashes, so it stays on your domain. - There are no open redirects in the auth callbacks, and secrets are handled sensibly.
/auth/callbackand/auth/reset_passwordredirect only to fixed paths built from the request origin, with nonext=parameter. Stripe and service-role secrets are neverNEXT_PUBLIC_, and.env*files are gitignored. The JWT in.env.local.exampleis Supabase's public local-dev demo anon key (iss: supabase-demo), not a leaked credential.
What I could not verify (needs a runtime check)
- Hosted Supabase settings: whether "Confirm email" is on, plus the Auth rate limits, CAPTCHA, SMTP and the Redirect URLs list. These decide how exploitable M-2, M-4 and M-5 are. The repo only contains the local
config.toml. - Stripe-side behavior: whether Checkout rejects archived prices (H-1, second part), the exact maximum trial length, endpoint auto-disable after repeated failures (M-3), and what
apiVersion: nullresolves to in stripe-node 14 (L-7). - Vercel: whether a third party can claim a hostname matching
*-<slug>.vercel.app(M-5), and which headers Vercel adds by default (L-3). - Next.js advisories: none were reproduced. Applicability notes in H-2 come from reading the code, not from testing.
Appendix: method
- Read every source, SQL, config and doc file in the repository at commit
bdd0813. Noinstall,build,devor repo scripts were run, and no live deployment was contacted. - Dependency audit: the repo ships only
pnpm-lock.yaml(lockfile v6), and a workingpnpmbinary wasn't available offline. A small converter (no package code executed) turned the pnpm lockfile's 455name@versionentries into an npmpackage-lock.jsonin a scratch directory. I then rannpm audit --package-lock-only --ignore-scripts --jsonthere. Result: 30 vulnerable packages (3 critical, 17 high, 6 moderate, 4 low), mostly build and dev tooling.nextalone carries 38 advisories (4 critical, 13 high, 17 moderate, 4 low). Advisory matching is by name and version, so the result is reliable for "is this version affected". The dependency-tree shape is approximate, so "which parent pulls it in" was cross-checked against the original lockfile.