Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Use when working with authentication, API routes, user input, or sensitive data. Audits code for security vulnerabilities based on OWASP Top 10. Critical for payment processing, auth systems, and data handling.
.claude/skills/aiskillstore-security-sentinel/SKILL.md| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-20 | ✗→✓ | ▲ Improved | 328% | 0% |
| case-23 | ✓→✗ | ▼ Worse | 375% | 0% |
| case-01 | ✓→✓ | = Same ✓ | 169% | 0% |
| case-03 | ✓→✓ | = Same ✓ | 229% | 0% |
| case-05 | ✓→✓ | = Same ✓ | 231% | 0% |
ALWAYS use this skill when:
This skill includes complete security references:
Before implementing ANY security-sensitive feature:
bash# 1. Read the relevant guide cat owasp-top-10-complete.md cat authentication-patterns.md # 2. Implement following patterns # 3. Run security scanner python validate-security.py src/ # 4. Check against security checklist cat security-checklist.md
typescript// ❌ DON'T: String concatenation in queries const query = `SELECT * FROM users WHERE email = '${email}'` // Vulnerable to: email = "' OR '1'='1" // ✅ DO: Use Prisma (parameterized queries) const user = await prisma.user.findUnique({ where: { email }, })
typescript// ❌ DON'T: Unvalidated shell commands const fileName = req.body.fileName exec(`cat ${fileName}`) // Vulnerable to: fileName = "; rm -rf /" // ✅ DO: Validate input and use safe APIs const allowedFiles = ['log.txt', 'data.csv'] if (!allowedFiles.includes(fileName)) { throw new Error('Invalid file name') } const content = await fs.readFile(path.join(SAFE_DIR, fileName))
typescript// ❌ DON'T: Direct object insertion const user = await db.users.findOne({ email: req.body.email }) // Vulnerable to: { email: { $ne: null } } // ✅ DO: Validate input with Zod const emailSchema = z.string().email() const email = emailSchema.parse(req.body.email) const user = await db.users.findOne({ email })
typescript// ❌ DON'T: Plain text passwords const user = await prisma.user.create({ data: { email, password, // Never store plain text! }, }) // ✅ DO: Hash with bcrypt import bcrypt from 'bcrypt' const hashedPassword = await bcrypt.hash(password, 12) // 12 rounds minimum const user = await prisma.user.create({ data: { email, password: hashedPassword, }, })
typescript// ❌ DON'T: Weak session tokens const sessionId = Math.random().toString() // ✅ DO: Cryptographically secure tokens import crypto from 'crypto' const sessionId = crypto.randomBytes(32).toString('hex') // ✅ DO: Set secure session cookie res.setHeader('Set-Cookie', [ `session=${sessionToken}; HttpOnly; Secure; SameSite=Strict; Max-Age=3600`, ])
typescript// ❌ DON'T: Weak secret const token = jwt.sign(payload, 'secret123') // ✅ DO: Strong secret from environment const token = jwt.sign(payload, process.env.JWT_SECRET!, { expiresIn: '1h', algorithm: 'HS256', }) // ✅ DO: Verify JWT properly try { const decoded = jwt.verify(token, process.env.JWT_SECRET!) // Use decoded data } catch (error) { throw new Error('Invalid token') }
typescript// ❌ DON'T: Hardcoded secrets const apiKey = 'sk_live_abc123def456' const dbPassword = 'mypassword123' // ✅ DO: Environment variables const apiKey = process.env.STRIPE_API_KEY const dbPassword = process.env.DATABASE_PASSWORD if (!apiKey || !dbPassword) { throw new Error('Missing required environment variables') }
typescript// ❌ DON'T: Log sensitive data console.log('User data:', { email, password, creditCard }) // ✅ DO: Redact sensitive fields const safeUserData = { email, creditCard: creditCard.slice(-4).padStart(creditCard.length, '*'), } console.log('User data:', safeUserData)
typescript// ❌ DON'T: Return password in API const user = await prisma.user.findUnique({ where: { id } }) return user // Includes password hash! // ✅ DO: Exclude sensitive fields const user = await prisma.user.findUnique({ where: { id }, select: { id: true, email: true, name: true, // password field excluded }, }) return user
typescript// ❌ DON'T: Parse untrusted XML const doc = xmlParser.parse(userInput) // ✅ DO: Disable external entities const parser = new xml2js.Parser({ explicitChildren: false, explicitRoot: false, ignoreAttrs: true, xmlns: false, })
typescript// ❌ DON'T: Missing authorization export async function DELETE( request: Request, { params }: { params: { id: string } } ) { await prisma.project.delete({ where: { id: params.id } }) return new Response(null, { status: 204 }) } // ✅ DO: Verify ownership export async function DELETE( request: Request, { params }: { params: { id: string } } ) { const user = await getAuthUser(request) if (!user) { return new Response('Unauthorized', { status: 401 }) } const project = await prisma.project.findUnique({ where: { id: params.id }, }) if (!project) { return new Response('Not found', { status: 404 }) } if (project.userId !== user.id) { return new Response('Forbidden', { status: 403 }) } await prisma.project.delete({ where: { id: params.id } }) return new Response(null, { status: 204 }) }
typescript// ❌ DON'T: Trust user input for IDs const userId = req.query.userId const data = await getPrivateData(userId) // Any user can access any data! // ✅ DO: Use authenticated user's ID const userId = req.user.id // From authenticated session const data = await getPrivateData(userId)
typescript// ❌ DON'T: Allow all origins res.setHeader('Access-Control-Allow-Origin', '*') // ✅ DO: Whitelist specific origins const allowedOrigins = [ 'https://app.quetrex.com', 'https://staging.quetrex.com', ] const origin = req.headers.get('origin') if (origin && allowedOrigins.includes(origin)) { res.setHeader('Access-Control-Allow-Origin', origin) }
typescript// ❌ DON'T: Expose internal details catch (error) { res.status(500).json({ error: error.message, // Could leak stack trace, DB structure, etc. }) } // ✅ DO: Generic error messages catch (error) { console.error('Internal error:', error) // Log internally res.status(500).json({ error: 'An internal error occurred', }) }
typescript// ❌ DON'T: Unsanitized HTML <div dangerouslySetInnerHTML={{ __html: userInput }} /> // Vulnerable to: userInput = "<script>alert('XSS')</script>" // ✅ DO: Sanitize with DOMPurify import DOMPurify from 'dompurify' const sanitized = DOMPurify.sanitize(userInput) <div dangerouslySetInnerHTML={{ __html: sanitized }} /> // ✅ BETTER: Avoid dangerouslySetInnerHTML entirely <div>{userInput}</div> // React escapes by default
typescript// ❌ DON'T: Unsanitized URLs <a href={userInput}>Click here</a> // Vulnerable to: userInput = "javascript:alert('XSS')" // ✅ DO: Validate URLs function isSafeUrl(url: string): boolean { try { const parsed = new URL(url) return ['http:', 'https:'].includes(parsed.protocol) } catch { return false } } const href = isSafeUrl(userInput) ? userInput : '#' <a href={href}>Click here</a>
typescript// ❌ DON'T: eval() or Function() const code = req.body.code eval(code) // NEVER DO THIS // ❌ DON'T: Unvalidated JSON const data = JSON.parse(userInput) // Use data directly without validation // ✅ DO: Validate with Zod const data = JSON.parse(userInput) const validated = dataSchema.parse(data) // Validates structure and types
bash# ✅ DO: Regular dependency audits npm audit --audit-level=high # ✅ DO: Keep dependencies updated npm update # ✅ DO: Use automated tools npm install -g snyk snyk test
typescript// ❌ DON'T: No logging export async function POST(request: Request) { const user = await createUser(data) return Response.json(user) } // ✅ DO: Log security events export async function POST(request: Request) { try { const user = await createUser(data) logger.info('User created', { userId: user.id, email: user.email, ip: request.headers.get('x-forwarded-for'), timestamp: new Date().toISOString(), }) return Response.json(user) } catch (error) { logger.error('User creation failed', { error: error.message, email: data.email, ip: request.headers.get('x-forwarded-for'), timestamp: new Date().toISOString(), }) throw error } }
typescript// ✅ Complete input validation example import { z } from 'zod' const createUserSchema = z.object({ email: z.string().email().max(255), password: z .string() .min(8, 'Password must be at least 8 characters') .max(128) .regex(/[A-Z]/, 'Password must contain uppercase letter') .regex(/[a-z]/, 'Password must contain lowercase letter') .regex(/[0-9]/, 'Password must contain number') .regex(/[^A-Za-z0-9]/, 'Password must contain special character'), name: z.string().min(1).max(100).optional(), }) export async function POST(request: Request) { // 1. Parse and validate input const body = await request.json() const validated = createUserSchema.parse(body) // Throws on validation error // 2. Additional business logic validation const existing = await prisma.user.findUnique({ where: { email: validated.email }, }) if (existing) { throw new Error('Email already exists') } // 3. Hash password const hashedPassword = await bcrypt.hash(validated.password, 12) // 4. Create user const user = await prisma.user.create({ data: { email: validated.email, password: hashedPassword, name: validated.name, }, select: { id: true, email: true, name: true, // password excluded }, }) // 5. Log security event logger.info('User registered', { userId: user.id, email: user.email }) return Response.json(user, { status: 201 }) }
typescript// ✅ DO: Set security headers export function middleware(request: NextRequest) { const response = NextResponse.next() response.headers.set('X-Content-Type-Options', 'nosniff') response.headers.set('X-Frame-Options', 'DENY') response.headers.set('X-XSS-Protection', '1; mode=block') response.headers.set('Referrer-Policy', 'strict-origin-when-cross-origin') response.headers.set( 'Content-Security-Policy', "default-src 'self'; script-src 'self' 'unsafe-inline' 'unsafe-eval'; style-src 'self' 'unsafe-inline';" ) response.headers.set( 'Strict-Transport-Security', 'max-age=31536000; includeSubDomains' ) return response }
For each code change, verify:
| Case | Status | Duration (ms) | Turns | Tokens | Tool calls | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Without | With | Δ | Without | With | Δ | Without | With | Δ | Without | With | Δ | ||
case-04 | fail→fail | 20,018 | 20,253 | +1% | 1 | 1 | 0% | 2,931 | 7,498 | +156% | 0 | 0 | — |
case-01 | pass→pass | 20,167 | 15,381 | -24% | 1 | 1 | 0% | 2,533 | 6,822 | +169% | 0 | 0 | — |
case-02 | fail→fail | 15,581 | 21,773 | +40% | 1 | 1 | 0% | 2,421 | 7,835 | +224% | 0 | 0 | — |
case-03 | pass→pass | 11,288 | 14,500 | +28% | 1 | 1 | 0% | 2,208 | 7,259 | +229% | 0 | 0 | — |
case-05 | pass→pass | 14,586 | 15,369 | +5% | 1 | 1 | 0% | 2,019 | 6,676 | +231% | 0 | 0 | — |
case-06 | pass→pass | 13,050 | 33,115 | +154% | 1 | 1 | 0% | 2,651 | 8,109 | +206% | 0 | 0 | — |
case-07 | pass→pass | 19,750 | 21,098 | +7% | 1 | 1 | 0% | 2,948 | 7,643 | +159% | 0 | 0 | — |
case-08 | pass→pass | 14,641 | 15,723 | +7% | 1 | 1 | 0% | 1,864 | 6,467 | +247% | 0 | 0 | — |
case-09 | pass→pass | 15,078 | 18,549 | +23% | 1 | 1 | 0% | 3,133 | 7,640 | +144% | 0 | 0 | — |
case-10 | pass→pass | 16,218 | 21,065 | +30% | 1 | 1 | 0% | 2,184 | 8,021 | +267% | 0 | 0 | — |
case-11 | pass→pass | 19,578 | 23,376 | +19% | 1 | 1 | 0% | 2,719 | 8,183 | +201% | 0 | 0 | — |
case-12 | pass→pass | 14,799 | 19,709 | +33% | 1 | 1 | 0% | 2,657 | 7,263 | +173% | 0 | 0 | — |
case-13 | pass→pass | 11,233 | 19,868 | +77% | 1 | 1 | 0% | 2,195 | 7,533 | +243% | 0 | 0 | — |
case-14 | fail→fail | 22,891 | 28,440 | +24% | 1 | 1 | 0% | 3,566 | 9,133 | +156% | 0 | 0 | — |
case-15 | pass→pass | 31,438 | 30,144 | -4% | 1 | 1 | 0% | 2,836 | 7,696 | +171% | 0 | 0 | — |
case-16 | pass→pass | 26,224 | 39,352 | +50% | 1 | 1 | 0% | 4,220 | 10,424 | +147% | 0 | 0 | — |
case-17 | fail→fail | 16,851 | 18,459 | +10% | 1 | 1 | 0% | 2,222 | 7,381 | +232% | 0 | 0 | — |
case-18 | pass→pass | 18,286 | 29,611 | +62% | 1 | 1 | 0% | 2,928 | 7,819 | +167% | 0 | 0 | — |
case-19 | pass→pass | 20,684 | 17,701 | -14% | 1 | 1 | 0% | 2,934 | 6,934 | +136% | 0 | 0 | — |
case-20 | fail→pass | 17,477 | 19,946 | +14% | 1 | 1 | 0% | 1,157 | 4,952 | +328% | 0 | 0 | — |
case-21 | pass→pass | 41,690 | 25,282 | -39% | 1 | 1 | 0% | 3,386 | 8,538 | +152% | 0 | 0 | — |
case-22 | pass→pass | 23,447 | 37,398 | +60% | 1 | 1 | 0% | 2,728 | 10,059 | +269% | 0 | 0 | — |
case-23 | pass→fail | 25,703 | 34,295 | +33% | 1 | 1 | 0% | 1,613 | 7,656 | +375% | 0 | 0 | — |
DecimalAI ran this skill against gemini-3.6-flash twice over the same eval suite — once with the skill loaded and once without — and compared the two runs case by case. 23 cases were attempted. The headline lift of 0 percentage points is the difference between those two pass rates over the 23 comparable cases. 1 case got worse with the skill loaded, and it is included in that figure.
Without the skill loaded, the model failed this case. With it loaded, the same prompt on the same model passed. This is one improved case from the latest verified run; every case, including any that regressed, is in the table above.
Other measured skills in the registry, with their headline benchmark lift.