ag-security
STRIDE + OWASP-based security audit with optional auto-fix. Scans code for vulnerabilities, categorizes by severity, and can iteratively fix findings using ag-autoresearch pattern.
- License 许可
- MIT
- 最近更新
- 2026-08-02
- Stars
- ★ 0
- Forks
- 0
01 前言 Front Matter
- name
- ag-security
- layer
- helper
- description
- STRIDE + OWASP-based security audit with optional auto-fix. Scans code for vulnerabilities, categorizes by severity, and can iteratively fix findings using ag-autoresearch pattern.
- trigger_keywords
- security, vulnerability, auth, XSS, SQL injection
02 资源文件 3
- 参考文档references/secret-patterns.md1.5 KB
- 参考文档references/stride-owasp-checklist.md6.1 KB
- 参考文档references/vulnerability-patterns.md2.2 KB
03 SKILL.md 正文
ag-security — Security Audit
Output style: Follow
process/development-protocols/communication-standards.md— answer-first, plain language, no unexplained jargon, TL;DR on long responses.
Runs a structured STRIDE + OWASP security audit on a given scope. Produces a severity-ranked findings report. With --fix, applies fixes iteratively using the ag-autoresearch guard pattern.
When to Apply
- Before a release or major deployment
- After adding auth, payment, or data-handling features
How to Use
Refer to the workflow instructions and command references detailed below.
- Periodic security review (monthly/quarterly)
- Compliance check (SOC 2, GDPR, PCI-DSS prep)
When NOT to Use
- Purely cosmetic changes (CSS, copy edits)
- No user-facing code or data handling involved
Modes
| Mode | Invocation | Behavior |
|---|---|---|
| Audit only | /ag-security <scope> |
Scan → categorize → report |
| Audit + Fix | /ag-security <scope> --fix |
Scan → categorize → fix iteratively |
| Bounded fix | /ag-security <scope> --fix --iterations N |
Limit fix iterations to N |
Audit Methodology
1. Scope Resolution
Expand the provided glob or full keyword into a file list. Read all in-scope files before analysis.
2. STRIDE Analysis
Evaluate each threat category systematically:
- Spoofing — identity/authentication weaknesses
- Tampering — input validation, integrity controls
- Repudiation — audit logging gaps
- Information Disclosure — data leakage, secret exposure
- Denial of Service — rate limits, resource exhaustion
- Elevation of Privilege — broken access control, RBAC gaps
3. OWASP Top 10 Check
Map findings to OWASP categories (A01–A10). See references/stride-owasp-checklist.md for per-category checks.
4. Dependency Audit
Run the appropriate package audit tool for the detected stack:
- Node.js:
pnpm audit - Python:
pip-audit - Go:
govulncheck - Ruby:
bundle audit
5. Secret Detection
Scan for hardcoded API keys, passwords, tokens, and private keys using regex patterns. See references/stride-owasp-checklist.md → Secret Patterns.
6. Finding Categorization
Assign each finding a severity level (see Severity Definitions below).
Output Format
## Security Audit Report
### Summary
- Files scanned: N
- Findings: X critical, Y high, Z medium, W low, V info
### Findings
| # | Severity | Category | File:Line | Description | Fix Recommendation |
|---|----------|----------|-----------|-------------|-------------------|
| 1 | Critical | Injection | api/users.ts:45 | SQL string concatenation | Use parameterized queries |
| 2 | High | Auth | auth/login.ts:12 | No rate limiting | Add express-rate-limit |
Fix Mode (--fix)
When --fix is provided, apply fixes iteratively after the audit:
- Sort all findings by severity (Critical → High → Medium → Low)
- For each finding:
a. Apply one targeted fix
b. Run guard (tests or lint) to verify no regression
c. Commit:
security(fix-N): <short description>d. Advance to next finding - Stop early if guard fails — report the failure instead of proceeding
- Uses
ag-autoresearchguard pattern for regression prevention
Tip: Use
--iterations Nto cap total fix iterations when scope is large.
Severity Definitions
| Severity | Description | Fix Priority |
|---|---|---|
| Critical | Exploitable now, data breach or RCE risk | Immediate — block release |
| High | Exploitable with moderate effort, significant impact | This sprint |
| Medium | Limited exploitability or impact | Next sprint |
| Low | Theoretical risk, defense-in-depth improvement | Backlog |
| Info | Best practice suggestion, no direct risk | Optional |
Integration with Other Skills
- Run after
ag-predictwhen the security persona flags concerns - Feed Critical/High findings into
ag-autoresearch --fixfor automated remediation - Use
ag-scenariowith--focus authorizationfor deeper auth flow testing - Pair with
generate-plan/plan-agentto schedule Medium/Low findings as sprint tasks
Example Invocations
# Audit API layer only
/ag-security src/api/**/*.ts
# Audit entire src/ and auto-fix, max 15 iterations
/ag-security src/ --fix --iterations 15
# Full codebase audit (no fix)
/ag-security full
See references/stride-owasp-checklist.md for the detailed per-category checklist and secret detection regex patterns.
References
04 同仓库更多 Skills
zustand
Rules and standards for state management using Zustand in React and Next.js. Use when implementing client-side stores, persistence with localStorage, or preventing SSR hydration mismatch.
zod
Zod v4 schema validation best practices. Use when defining schemas, utilizing safeParse, or customizing error messages.
upstash-ratelimit
Rules, standards, and references for rate limiting in serverless environments using Upstash Ratelimit. Use when implementing rate limiting, configuring Upstash Redis, or handling request blocking.
ui-design
UI/UX and frontend design best practices guidelines (formerly frontend-design). This skill should be used when writing, reviewing, or designing frontend code to ensure accessibility, performance, and usability. Triggers on tasks involving HTML structure, CSS styling, responsive layouts, form design, animations, or accessibility improvements.
typescript
TypeScript performance, tsconfig, type errors, async patterns — triggered when the user asks to "optimize TypeScript performance", "speed up tsc compilation", "configure tsconfig.json", "fix type errors", "improve async patterns", or encounters TS errors (TS2322, TS2339, "is not assignable to"). Also triggers on .ts, .tsx, .d.ts file work involving type definitions, module organization, or memory management. Does NOT cover TypeScript basics, framework-specific patterns, or testing.
typescript-refactor
TypeScript and TSX refactoring and modernization guidelines from a principal specialist perspective, current to TypeScript 6.0 and React 19. This skill should be used when refactoring, reviewing, or modernizing TypeScript or React/TSX code for type safety, compiler performance, and idiomatic patterns. Triggers on tasks involving type architecture, narrowing, generics, discriminated unions, error handling, React component and hook typing, or migration to modern TypeScript features (satisfies, using, const type parameters, inferred type predicates, isolatedDeclarations, erasable syntax, import attributes).