Prepared by: CapAIGC Security Review Subject: "TaskFlow" — demo SaaS application (Next.js 13 + Supabase) Report type: Static source-code security audit (sample report) Date: 2026-11-12 Scope: 8 source files, ~94 lines — client setup, auth library, 3 API routes, 1 component, database schema, dependency manifest
Sample report notice. This report was produced on a deliberately vulnerable demo codebase written for evaluation purposes. It is not a real client engagement. It demonstrates the exact format, evidence standard, and depth of a paid checkup: every finding below cites a real file and line, was independently re-verified by a human reviewer before inclusion, and ships with a fix prompt you can paste into your AI coding tool.
Overall risk: Critical. Security score: 17 / 100.
The application ships a full-access database key to every visitor's browser, has Row Level Security switched off on the table that stores user emails, and performs no authentication on endpoints that read profiles and accept file uploads. An unauthenticated attacker can read user PII and write files to the web root with no credentials at all. Do not deploy this code.
| Severity | Count |
|---|---|
| Critical | 3 |
| High | 5 |
| Medium | 1 |
| Low | 0 |
Fix first (in this order): C1 → C2 → C3 → H1. These four close the unauthenticated data breach and file-write paths.
lib/supabaseClient.ts:6 — process.env.NEXT_PUBLIC_SUPABASE_SERVICE_ROLE_KEY!NEXT_PUBLIC_* value into client JavaScript. The service-role key bypasses Row Level Security entirely: anyone who opens the page source can read and modify every table and storage object.NEXT_PUBLIC_ prefix), and rotate the exposed key now — treat it as compromised.profilessupabase/schema.sql:9 — alter table profiles disable row level security;profiles stores full_name and email. With RLS off, any client holding the anon key can read or write all rows — there is no per-user isolation. Combined with C1 this is full profile-data compromise.using (auth.uid() = id) for select/update; inserts restricted to the authenticated owner).app/api/upload/route.ts:10-11 — path.join(process.cwd(), "public/uploads", file.name) then writeFile(dest, bytes); the handler performs no authentication or validation.../ may escape the uploads folder (parser behaviour requires manual confirmation); HTML/SVG uploads are served same-origin and execute script in visitors' browsers.app/api/profile/route.ts:11-15 — reads userId from the query string and queries with a service-role client; no session check anywhere in the handler.GET /api/profile?userId=<any-id> returns that user's name, email, plan and signup date. IDs are enumerable/leakable; the service-role client bypasses RLS, so nothing limits the read.JWT_SECRET is unset)lib/auth.ts:3 — process.env.JWT_SECRET || "changeme-dev-secret"; lib/auth.ts:7 — jwt.sign(...) with no expiresIn; lib/auth.ts:13 — ignoreExpiration: true.JWT_SECRET is absent; use a high-entropy secret; set a short expiresIn (e.g. 1h access tokens); remove ignoreExpiration.app/api/admin/route.ts:5 — if (req.headers.get("x-admin") !== "true")curl -H 'x-admin: true' unlocks admin statistics (user counts, MRR). Any "admin" check based on request input is decoration, not authorization.components/Comment.tsx:3 — <div dangerouslySetInnerHTML={{ __html: html }} />html carries user-submitted comment content (data source requires manual confirmation — no sanitizer exists anywhere in the reviewed code), an attacker stores script that runs in every reader's browser: session theft, actions taken as the victim.supabase/schema.sql:11-15 — policy "public read" on storage.objects for bucket user-docs, and the bucket created with public = true.user-docs is world-readable to anyone with its URL. User documents are typically the most sensitive files an app holds.package.json:6,9,10 — next 13.4.19, jsonwebtoken 8.5.1, lodash 4.17.20.template) and CVE-2020-28500 (ReDoS), both fixed in 4.17.21; exploitability depends on whether untrusted input reaches those functions (requires manual confirmation). The other two packages are stale and outside their support windows.npm audit to CI; schedule upgrades for Next.js and jsonwebtoken with compatibility testing.Method: Full manual read of every in-scope file (cross-file data-flow review), followed by independent re-verification of each finding's file/line evidence by a second reviewer. AI-assisted analysis with human review of every reported item.
Not covered by a static checkup: runtime/dynamic testing of the deployed app, dependency installation and npm audit execution, Supabase project settings beyond the provided schema, environment variables and deployed secrets, middleware and code not provided, infrastructure and DNS/TLS configuration. Items that depend on runtime behaviour are labelled "requires manual confirmation" rather than reported as confirmed.
What a clean report means: no confirmed findings in the reviewed scope — never a guarantee that an application is "secure".
CapAIGC Security Review — AI-assisted, human-verified code security checkups for AI-built apps. Sample report v1, 2026-11-12.