Works with the AI Agents you already use
Security Review — OWASP 2025 + LGPD/GDPR
Audits frontend and backend code against OWASP 2025, API Top 10 and LGPD/GDPR, with fixes that won't break the app.
Free
Security Review — OWASP 2025 + LGPD/GDPR
Example session with this skill installed
Security review of our invoices feature before launch. Stack: Next.js (App Router) + Supabase. Relevant code:
// lib/supabase-client.ts (imported by client components)
export const supabase = createClient(
process.env.NEXT_PUBLIC_SUPABASE_URL!,
process.env.NEXT_PUBLIC_SUPABASE_SERVICE_ROLE_KEY!
);
// app/api/invoices/[id]/route.ts
export async function GET(req: Request, { params }: { params: { id: string } }) {
const session = await getSession();
if (!session) return new Response("Unauthorized", { status: 401 });
const { data } = await adminDb.from("invoices").select("*").eq("id", params.id).single();
return Response.json(data);
}
// app/api/profile/route.ts
export async function PATCH(req: Request) {
const session = await getSession();
const body = await req.json();
try {
const { data } = await adminDb.from("profiles").update(body).eq("id", session.user.id).select().single();
return Response.json(data);
} catch (err: any) {
return Response.json({ error: err.message, stack: err.stack }, { status: 500 });
}
}
-- supabase/migrations/20260901_invoices.sql
create table public.invoices (
id uuid primary key default gen_random_uuid(),
user_id uuid references auth.users not null,
customer_name text,
customer_tax_id text,
amount numeric
);
- Read your context and instructions
- Compiled the security review
Security review: invoices feature
Scope: the three files and the migration above (Next.js App Router + Supabase), read statically. Nothing was executed. I didn't run npm audit, didn't inspect a built bundle, and didn't test against a live environment. Those checks are listed under each finding as verification steps.
Not covered by this sample: auth provider configuration, security headers/CSP, CORS, dependencies, file upload, logging and alerting. They need their own pass before launch.
Headline: three Critical findings combine. The service-role key is shipped to the browser, the invoice endpoint returns any invoice to any logged-in user, and the table has no Row Level Security. Together they mean every invoice, including customer tax IDs, is readable by anyone who opens the app. The fixes depend on each other, so the order below matters.
Critical
1. Service-role key exposed in the browser bundle
- What's wrong:
lib/supabase-client.tsreadsNEXT_PUBLIC_SUPABASE_SERVICE_ROLE_KEYand is imported by client components. Next.js inlines everyNEXT_PUBLIC_variable into the JavaScript it ships to the browser. - Why it matters: the service-role key bypasses RLS entirely. Anyone who opens DevTools can read, modify, or delete any row in any table.
- How to fix safely: create a server-only module for the admin client (add
import "server-only", and use an env var without theNEXT_PUBLIC_prefix). Point the browser client at the
anon key. Then
rotate the service-role key in Supabase, because removing it from code doesn't remove it from bundles that were already deployed or from git history. Order matters: switching the browser to the anon key before RLS policies exist (finding 3) will either expose everything (RLS off) or break every client read (RLS on, no policies).
- How to verify: after the build, search
.next/staticforservice_roleand for the key's prefix, and expect zero hits. Every client screen still loads its data while signed in as a normal user.
2. IDOR: any logged-in user can read any invoice
- What's wrong:
GET /api/invoices/[id]checks that a session exists but queries only.eq("id", params.id)throughadminDb, which bypasses RLS. - Why it matters: user A can read user B's invoice, including
customer_nameandcustomer_tax_id, by changing the ID in the URL. - How to fix safely: filter by owner as well:
.eq("id", params.id).eq("user_id", session.user.id). Return404both when the invoice doesn't exist and when it belongs to someone else, so the response doesn't confirm that an ID exists. Select only the columns the UI needs instead of*. - How to verify: signed in as user A, request one of user B's invoice IDs and expect
404. Request one of A's own and expect200with the same body the UI uses today.
3. invoices table has no Row Level Security
- What's wrong: the migration creates
public.invoiceswithoutenable row level security. Supabase exposes tables in thepublicschema through its Data API. - Why it matters: with RLS off, anyone holding the anon key, which is public by design, can query the table directly. This bypasses the API route entirely.
- How to fix safely: take a backup, then add a new migration on a branch:
alter table public.invoices enable row level security;
create policy "owners read own invoices"
on public.invoices for select
using (auth.uid() = user_id);
Add insert, update, and delete policies only for operations the client actually performs. Apply on staging first; RLS is the change that most often makes data "disappear" for legitimate users.
- How to verify: on staging, sign in as two different users and confirm each sees only their own invoices in the app, and that a direct anon-key query returns only the caller's rows.
High
4. Mass assignment on PATCH /api/profile
- What's wrong:
update(body)writes whatever JSON the client sends. - Why it matters: if
profileshas columns such asrole,plan, oris_admin(the schema isn't in the sample), a user can send{"role":"admin"}and promote themselves. - How to fix safely: validate the body against an allow-list schema of the fields a user may edit (for example,
display_nameandavatar_url), and pass only the parsed result toupdate. - How to verify: sending an allowed field still updates the profile as before. A request carrying
roleeither leaves it unchanged or returns400.
Medium
5. Stack traces returned to the client
- What's wrong: the
catchinPATCH /api/profilereturnserr.messageanderr.stack. - Why it matters: it reveals file paths, library versions, and query details that help an attacker map the system.
- How to fix safely: return a generic
{ "error": "Something went wrong" }with a request ID, and log the details server-side withuser.id(not email or name). - How to verify: force an error on staging. The response holds only the generic message, and the server log has the full error.
6. Missing session check on PATCH /api/profile
- What's wrong:
sessionis never checked. With no session,session.user.idthrows outside thetry. - Why it matters: it fails closed by accident (an unhandled
500), not by design, and the next refactor could turn it into a fail-open. - How to fix safely: return
401when there's no session, as the GET route does. - How to verify: an unauthenticated request returns
401, and an authenticated request behaves as before.
Privacy (LGPD / GDPR)
customer_tax_id and customer_name are personal data. Before launch:
- Document the legal basis for collecting them, and keep the tax ID only if invoicing actually requires it (data minimization).
- Define a retention period.
- Make sure access and deletion requests cover this table.
If the build with the exposed service-role key was ever deployed where real users could reach it, treat that as a potential incident. Check access logs and assess, with whoever owns privacy compliance, whether LGPD/GDPR breach-notification obligations apply. This review can't determine that from the code.
Smallest first step
Find out whether the service-role key is in any deployed bundle by searching the production JS for its prefix.
- If it is, this is an active exposure, and rotating the key is the priority even though it will break the client's reads until findings 1 and 3 land. That trade-off is your call.
- If it isn't, take the safe path:
- Add the RLS policies on staging.
- Move the browser client to the anon key.
- Fix the IDOR.
- Rotate the key.
Make each of those its own branch and commit, with the two-user test after each one.
Connects securely to your tools. The creator never sees your data.
About this skill
Security Review audits an application's code, frontend and backend, and hands back a prioritized remediation plan that is safe to apply. The aim is to shrink the attack surface without changing what a legitimate user sees and without breaking production while fixing it.
What it checks, in priority order:
- Critical: secrets (including keys shipped in public-prefixed env vars), broken access control, IDOR/BOLA and Postgres/Supabase RLS, the whole injection family (SQL, XSS, NoSQL, SSTI, CSV, CRLF, GraphQL, prompt injection), password storage with current parameters (Argon2id, scrypt, bcrypt or PBKDF2).
- High: auth and session (layered rate limits, not a hard lockout anyone can abuse), crypto, security headers with a strict nonce/hash CSP, CORS and CSRF (a token or Fetch Metadata as the primary defense, with
SameSiteas defense in depth), SSRF, supply chain. - Medium: misconfiguration, error handling, file upload, API mass assignment and excessive data exposure, logging and alerting.
- Privacy and continuity: LGPD/GDPR obligations, then tested backups.
How it reports: every finding states what's wrong, why it matters, how to fix it safely, and how to verify the fix caused no regression. Access-control findings are proven by trying user B's resource as user A. The report ends with the smallest first step.
Anti-regression protocol: one fix per branch and commit, a backup before any DB change, the legitimate flow tested before and after, report-only rollout for CSP and rate limits, transparent password re-hashing on next login, staging before production, and fail closed.
Scope discipline: it fixes only the findings you approve, each in its own change, touching only the lines that finding needs. A finding outside the agreed audit scope is reported, not fixed, and the review is never used as an excuse to refactor or upgrade unrelated dependencies.
Inside: references/owasp-2025-checklist.md (the full checklist) and references/safe-remediation.md (the fix protocol and the fixes that most often break legitimate flows). The references it cites from sibling skills are vendored under shared/ so it works standalone: the PR security, scope and web checks and the PR pentest from reviewing-code, the build-time security rules and prompt-injection guardrail from developing-features, and all writing-secure-code references (client, server, browser boundary, supply chain, sources).
Triggers on: "security review", "security audit", "harden this", "is this secure?", "OWASP", "check for vulnerabilities".
Free and MIT-licensed, part of claude-skills-czl.
Source on GitHub: this skill · full repository
The output is a report; fixes are applied only for findings you approve, one change at a time. Static review cannot prove exploitability; dependency audits need registry access. Some rules point to the separate writing-secure-code skill, which is not bundled.
How to use
- 1
Connect your agent to the Agensi MCP
Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup
- 2
Sign in to Agensi
Your agent shows a sign-in link. Sign in and click Allow.
- 3
Ask for what you need
Your agent loads this skill and uses it on your task. It always asks before buying a skill.
Reviews
No reviews yet
Be one of the first to try it. Every listed skill goes through the trust checks below.
Security scanned
Checked by our 8-point scan before listing
Fresh listing
Recently published to Agensi
Free to use
No account required to browse
Trust & safety
Security scan
Security scan passed 9 days ago
- Free with an Agensi account
- Software
Git
Permissions
File Scopes
- Reads files: yes. It reads application code, migrations, config, and README/AGENTS.md, greps for secrets and risky patterns, and reads its `learnings/` folder. - Edits files: the skill's output is a report. Fixes are applied by you, or by the agent only when you ask, and only for the findings you approved, under the anti-regression protocol (one change per branch and commit, touching only the lines the finding needs, tested before and after). It may add a note under `learnings/` about a project-specific vulnerability class. - Shell commands: read-only inspection such as grep. Dependency audits (`npm`/`pnpm audit`, `pip-audit`) are part of the checklist. - Network access: not needed for the review itself. Dependency audit tools contact their package registry. - Git/GitHub: "never run git or deploy" is an explicit rule. Nothing is committed, pushed, posted, or deployed by the skill.
What's inside
Frequently Asked Questions
New in Security
Find more skills like this on the Claude Skills Marketplace, the Codex Skills Marketplace and the Gemini Skills Marketplace, or browse Claude Skills for Security.