security-audit-web-app
Skill14 starsChanged 8 days agoMITView on GitHub
Use when auditing a web app frontend/edge layer for common security mistakes — server vs client boundary leaks, environment variables exposed to the browser, missing security headers, unsafe redirects, dangerous HTML rendering, middleware that can be bypassed. Examples use Next.js, but checks apply to any modern web framework (Remix, SvelteKit, Astro, Laravel, Rails).
- Reads credentials
In this repository11 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- anti-ai-slopSkill
- bukti-sebelum-klaimSkill
- pakai-alat-duluSkill
- pre-deploy-3gateSkill
- secret-rotation-walkthroughSkill
- security-audit-databaseSkill
- seo-audit-multilocaleSkill
- seo-content-auditSkill
- tanya-seperlunyaSkill
- voice-register-checkSkill
The file
We split this skill into the rules it gives an agent
6 rules. About 0 are common, 2 are distinctive, and 4 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
4
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 20
Check .env.example is committed but .env* (real values) is in .gitignore.
- Very specific: line 49
Check for any use of eval(), new Function(), setTimeout(string) — these run arbitrary strings as code.
- Very specific: line 65
Read the middleware config (middleware.ts for Next.js, equivalent for other frameworks).
- Distinctive: line 89
Read actual files. Cite file path + line number.
- Distinctive: line 91
If a check doesn't apply (no middleware in the framework, etc) — say "N/A: [reason]" rather than fake passing it.
- Very specific: line 92
Don't blanket-recommend tools (Helmet.js, etc) — recommend the specific config change for the actual codebase.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Security audit — web app layer
You're auditing a web app's frontend/edge for the 6 most common web security mistakes that lead to real incidents. Examples use Next.js. The same concepts apply to any modern framework — only the function names change.
The 6 checks
1. Environment variables leaked to the browser
What goes wrong: a secret meant for server use only ends up in the JavaScript bundle. Anyone viewing the page source or network tab can read it.
What to check:
- List every environment variable used in the codebase. Grep for
process.env.(Node.js / Next.js) or your framework's equivalent. - For Next.js: any variable that starts with
NEXT_PUBLIC_is shipped to the browser. Verify nothing sensitive uses that prefix (no API keys, no service-role keys, no signing secrets). - For other frameworks: check the framework's rule for which variables get bundled (Vite uses
VITE_, etc). - Check
.env.exampleis committed but.env*(real values) is in.gitignore.
2. Server-only code accidentally included in client bundle
What goes wrong: code with database access, secrets, or sensitive logic gets imported by a client component → bundled into browser.
What to check:
- Files using server-only secrets: which files import them? Trace the import chain.
- Any client-side file (marked
'use client', or inpages/non-api/, or incomponents/without server marker) that imports a server-only module = leak. - For Next.js: server actions (
'use server') called from clients are OK. Server modules imported by clients are NOT OK.
3. Security headers missing or misconfigured
What goes wrong: missing Content-Security-Policy, X-Frame-Options, X-Content-Type-Options → XSS attacks succeed, clickjacking works, MIME-sniffing happens.
What to check:
- For Next.js: read
next.config.mjs/next.config.js. Look forheaders()function returning security headers. - For a reverse proxy / CDN (Nginx, Caddy, Traefik, your CDN rules): check headers set there too, they can override the app.
- For other frameworks: equivalent middleware/config file.
- Required headers:
Content-Security-Policy(nounsafe-evalin production),X-Frame-Options: DENYorSAMEORIGIN,X-Content-Type-Options: nosniff,Referrer-Policy,Strict-Transport-Securityfor HTTPS. - Bonus:
poweredByHeader: falsefor Next.js (don't advertise framework version).
4. Unsafe HTML rendering
What goes wrong: user input rendered as HTML → script injection runs in other users' browsers.
What to check:
- Grep for
dangerouslySetInnerHTML(React) orv-html(Vue) or equivalent. - For each match: where does the content come from? If user input or external API, it must be sanitized first (e.g. via DOMPurify) — note in audit if not.
- Check for any use of
eval(),new Function(),setTimeout(string)— these run arbitrary strings as code.
5. Unsafe redirect / open redirect
What goes wrong: user-supplied URL used in a redirect → attacker redirects users to phishing site that looks like yours.
What to check:
- Grep for
redirect(,Response.redirect, or framework equivalent — any case where the destination URL comes from user input (query param, form field, request body). - For each: is the URL validated? Allowed-list of internal paths only, OR explicit check that protocol is
https://and host matches your domain. javascript:,data:,vbscript:URLs inhrefattributes — should be blocked.
6. Middleware bypass / route-level guard miss
What goes wrong: middleware checks auth on most routes — but one route slips past because of pattern mismatch, or middleware is skipped for static files, or a new route is added without updating middleware.
What to check:
- Read the middleware config (
middleware.tsfor Next.js, equivalent for other frameworks). What does it match? What does it exclude? - List every protected route. For each, verify either: (a) middleware covers it, OR (b) the route file itself has a server-side auth check.
- Common pitfalls: middleware excludes
/_next/,/api/,/static/— ensure no protected routes accidentally land in those. - Recommend: don't rely on middleware alone for auth — always have a server-side check inside the route handler too. Defense in depth.
How to deliver the report
# Web app security audit — [project name]
## Critical (fix before next deploy)
1. [issue] — Evidence: [file:line]. Why critical: [reason]. Fix: [concrete step].
## Warnings (fix soon)
[same format]
## Verified clean
- [check name]End with: "Critical: [N], warnings: [N]. Mau gue bantu fix nomor 1 dulu, atau lo review dulu?"
Constraints
- Read actual files. Cite file path + line number.
- One concrete fix per issue.
- If a check doesn't apply (no middleware in the framework, etc) — say "N/A: [reason]" rather than fake passing it.
- Don't blanket-recommend tools (Helmet.js, etc) — recommend the specific config change for the actual codebase.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

