agentleFS
Piyush8296Piyush8296/claude-workspace/.claude/skills/security-audit/SKILL.md

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
  1. Very specific:

    Never use dangerouslySetInnerHTML without DOMPurify sanitization

    line 36
  2. Very specific:

    Never use eval(), new Function(), or string-based setTimeout

    line 37
  3. Distinctive:

    Always escape user input before rendering

    line 38
  4. Distinctive:

    Use React's built-in escaping (JSX expressions auto-escape)

    line 39
  5. Very specific:

    Never expose secret keys via NEXT_PUBLIC_ or VITE_ prefixed env vars

    line 67
  6. Distinctive:

    Use backend API routes as proxies for sensitive API calls

    line 69
  7. Very specific:

    Never store tokens in localStorage or sessionStorage

    line 88
  8. Very specific:

    Run npm audit in CI — fail on critical/high

    line 107
  9. Distinctive:

    Prefer packages with >1000 weekly downloads and recent maintenance

    line 110
  10. Distinctive:

    Use Zod or similar schema validation — never hand-written regex for security

    line 159

“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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Frontend Security Audit

Threat Model for Frontend Apps

ThreatVectorImpact
XSSUser input rendered as HTML/JSSession hijack, data theft, defacement
InjectionDynamic URLs, eval(), innerHTMLCode execution, redirects
CSRFForged requests from other sitesUnauthorized actions
Secrets ExposureAPI keys in client bundleAccount compromise, billing abuse
Dependency VulnsOutdated packages with CVEsSupply chain attacks
ClickjackingIframe embeddingUI redress attacks
Open RedirectsUnvalidated redirect URLsPhishing, 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 dangerouslySetInnerHTML without DOMPurify sanitization
  • Never use eval(), new Function(), or string-based setTimeout
  • 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-escapes

2. 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_ or VITE_ 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 cookie

Rules:

  • Auth tokens in httpOnly, Secure, SameSite=Strict cookies
  • Never store tokens in localStorage or sessionStorage
  • 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/null

Rules:

  • Run npm audit in 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 safe

Integration 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

Download now (ZIP)

  • Other versions195 projects use a version of this.

    Word for word · 0

    None found.

    Edited · 0

    None found.

    Wrote their own version · 195

    1. ruvnet/claude-flow★ 80ksame name
    2. ruvnet/ruflo★ 79ksame name
    3. PostHog/posthog★ 40ksame name
    4. Donchitos/Claude-Code-Game-Studios★ 27ksame name
    5. cloudflare/security-audit-skill★ 18ksame name
    6. rommapp/romm★ 14ksame name
    7. kubeshark/kubeshark★ 12ksame name
    8. maximhq/bifrost★ 9.3ksame name
    9. mono/SkiaSharp★ 5.6ksame name
    10. 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.
    • lilangMaxSkill

      create-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

    • lilangMaxSkill

      story-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

    • nicepkgSkill

      community-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

    • nicepkgSkill

      ph-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.

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.