/vibe:ghcopilot-instr-security-and-owaspfrom vibe
Enforces OWASP Top 10 2025 secure coding standards with 55+ anti-patterns, detection regex, and framework-specific fixes. Use when writing or reviewing security-critical code.
Ships in vibe. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Comprehensive security rules for web application development. Every anti-pattern includes a severity classification, detection method, OWASP 2025 reference, and corrective code examples.
Severity levels:
| # | Category | Key Mitigation |
|---|---|---|
| A01 | Broken Access Control | Auth middleware on every endpoint, RBAC, ownership checks |
| A02 | Security Misconfiguration | Security headers, no debug in prod, no default credentials |
| A03 | Software Supply Chain Failures (NEW) | npm audit, lockfile integrity, SBOM, SLSA provenance |
| A04 | Cryptographic Failures | Argon2id/bcrypt for passwords, TLS everywhere, no secrets in code |
| A05 | Injection | Parameterized queries, input validation, no raw HTML with user input |
| A06 | Insecure Design | Threat modeling, secure design patterns, abuse case testing |
| A07 | Authentication Failures | Rate-limit login, secure session management, MFA |
| A08 | Software or Data Integrity Failures | SRI for CDN scripts, signed artifacts, no insecure deserialization |
| A09 | Security Logging and Alerting Failures | Log security events, no PII in logs, correlation IDs, active alerting |
| A10 | Mishandling of Exceptional Conditions (NEW) | Handle all errors, no stack traces in prod, fail-secure |
\$\{.*\}.*(?:SELECT|INSERT|UPDATE|DELETE|FROM|WHERE)// BAD
const unsafeResult = await db.query(`SELECT * FROM users WHERE id = ${userId}`);
// GOOD — parameterized query
const safeResult = await db.query('SELECT * FROM users WHERE id = $1', [userId]);
\{\s*\$(?:gt|gte|lt|lte|ne|in|nin|regex|where|exists)// BAD — attacker sends { "password": { "$gt": "" } }
const user = await User.findOne({ username: req.body.username, password: req.body.password });
// GOOD — validate and cast input types
const username = String(req.body.username);
const password = String(req.body.password);
const user = await User.findOne({ username });
const valid = user && await verifyPassword(user.passwordHash, password);
(?:exec|execSync|execFile|execFileSync)\s*\(.*(?:req\.|params\.|query\.|body\.)// BAD — shell interpolation, sync call blocks the event loop
import { execFileSync } from 'node:child_process';
const unsafeOutput = execFileSync('sh', ['-c', `ls -la ${req.query.dir}`]);
// GOOD — async execFile, arguments array, no shell, bounded time/output
import { execFile } from 'node:child_process';
import { promisify } from 'node:util';
const pExecFile = promisify(execFile);
const dir = String(req.query.dir ?? '');
if (!dir || dir.startsWith('-')) throw new Error('Invalid directory');
const { stdout: safeOutput } = await pExecFile('ls', ['-la', '--', dir], {
timeout: 5_000, // fail fast on hung processes
maxBuffer: 1 << 20, // 1 MiB cap to prevent memory exhaustion
});
// BEST — allowlist validation on top of the async, bounded call above
const allowedDirs = ['/data', '/public'];
if (!allowedDirs.includes(dir)) throw new Error('Invalid directory');
Prefer async execFile/spawn over execFileSync in server handlers: the sync variant blocks Node's event loop and can amplify DoS impact. Always pass a timeout and maxBuffer to bound execution.
(?:v-html|\[innerHTML\]|dangerouslySetInner|bypassSecurityTrust)Applies to all frontend frameworks. Each has an API that bypasses default XSS protection:
dangerouslySetInnerHTML prop with raw user content[innerHTML] binding or bypassSecurityTrustHtml with unsanitized inputv-html directive with user-controlled content// GOOD — sanitize with DOMPurify before rendering any raw HTML
import DOMPurify from 'dompurify';
const clean = DOMPurify.sanitize(userContent);
// BEST — use text interpolation when HTML is not needed
// React: {userContent}
// Angular: {{ userContent }}
// Vue: {{ userContent }}
fetch\((?:req\.|params\.|query\.|body\.|url|href)// BAD
const data = await fetch(req.body.url);
// GOOD — scheme allowlist + hostname allowlist + DNS/IP validation (see TOCTOU note)
import { promises as dns } from 'node:dns';
function isPrivateIP(ip: string): boolean {
// Normalize IPv4-mapped IPv6 (e.g., ::ffff:127.0.0.1 → 127.0.0.1)
const normalized = ip.startsWith('::ffff:') ? ip.slice(7) : ip;
// IPv4 private/reserved/loopback ranges
if (/^(10\.|172\.(1[6-9]|2\d|3[01])\.|192\.168\.|127\.|0\.|169\.254\.)/.test(normalized)) return true;
// IPv6 loopback, link-local (fe80::/10), and unique-local
if (/^(::1|fe[89ab]|fc|fd)/i.test(normalized)) return true;
return false;
}
const parsed = new URL(req.body.url);
if (parsed.protocol !== 'https:') throw new Error('Only HTTPS allowed');
const allowedHosts = ['api.example.com', 'cdn.example.com'];
if (!allowedHosts.includes(parsed.hostname)) throw new Error('Host not allowed');
// Resolve all A/AAAA records to prevent DNS rebinding via multiple IPs
const resolved = await dns.lookup(parsed.hostname, { all: true });
if (resolved.length === 0 || resolved.some(({ address }) => isPrivateIP(address))) {
throw new Error('Private or reserved IPs not allowed');
}
// Note: for production, pin the resolved IP in the HTTP client to prevent
// TOCTOU rebinding between this check and fetch(). See undici Agent docs.
const data = await fetch(parsed.toString(), { redirect: 'error' });
(?:readFile|readFileSync|createReadStream|path\.join)\s*\(.*(?:req\.|params\.|query\.|body\.)// BAD
const file = fs.readFileSync(`/data/${req.params.filename}`);
// GOOD — resolve and validate within allowed directory
import path from 'path';
const basePath = '/data';
const filePath = path.resolve(basePath, req.params.filename);
if (!filePath.startsWith(basePath + path.sep)) throw new Error('Path traversal detected');
const file = fs.readFileSync(filePath);
(?:render|compile|template)\s*\(.*(?:req\.|params\.|query\.|body\.)// BAD — user input as template source
const html = ejs.render(req.body.template, data);
// GOOD — predefined templates, user input only as data
const html = ejs.renderFile('./templates/page.ejs', { content: req.body.content });
(?:parseXml|DOMParser|xml2js|libxmljs).*(?:req\.|body\.|file)// GOOD — disable external entities in XML parser
import { XMLParser } from 'fast-xml-parser';
const parser = new XMLParser({
allowBooleanAttributes: true,
processEntities: false,
htmlEntities: false,
});
const result = parser.parse(req.body.xml);
jwt\.verify\((?![^)]*\balgorithms\b)[^)]*\)// BAD — accepts any algorithm including "none"
const decoded = jwt.verify(token, secret);
// GOOD — enforce specific algorithm
const decoded = jwt.verify(token, publicKey, { algorithms: ['RS256'] });
jwt\.sign\((?![^)]*\b(?:expiresIn|exp)\b)[^)]*\)// BAD — token never expires
const token = jwt.sign({ userId: user.id }, secret);
// GOOD — short-lived token
const token = jwt.sign({ userId: user.id }, secret, { expiresIn: '15m' });
localStorage\.setItem\(.*(?:token|jwt|auth|session)// BAD — accessible via XSS
localStorage.setItem('accessToken', token);
// GOOD — httpOnly cookie set by server
res.cookie('token', token, { httpOnly: true, secure: true, sameSite: 'strict' });
(?:createHash|md5|sha1|sha256)\s*\(.*password// BAD — fast hash, no salt
const sha256Hash = crypto.createHash('sha256').update(password).digest('hex');
// GOOD — Argon2id (OWASP recommended)
import { hash as argon2Hash, argon2id } from 'argon2';
const hashed = await argon2Hash(password, { type: argon2id, memoryCost: 65536, timeCost: 3 });
(?:post|router\.post)\s*\(\s*['"]\/(?:login|signin|auth|register|reset)// BAD — no rate limiting
app.post('/api/auth/login', loginHandler);
// GOOD
import rateLimit from 'express-rate-limit';
const authLimiter = rateLimit({ windowMs: 15 * 60 * 1000, max: 5 });
app.post('/api/auth/login', authLimiter, loginHandler);
(?:session|req\.session)\s*\.\s*(?:userId|user|authenticated)\s*=// GOOD — regenerate session ID on successful login to prevent fixation
req.session.regenerate((err) => {
if (err) return next(err);
req.session.userId = user.id;
req.session.save(next);
});
Related: on password change or elevation, also invalidate all other active sessions for the user (e.g., by bumping a tokenVersion column and rejecting sessions with a stale version, or by iterating the session store and destroying entries keyed to that user).
authorize\?(?![^\n#]*\bstate=)[^\n#]*// GOOD — include state parameter for CSRF protection
const state = crypto.randomBytes(32).toString('hex');
session.oauthState = state;
const authUrl = `https://provider.com/authorize?client_id=${clientId}&redirect_uri=${redirectUri}&state=${state}`;
(?:authorization_code|code).*(?!.*code_challenge)Use PKCE (Proof Key for Code Exchange) with S256 challenge method for all public clients (SPAs, mobile).
(?:app|router)\.\w+\s*\(\s*['"]\/api\/(?:admin|users|settings)// BAD
router.delete('/api/users/:id', deleteUser);
// GOOD
router.delete('/api/users/:id', authenticate, authorize('admin'), deleteUser);
Frontend guards are UX only. ALWAYS verify on server.
params\.(?:id|userId|orderId) without ownership check// GOOD — verify ownership
router.get('/api/orders/:orderId', authenticate, async (req, res) => {
const order = await Order.findById(req.params.orderId);
if (!order || order.userId !== req.user.id) {
return res.status(404).json({ error: 'Not found' });
}
res.json(order);
});
(?:create|update|findOneAndUpdate)\s*\(\s*req\.body\s*\)// BAD
await User.findByIdAndUpdate(id, req.body);
// GOOD — explicitly pick allowed fields
const { name, email, avatar } = req.body;
await User.findByIdAndUpdate(id, { name, email, avatar });
req\.body\.role|req\.body\.isAdmin|req\.body\.permissions// GOOD — ignore role from input
const { name, email, password } = req.body;
const user = await User.create({ name, email, password, role: 'user' });
(?:delete|destroy|remove).*(?:account|user|organization) without re-authRequire current password before account deletion, email change, or other sensitive operations.
(?:password|secret|api_key|token|apiKey)\s*[:=]\s*['"][A-Za-z0-9+/=]{8,}['"]// BAD
const API_KEY = 'sk_live_abc123def456';
// GOOD
const API_KEY = process.env.API_KEY;
git ls-files .env (should return empty)# .gitignore
.env
.env.local
.env.*.local
*.pem
*.key
NEXT_PUBLIC_.*(?:SECRET|PRIVATE|PASSWORD|KEY(?!.*PUBLIC))# BAD
NEXT_PUBLIC_DATABASE_URL=postgresql://...
# GOOD
DATABASE_URL=postgresql://...
NEXT_PUBLIC_API_URL=https://api.example.com
Angular: do not put secrets in environment.ts files bundled into the client.
(?:admin|root|default|test).*(?:password|pass|pwd)\s*[:=]\s*['"](?:admin|root|password|1234|test)Use environment variables with validation (zod schema).
(?:echo|console\.log|print).*(?:\$SECRET|\$TOKEN|\$PASSWORD|process\.env)Use masked secrets in CI. Never echo environment variables containing secrets.
(?:stack|trace|query|sql).*(?:res\.json|res\.send|c\.JSON)// GOOD — generic error to client, details only in logs
app.use((err, req, res, _next) => {
logger.error({ err, path: req.path, method: req.method });
const isDev = process.env.NODE_ENV === 'development';
res.status(500).json({
error: 'Internal Server Error',
...(isDev && { message: err.message }),
});
});
Content-Security-Policy headerContent-Security-Policy.*(?:'unsafe-inline'|'unsafe-eval')Use nonce-based CSP: script-src 'self' 'nonce-{SERVER_GENERATED}'
Strict-Transport-Security headerValue: max-age=31536000; includeSubDomains; preload
X-Content-Type-Options: nosniffX-Frame-Options headerValue: DENY. Also set Content-Security-Policy: frame-ancestors 'none'.
Referrer-Policy.*(?:unsafe-url|no-referrer-when-downgrade)Use: strict-origin-when-cross-origin
Permissions-Policy headerValue: camera=(), microphone=(), geolocation=(), payment=()
(?:cors|Access-Control-Allow-Origin).*\*// GOOD
app.use(cors({
origin: ['https://app.example.com', 'https://staging.example.com'],
credentials: true,
}));
(?:innerHTML|v-html|dangerouslySetInner) without DOMPurifyAlways sanitize with DOMPurify before rendering user-controlled HTML. See I4.
eval\s*\(Use structured data parsers (JSON.parse) instead.
addEventListener\s*\(\s*['"]message['"].*(?!.*origin)window.addEventListener('message', (event) => {
if (event.origin !== 'https://trusted.example.com') return;
processData(event.data);
});
(?:__proto__|constructor\.prototype|Object\.assign)\s*.*(?:req\.|body\.|query\.)Validate and filter keys from user input before merging into objects.
(?:window\.location|location\.href|router\.push)\s*=\s*(?:req\.|params\.|query\.)// GOOD — relative paths only
const redirect = new URLSearchParams(window.location.search).get('redirect');
if (redirect?.startsWith('/') && !redirect.startsWith('//')) {
window.location.href = redirect;
}
localStorage\.setItem\(.*(?:token|session|credit|ssn|password)Use httpOnly cookies for tokens.
Use double-submit cookie or synchronizer token. Next.js Server Actions have built-in CSRF via Origin header.
ALWAYS validate on server too. Use zod, joi, or class-validator.
npm audit --audit-level=high exits non-zeronpm ci fails"postinstall" in new dependency's package.json":\s*["']\*["']|":\s*["']latest["']new ApolloServer without depth/complexity limitsimport depthLimit from 'graphql-depth-limit';
const server = new ApolloServer({
schema,
validationRules: [depthLimit(5)],
introspection: process.env.NODE_ENV !== 'production',
});
multer|formidable|busboy without type/size checksconst upload = multer({
dest: 'uploads/',
limits: { fileSize: 5 * 1024 * 1024 },
fileFilter: (req, file, cb) => {
const allowed = ['image/jpeg', 'image/png', 'image/webp'];
cb(null, allowed.includes(file.mimetype));
},
});
Always verify webhook signatures (Stripe, GitHub HMAC, etc.).
(?:stack|trace|query|sql).*(?:res\.json|res\.send)express\.json\(\) without limitapp.use(express.json({ limit: '100kb' }));
// BAD — user input directly in prompt
const response = await llm.complete(`Summarize this: ${userInput}`);
// GOOD — structured input with system/user message separation
const response = await llm.complete({
system: "You are a summarization assistant. Only summarize the provided text.",
user: userInput,
});
db.query(), exec(), or template literals without validationNever trust LLM output as safe. Treat it as untrusted user input — parameterize queries, escape shell arguments, sanitize HTML before rendering.
Validate LLM output against expected schemas (Zod, JSON Schema) before using in application logic. Reject responses that don't match expected structure.
Log: auth failures, access denied, rate limit hits, input validation failures, password changes.
(?:log|logger)\.\w+\(.*(?:password|token|secret|ssn|credit)import pino from 'pino';
const logger = pino({ redact: ['req.headers.authorization', 'req.body.password'] });
console\.log\(.*\+.*(?:req\.|user\.|body\.)Use structured logging (JSON, auto-escaped) instead of string concatenation.
'use server' function without auth() or session check'use server';
import { auth } from '@/auth';
export async function deleteUser(id: string) {
const session = await auth();
if (!session?.user || session.user.role !== 'admin') throw new Error('Unauthorized');
await db.user.delete({ where: { id } });
}
'use client' file accessing process.env without NEXT_PUBLIC_Pick only needed fields before passing DB objects to Client Components.
config.matcher not covering /api/bypassSecurityTrust(?:Html|Script|Style|Url|ResourceUrl)Sanitize with DOMPurify BEFORE calling bypassSecurityTrust.
Do not use JitCompilerFactory with user-controlled templates.
Use a centralized HttpInterceptorFn for auth tokens.
import helmet from 'helmet';
app.use(helmet());
app.disable('x-powered-by');
app.use(express.json({ limit: '100kb' }));
res.cookie('session', value, {
httpOnly: true, secure: true, sameSite: 'strict', maxAge: 3600000, path: '/',
});
Only expose error details in development mode.
math/rand import in security-related filesUse crypto/rand for cryptographically secure random values.
InsecureSkipVerify:\s*trueUse system CA pool (default) instead.
fmt\.Sprintf\s*\(.*(?:SELECT|INSERT|UPDATE|DELETE|FROM|WHERE)// GOOD — parameterized
db.Where("id = ?", userID).Find(&user)
import helmet from 'helmet';
app.use(helmet({
contentSecurityPolicy: {
directives: {
defaultSrc: ["'self'"],
scriptSrc: ["'self'"],
styleSrc: ["'self'"],
imgSrc: ["'self'", "data:", "https:"],
fontSrc: ["'self'"],
connectSrc: ["'self'"],
frameAncestors: ["'none'"],
objectSrc: ["'none'"],
baseUri: ["'self'"],
formAction: ["'self'"],
upgradeInsecureRequests: [],
},
},
hsts: { maxAge: 31536000, includeSubDomains: true, preload: true },
frameguard: { action: 'deny' },
referrerPolicy: { policy: 'strict-origin-when-cross-origin' },
crossOriginOpenerPolicy: { policy: 'same-origin' },
crossOriginResourcePolicy: { policy: 'same-origin' },
}));
app.disable('x-powered-by');
alg: nonealgorithms: ['RS256'] or ['ES256']exp — reject expired tokensiat — reject tokens issued too far in the pastaud — reject tokens not intended for this serviceiss — reject tokens from unknown issuersSet-Cookie: session=value; HttpOnly; Secure; SameSite=Strict; Path=/; Max-Age=3600
| Flag | Purpose | When to use |
|---|---|---|
HttpOnly | Not accessible via JavaScript (prevents XSS token theft) | Always |
Secure | Only sent over HTTPS | Always |
SameSite=Strict | Only sent on same-site requests (strongest CSRF) | Auth/session cookies |
SameSite=Lax | Sent on top-level navigations (moderate CSRF) | Cookies that need cross-site top-level nav (e.g., OAuth return) |
Path=/ | Limit cookie scope | Always |
Max-Age | Explicit expiration (prefer over Expires) | Always |
.env files in .gitignorenpm audit (or equivalent) passing in CInpm ciWhat SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
owasp, secure-coding, anti-patterns, code-review, security-standards
npx claudepluginhub anubhavg-icpl/vibe --plugin vibe5,304 skills in this plugin
/3d-pipelineChoose a 3D generation or reconstruction pipeline given input type, output format, and use case. Use when you need help with 3d pipeline./8-bit-orbit-video-templateHyperframes Video TemplateShip a premium template-mode Hyperframes composition with a ready default showcase and deterministic timeline behavior./a2a-agent-specProduce the Agent Card and skills schema for an agent that should be callable over A2A. Use when you need help with a2a agent spec.Other plugins' skills for the same job