Automated summary
Audits TypeScript/tRPC code against the OWASP Top 10 and blocks insecure code through veto power.
Strengths
- Ships concrete grep detection patterns for request-supplied user IDs, returned passwords, and routes missing Zod validation
- Defines an explicit veto workflow: stop, report the vulnerability with file and line, require a fix before continuing
- Structured checklist spanning access control, cryptographic failures, injection, and authentication
- Enforces two strong, checkable rules: user ID always from session, Zod validation on every route
Limitations
- Rules and examples are tightly bound to a tRPC + Zod + Mongoose stack and don't transfer as-is
- Detection relies on grep patterns, so it is prone to false positives and blind spots (dynamic flows, obfuscation)
- Explicitly covers only a few OWASP categories (A01, A02, A03, A07) and offers no automated remediation
Run it before committing or opening a merge request on server code that touches authentication, user data, or new tRPC routes.
Don't rely on it as the sole security review for non-TypeScript stacks, nor as a substitute for a pentest or dependency scanning.
Security analysis
CautionThe skill is primarily an instruction/reference document for auditing code. No destructive commands, no curl|sh, no base64 payloads, no requests to send secrets or tokens anywhere, and no attempts to disable safety controls. The only execution surfaces are read-only grep commands and an invoked Python scanner that is not bundled, so risk is low but not zero — hence caution rather than safe.
- •Declares the Bash tool; all documented commands are read-only `grep` scans, which limits risk, but gives the agent shell access for whatever it decides to run.
- •Instructs executing `python .claude/skills/security-scan/scripts/scan.py server/`, but that script is not included in the provided bundle, so its actual behavior (file reads, network calls, writes) cannot be verified.
- •The grep detection patterns are broad (`grep -r "{ userId }"`, `grep -r "passwordHash\|password:"`) and read source files only — no exfiltration, deletion, or obfuscation is present.
Examples
Run a security scan on server/routers/user.ts before I commit. Check that user IDs come from the session, every route has Zod input validation, and no passwordHash is returned.Audit the new tRPC procedures I just added against the OWASP Top 10 checklist — access control, injection, and auth. Veto the change if you find a critical vulnerability.Grep the server directory for anything leaking sensitive data to the frontend (passwords, API tokens, stack traces) and report each hit with file and line.name: security-scan description: Audits code security against OWASP Top 10. Validates user ID from session, detects sensitive data leaks, verifies Zod validation. HAS VETO POWER - blocks insecure code. allowed-tools: Read, Grep, Glob, Bash
Security Scan - Security Audit System
VETO POWER
WARNING: This skill HAS VETO POWER. If critical vulnerability detected, MUST:
- STOP implementation
- REPORT vulnerability
- REQUIRE fix before proceeding
Purpose
This skill audits code security:
- Validates user ID comes from session (NEVER from request)
- Detects sensitive data being sent to frontend
- Verifies Zod validation on all routes
- Audits against OWASP Top 10
- Blocks commits with critical vulnerabilities
Critical Security Rules
1. USER ID ALWAYS FROM SESSION
NEVER trust user ID from frontend. ALWAYS extract from
ctx.session.userIdorctx.user._id.
// WRONG - VULNERABLE (IMMEDIATE VETO)
async function getData({ userId }: { userId: string }) {
return db.find({ userId }); // userId can be manipulated!
}
// CORRECT
async function getData({ ctx }: { ctx: Context }) {
const userId = ctx.user._id; // Always from session
return db.find({ userId });
}
2. SENSITIVE DATA NEVER TO FRONTEND
NEVER send to frontend:
- Passwords (even hashed)
- API tokens
- Secret keys
- Other users' data
- Stack traces in production
// WRONG - DATA LEAK (IMMEDIATE VETO)
return {
user: await UserModel.findById(id), // Includes passwordHash!
};
// CORRECT
return {
user: user.toPublic(), // Sanitization method
};
3. ZOD VALIDATION REQUIRED
EVERY tRPC route MUST have
.input(z.object({...})). Unvalidated inputs are attack vectors.
// WRONG - NO VALIDATION (IMMEDIATE VETO)
.mutation(async ({ input }) => {
await db.create(input); // input can have anything!
})
// CORRECT
.input(createSchema) // Zod schema
.mutation(async ({ input }) => {
await db.create(input); // input is validated
})
OWASP Top 10 Checklist
A01: Broken Access Control
- [ ] All protected routes use
protectedProcedure? - [ ] User ID from session, not input?
- [ ] Resources filtered by user/tenant?
A02: Cryptographic Failures
- [ ] Passwords hashed with bcrypt (salt >= 10)?
- [ ] Tokens generated with crypto.randomBytes?
- [ ] Cookies with HttpOnly, Secure, SameSite?
- [ ] No secrets in code (use env vars)?
A03: Injection
- [ ] Queries use Mongoose (prevents NoSQL injection)?
- [ ] Inputs validated with Zod?
- [ ] No string concatenation in queries?
A07: Authentication Failures
- [ ] Passwords with minimum requirements?
- [ ] Brute force protection?
- [ ] Sessions invalidated on logout?
- [ ] Tokens with expiration?
Detection Patterns
Detect User ID from Input (VETO)
grep -r "input\.userId\|input\.user_id\|{ userId }" server/ --include="*.ts"
Detect Password Return (VETO)
grep -r "passwordHash\|password:" server/ --include="*.ts"
Detect Route Without Validation (VETO)
grep -A5 "Procedure\." server/ --include="*.ts" | grep -v ".input("
Output Format
Approved
## SECURITY SCAN - APPROVED
### Scope
- **Files:** X
- **Routes:** Y
### Checks
- [x] User ID always from session
- [x] No sensitive data in response
- [x] All routes with Zod validation
- [x] OWASP Top 10 OK
**STATUS: APPROVED**
Vetoed
## SECURITY SCAN - VETOED
### CRITICAL VULNERABILITY
**Type:** User ID from Input
**File:** `server/routers/example.ts:45`
**Risk:** Any user can access other users' data
**Fix:** Use `ctx.user._id` instead of `input.userId`
**STATUS: VETOED** - Fix before proceeding
VETO Rules
IMMEDIATE VETO
- User ID from input/request body
- Password returned in response
- API tokens exposed
- Protected route without
protectedProcedure - Query without user/tenant filter
VETO BEFORE MERGE
- Route without Zod validation
- Unsanitized sensitive data
- bun audit (or npm audit) with critical vulnerabilities
Progressive Disclosure
For detailed information, see:
- reference/owasp-top-10.md - Complete OWASP Top 10 checklist with examples
- scripts/scan.py - Automated security scanner
Quick Scan
python .claude/skills/security-scan/scripts/scan.py server/
Version
- v2.1.0 - Added progressive disclosure with reference files and scan script
- v2.0.0 - Generic template
From the file to a first result
The download contains exactly the content displayed on this page. This copy may differ from the latest version in the source repository.
View the source and supporting filesThis download contains SKILL.md only. Any scripts, references, templates and dependencies are not included. Get the required files from the source, preserving their directory structure, before continuing.
1. Download the file
Download SKILL.mdFrom the root of a test project, save the file as .skill-downloads/security-audit-system-mrx3xxf2/SKILL.md, or use the command below. This folder is for inspecting the skill before installation.
Command for macOS/Linux or WSL: requires a POSIX shell and curl. On Windows without WSL, use the download button and create the folder manually.
mkdir -p '.skill-downloads/security-audit-system-mrx3xxf2' && curl --fail --show-error --location 'https://skills-guides.com/api/skills/security-audit-system-mrx3xxf2/download' --output '.skill-downloads/security-audit-system-mrx3xxf2/SKILL.md.part' && mv '.skill-downloads/security-audit-system-mrx3xxf2/SKILL.md.part' '.skill-downloads/security-audit-system-mrx3xxf2/SKILL.md'2. Check prerequisites
Read SKILL.md before using it. If it references scripts or external services, inspect them and prepare the required access in your test environment.
Tools declared by the author (check availability in your agent): Read, Grep, Glob, Bash
No recognized prerequisites section in this file. This does not mean it is self-contained: libraries, tools and access requirements may be mentioned elsewhere in the content or source repository.
The platforms on this page are catalog indications. The paths below follow tool documentation; they do not prove this skill has been run in those tools. No minimum tool version is confirmed for this listing.
3. Load the skill
After inspection, copy the complete folder into your project using one of the commands below, then open a new tool session. The command stops if a folder with the same name already exists: compare the files before replacing it.
Claude Code
test -f '.skill-downloads/security-audit-system-mrx3xxf2/SKILL.md' && test -s '.skill-downloads/security-audit-system-mrx3xxf2/SKILL.md' && mkdir -p '.claude/skills' && test ! -e '.claude/skills/security-scan' && cp -R '.skill-downloads/security-audit-system-mrx3xxf2' '.claude/skills/security-scan'OpenSkills
OpenSkills must already be installed. The local install/read procedure is checked with OpenSkills 1.5.0, which requires Node.js ≥ 20.6.0. Catalog slugs are not resolved automatically.
Official OpenSkills installationopenskills install './.skill-downloads/security-audit-system-mrx3xxf2'openskills read 'security-audit-system-mrx3xxf2'Reading should display the installed file content and its base directory. It does not run the skill or install its dependencies.
For an agent that reads AGENTS.md, then sync the index. This command changes AGENTS.md: review the diff before using it.
openskills syncManual method or another tool: attach SKILL.md to a conversation, or open it in an agent that can read files. Include any required supporting resources. No universal folder is recognized by every tool.
4. Try a first task
Use a short, synthetic input: an API endpoint, a small document or an interface brief. In a new conversation, attach the file or give the agent its path, then adapt this request:
Read .skill-downloads/security-audit-system-mrx3xxf2/SKILL.md and apply its instructions to this example: [describe a test input]. Identify any missing files, dependencies or access. Produce the result requested by the skill without inventing data or running unreviewed scripts.Expected result: output matching the skill instructions, or a precise list of missing prerequisites. A read confirmation alone does not validate a first use. If an external resource is unavailable, that path remains untested.
DeFi AMM Security
Security
Security checklist for Solidity AMM contracts, liquidity pools, and swap flows. Covers reentrancy, donation attacks, oracle manipulation, slippage, and integer math.
Semgrep Rule Creator
Security
Creates custom Semgrep rules for detecting security vulnerabilities, bug patterns, and code patterns. Includes test-first methodology, taint mode support, and validation steps. Helps when building targeted static analysis detections.
Dev Toolbar Review Guide
Security
Safety rules for the dev toolbar, PostHog client, and feature flags. Use when reviewing changes to dev-tools and related files, covering environment guards, override cookies, and SSE stream safety.