security-audit
Skill2 starsChanged 6 months agoMITView on GitHub
Frontend security audit covering XSS, injection, CSRF, secrets scanning, CSP headers, dependency vulnerabilities, and authentication patterns. Use when reviewing security, before launch, or when handling user input.
- Reads credentials
We split this skill into the rules it gives an agent
10 rules. 0 are common, 5 are distinctive, and 5 are very specific to this project.
0
Common
Most of the 174 edited versions we read keep these.
5
Distinctive
This author's own choices. Worth a look.
5
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 36
Never use dangerouslySetInnerHTML without DOMPurify sanitization
- Very specific: line 37
Never use eval(), new Function(), or string-based setTimeout
- Distinctive: line 38
Always escape user input before rendering
- Distinctive: line 39
Use React's built-in escaping (JSX expressions auto-escape)
- Very specific: line 67
Never expose secret keys via NEXT_PUBLIC_ or VITE_ prefixed env vars
- Distinctive: line 69
Use backend API routes as proxies for sensitive API calls
- Very specific: line 88
Never store tokens in localStorage or sessionStorage
- Very specific: line 107
Run npm audit in CI — fail on critical/high
- Distinctive: line 110
Prefer packages with >1000 weekly downloads and recent maintenance
- Distinctive: line 159
Use Zod or similar schema validation — never hand-written regex for security
“Common” is measured: kept by at least 6 in 10 of the 174 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Frontend Security Audit
Threat Model for Frontend Apps
| Threat | Vector | Impact |
| XSS | User input rendered as HTML/JS | Session hijack, data theft, defacement |
| Injection | Dynamic URLs, eval(), innerHTML | Code execution, redirects |
| CSRF | Forged requests from other sites | Unauthorized actions |
| Secrets Exposure | API keys in client bundle | Account compromise, billing abuse |
| Dependency Vulns | Outdated packages with CVEs | Supply chain attacks |
| Clickjacking | Iframe embedding | UI redress attacks |
| Open Redirects | Unvalidated redirect URLs | Phishing, credential theft |
Audit Checklist
1. XSS Prevention
# Find dangerouslySetInnerHTML usage
grep -rn 'dangerouslySetInnerHTML' src/ --include='*.tsx' --include='*.jsx'
# Find direct DOM manipulation
grep -rn 'innerHTML\|outerHTML\|document\.write' src/ --include='*.ts' --include='*.tsx'
# Find eval and dynamic code execution
grep -rn 'eval(\|new Function(\|setTimeout.*string' src/ --include='*.ts' --include='*.tsx'Rules:
- Never use
dangerouslySetInnerHTMLwithout DOMPurify sanitization - Never use
eval(),new Function(), or string-basedsetTimeout - Always escape user input before rendering
- Use React's built-in escaping (JSX expressions auto-escape)
// BAD: direct HTML injection
<div dangerouslySetInnerHTML={{ __html: userInput }} />
// GOOD: sanitized
import DOMPurify from 'dompurify';
<div dangerouslySetInnerHTML={{ __html: DOMPurify.sanitize(userInput) }} />
// BEST: avoid entirely, use structured data
<div>{userInput}</div> // React auto-escapes2. Secrets & API Keys
# Scan for hardcoded secrets
grep -rn 'sk_live\|pk_live\|AKIA\|ghp_\|password\s*=\|secret\s*=' src/ --include='*.ts' --include='*.tsx' --include='*.js'
# Check for secrets in client-accessible env vars
grep -rn 'NEXT_PUBLIC_.*SECRET\|NEXT_PUBLIC_.*KEY\|VITE_.*SECRET' .env* 2>/dev/null
# Check if .env is gitignored
grep -q '.env' .gitignore || echo "WARNING: .env not in .gitignore"Rules:
- Never expose secret keys via
NEXT_PUBLIC_orVITE_prefixed env vars - API keys that must be client-side should be restricted by domain/IP in the provider dashboard
- Use backend API routes as proxies for sensitive API calls
- Rotate any key that was ever committed to git history
3. Authentication & Authorization
// Token storage: NEVER localStorage for auth tokens
// BAD
localStorage.setItem('token', jwt);
// GOOD: httpOnly cookie (set by server)
// The token never touches JavaScript
// If you MUST use client storage:
// Use short-lived tokens + refresh via httpOnly cookieRules:
- Auth tokens in
httpOnly,Secure,SameSite=Strictcookies - Never store tokens in
localStorageorsessionStorage - Implement token refresh with short expiry (15 min access, 7 day refresh)
- Validate authorization on every API route, not just the frontend
- Logout must invalidate server-side session, not just clear client state
4. Dependency Security
# Audit for known vulnerabilities
npm audit 2>/dev/null || pnpm audit 2>/dev/null
# Check for outdated packages
npm outdated 2>/dev/null | head -20
# Find packages with no maintenance
npx is-website-vulnerable 2>/dev/nullRules:
- Run
npm auditin CI — fail on critical/high - Pin exact versions in
package.json(no^for security-critical deps) - Review dependency changelogs before major upgrades
- Prefer packages with >1000 weekly downloads and recent maintenance
5. Content Security Policy (CSP)
// next.config.js — example CSP header
const securityHeaders = [
{
key: 'Content-Security-Policy',
value: [
"default-src 'self'",
"script-src 'self' 'unsafe-inline'", // Tighten in production
"style-src 'self' 'unsafe-inline'",
"img-src 'self' data: https:",
"font-src 'self'",
"connect-src 'self' https://api.yourapp.com",
"frame-ancestors 'none'", // Prevent clickjacking
].join('; '),
},
{ key: 'X-Frame-Options', value: 'DENY' },
{ key: 'X-Content-Type-Options', value: 'nosniff' },
{ key: 'Referrer-Policy', value: 'strict-origin-when-cross-origin' },
{ key: 'Permissions-Policy', value: 'camera=(), microphone=(), geolocation=()' },
];6. Input Validation
import { z } from 'zod';
// Validate ALL user input at the boundary
const loginSchema = z.object({
email: z.string().email().max(254),
password: z.string().min(8).max(128),
});
// In your form handler
const result = loginSchema.safeParse(formData);
if (!result.success) {
// Show validation errors, don't send to API
return;
}
// Only send validated data
await api.login(result.data);Rules:
- Validate on client (UX) AND server (security)
- Use Zod or similar schema validation — never hand-written regex for security
- Limit string lengths to prevent DoS
- Sanitize file uploads: check MIME type, extension, and size
7. URL & Redirect Safety
// BAD: open redirect
const redirectUrl = searchParams.get('redirect');
window.location.href = redirectUrl; // Attacker: ?redirect=https://evil.com
// GOOD: allowlist validation
const ALLOWED_ORIGINS = ['https://yourapp.com', 'https://staging.yourapp.com'];
const redirectUrl = searchParams.get('redirect') ?? '/';
const isAllowed = ALLOWED_ORIGINS.some(origin => redirectUrl.startsWith(origin))
|| redirectUrl.startsWith('/');
if (isAllowed) {
router.push(redirectUrl);
} else {
router.push('/');
}Report Format
## Security Audit Summary
**Risk Level**: CRITICAL / HIGH / MEDIUM / LOW
**Score**: X/10
### Critical (act now)
- [file:line] Issue — Impact — Fix
### High (fix before launch)
- [file:line] Issue — Impact — Fix
### Medium (address soon)
- [file:line] Issue — Impact — Fix
### Passed Checks
- [check name] — confirmed safeIntegration with Other Skills
- react-patterns: Secure component patterns
- state-management: Secure token/auth state handling
- testing-strategy: Security-focused test cases
- systematic-debugging: Investigating security incidents
Other versions195 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 195
- ruvnet/claude-flow★ 80ksame name
- ruvnet/ruflo★ 79ksame name
- PostHog/posthog★ 40ksame name
- Donchitos/Claude-Code-Game-Studios★ 27ksame name
- cloudflare/security-audit-skill★ 18ksame name
- rommapp/romm★ 14ksame name
- kubeshark/kubeshark★ 12ksame name
- maximhq/bifrost★ 9.3ksame name
- mono/SkiaSharp★ 5.6ksame name
- MaxMiksa/Auto-Company★ 3.2ksame name
185 more not listed
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
Used alongsideProjects with it also use create-stories, story-done and 10 more.
Other files people use alongside this one.
Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
lilangMaxSkillcreate-stories
Break a single epic into implementable story files. Reads the epic, its GDD, governing ADRs, and control manifest. Each story embeds its GDD requirement TR-ID, ADR guidance, acceptance criteria, story type, and test evidence path. Run after /create-epics for each epic.
Also in 11 projects that use this
lilangMaxSkillstory-done
End-of-story completion review. Reads the story file, verifies each acceptance criterion against the implementation, checks for GDD/ADR deviations, prompts code review, updates story status to Complete, and surfaces the next ready story from the sprint.
Also in 11 projects that use this
nicepkgSkillcommunity-led-growth
Expert in community-led growth (CLG) - leveraging user communities to drive acquisition, retention, and expansion. Covers building developer communities, user groups, ambassador programs, and turning customers into advocates. Knows the difference between community as a feature vs community as a growth engine, and how to measure community ROI. Use when "community-led, CLG, ambassador program, champion program, user community, developer community, word of mouth, user group, " mentioned.
Also in 5 projects that use this
nicepkgSkillph-community-outreach
Engage Reddit, Indie Hackers, Hacker News and other communities for Product Hunt launches. Use this skill to identify relevant communities, craft appropriate posts, and drive cross-platform engagement without appearing spammy.
Also in 5 projects that use this
- +8 more from lilangMax
In this repository18 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- accessibilitySkill
- api-layerSkill
- auth-patternsSkill
- core-web-vitalsSkill
- css-architectureSkill
- design-intelligenceSkill
- error-handlingSkill
- frontend-designSkill
- i18nSkill
- monorepo-patternsSkill
- performance-optimizationSkill
- react-patternsSkill
- seo-fundamentalsSkill
- state-managementSkill
- structured-dataSkill
- systematic-debuggingSkill
- testing-strategySkill
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.

