AGENT SKILL

security-audit

Comprehensive security analysis — OWASP Top 10, auth/authz flows, injection vulnerabilities, data exposure, secrets detection, dependency CVEs, hardening recommendations. Reviews EXISTING code/config — design-time analysis of a system not yet built → threat-modeling.

License 许可
MIT
最近更新
2026-11-12
Stars
★ 1
Forks
1

01 前言 Front Matter

name
security-audit
agent
general-purpose
context
fork
description
Comprehensive security analysis — OWASP Top 10, auth/authz flows, injection vulnerabilities, data exposure, secrets detection, dependency CVEs, hardening recommendations. Reviews EXISTING code/config — design-time analysis of a system not yet built → threat-modeling.
when_to_use
Triggers: security audit, vulnerability, is this secure, security review, pentest prep, OWASP, harden this, check for vulnerabilities, injection, XSS, CSRF, auth security.

02 资源文件 3

03 SKILL.md 正文

Security Audit

Perform a structured security assessment of an application. This skill goes far deeper than the security checklist in code-reviewing — it's a dedicated, systematic analysis covering the OWASP Top 10 and beyond.

Scope Boundary

This skill analyzes code, configuration, and architecture for security vulnerabilities through static analysis and design review. It does not replace penetration testing, but it prepares code for one by catching the issues a pentester would find. It is the reactive half of the pair: for design-time analysis of a system that isn't built yet (trust boundaries, STRIDE, abuse cases), use threat-modeling — and when a threat model exists, use it as this audit's checklist.

⛔ The Iron Law

"No obvious problems" is not a pass.

Absence of evidence is not evidence of security. Every clearance is backed by evidence — the specific control you read and where it's enforced — and every finding cites the exact code path plus a concrete exploit scenario. If you can't write the exploit, you haven't assessed the risk; if you can, it isn't theoretical.

Workflow

Step 1: Define the Attack Surface

Before reviewing code line by line, map what's exposed:

  • Entry points: HTTP endpoints, WebSocket connections, GraphQL resolvers, CLI inputs, file uploads, webhooks, cron jobs
  • Authentication boundaries: What's public vs authenticated vs admin-only?
  • Data flows: Where does sensitive data enter, travel, and get stored?
  • External integrations: Third-party APIs, OAuth providers, payment processors
  • Infrastructure: Cloud services, databases, caches, queues

Record the attack surface map as the first section of the report — gaps in understanding here mean gaps in the audit, so anything you could not map (unreachable config, undocumented integrations) goes under Open questions rather than being assumed safe.

Kick off the dependency scan while you map. npm audit / pip-audit / govulncheck (Step 5) is one command and needs no understanding of the system, so it is the cheapest early result in the whole audit — start it now and have findings waiting by the time the walkthrough reaches them. When someone asks where to start, this is the answer that costs them nothing while the real review is still being scoped.

Step 2: Assess by OWASP Top 10

Walk through each category systematically. See references/owasp-top-10.md for the detailed checklist.

For each finding:

  • Severity, by what the attacker needs:
    • Critical: nothing beyond reaching the system to take data, accounts or the host (injection, auth bypass, RCE), or one leak of a store exposes every credential in it (plaintext, or a fast hash like MD5/SHA without a KDF)
    • High: one extra step or condition: forgeable or never-expiring tokens, hard-coded secrets, IDOR, stored XSS
    • Medium: makes other attacks easier or leaks a little: no rate limiting, missing input validation, user enumeration, missing security headers
    • Low: hardening with no exploit path of its own
  • Location: File, line, endpoint
  • Vulnerability: What the issue is
  • Exploit scenario: How an attacker would use this (concrete, not theoretical)
  • Remediation: when the vulnerable code is in front of you, the corrected code, for every finding, Medium and Low included. A sentence describing the fix is not a fix. When there is no code, name the concrete change (library, setting, pattern) and keep auditing. Missing code is not a reason to stop and ask.

Step 3: Authentication & Authorization Deep Dive

Auth is where the highest-impact vulnerabilities live. Review:

Authentication:

  • How are credentials stored? (bcrypt/argon2 with sufficient rounds, never MD5/SHA)
  • Session management: secure flags, httpOnly, sameSite, expiration
  • Token handling: JWT validation (algorithm, expiry, issuer), refresh token rotation
  • Password policy: minimum complexity, breached password checking
  • MFA implementation (if present): bypass resistance, recovery flow security
  • Rate limiting on login: brute force protection

Authorization:

  • Is authorization checked on every protected endpoint (not just the UI)?
  • Are there IDOR vulnerabilities? (Can user A access user B's resources by changing an ID?)
  • Is the authorization model consistent? (role-based, attribute-based, or ad-hoc?)
  • Are there privilege escalation paths? (Can a regular user reach admin functionality?)
  • Are API endpoints and UI permissions in sync?

Step 4: Data Security Review

  • At rest: Is sensitive data encrypted in the database? (PII, payment data, health data)
  • In transit: Is TLS enforced everywhere? Any HTTP-only endpoints?
  • In logs: Are passwords, tokens, SSNs, or credit card numbers logged?
  • In errors: Do error messages leak internal details (stack traces, SQL queries, file paths)?
  • In responses: Do API responses include fields the client shouldn't see?
  • Retention: Is data deleted when it should be? GDPR/CCPA compliance?

Step 5: Dependency Audit

Run dependency vulnerability scanners and review results:

# JavaScript/TypeScript
npm audit
npx better-npm-audit audit

# Python
pip audit
safety check

# Go
govulncheck ./...

# Ruby
bundle audit check --update

For each vulnerability found:

  • What is the CVE and its severity?
  • Is the vulnerable code path actually used in this project?
  • Is there a patched version available?
  • If no patch exists, what's the mitigation?

Suggest using the dependency-management skill for remediation planning.

Step 6: Secrets and Configuration

  • Scan for hardcoded secrets: API keys, passwords, tokens, private keys
  • Check .gitignore covers sensitive files (.env, key files, certificates)
  • Review git history for accidentally committed secrets: git log --all -p | grep -i "password\|secret\|api_key\|token"
  • Verify environment variable usage for all secrets
  • Check that different environments use different credentials

Step 7: Produce the Report

Output the audit report using the template at templates/security-report.md. Organize findings by severity, with Critical and High items first.

Write the full report to a file (default a gitignored location, e.g. .local/security-audit-<date>.md) and state its path in your final summary — this skill runs in a forked context: only the summary returns, everything unwritten is lost. The summary must lead with the Critical/High count. Judgment calls that need user input (unclear trust boundary, whether a data store is in scope, unverifiable control) go in an Open questions section of the report — never silently assumed safe.

What This Skill Does NOT Cover

  • Runtime penetration testing (requires running the application)
  • Network-level security (firewall rules, VPN configuration)
  • Physical security or social engineering
  • Compliance certification (SOC 2, HIPAA, PCI DSS — though findings may relate)

Principles Applied

  • Defense in depth: Don't rely on a single security control. Layer protections.
  • Least privilege: Every component should have the minimum permissions it needs.
  • Fail secure: When something goes wrong, it should deny access, not grant it.
  • KISS: Simpler security is more auditable security. Complex auth flows breed bugs.

Rationalizations to reject

Excuse Reality
"I didn't see anything obviously wrong" You audited the absence of obvious bugs, not the presence of security. Trace each control.
"The framework handles that" Verify the control is actually enabled and configured correctly — don't assume.
"Auth is checked in the UI" UI checks are not authorization. Confirm server-side enforcement on every protected endpoint.
"This input is internal/trusted" Trust boundaries shift. Validate anyway — defense in depth.
"That CVE doesn't apply to us" Confirm the vulnerable code path is unused before dismissing it.
"It's only a theoretical risk" If you can't write the exploit scenario, you haven't assessed it.

Red flags — stop and correct course

  • Signing off a category without naming the file/endpoint you verified.
  • A finding with no concrete exploit path.
  • Concluding "secure" because nothing jumped out.
  • Trusting that a control exists without reading where it's enforced.

04 同仓库更多 Skills

SWEStash
SWEStash/swe-workflow-skills

writing-skills

Use when authoring, editing, or reviewing a skill in this library — a new SKILL.md, one that under-triggers, or hardening an existing one. Covers description and listing-budget rules, frontmatter, progressive disclosure, the 3-eval rule, and pressure-testing against rationalizations.

★ 1
SWEStash
SWEStash/swe-workflow-skills

working-agreement

Define and validate how a multi-session project is run — where plans, status and decisions live, session routines, new work, milestone close. README/CONTRIBUTING → project-documentation.

★ 1
SWEStash
SWEStash/swe-workflow-skills

verification-before-completion

Evidence gate before any claim that work is done, fixed, passing, or deployed. Route here when a message declares the work finished or asks to commit, push, merge, ship, or close it out, including a brief sign-off, and before git-workflow or release-management act on it. Writing the commit message or PR text itself → git-workflow.

★ 1
SWEStash
SWEStash/swe-workflow-skills

ui-ux-design

Design user experiences from an engineer's perspective — user flows, wireframes, interaction patterns, responsive strategy, navigation, loading/error/empty states. Triggers: design the UI, user flow, wireframe, how should this screen look, loading state, error state, empty state, responsive design, navigation, page layout, form design, mockup.

★ 1
SWEStash
SWEStash/swe-workflow-skills

threat-modeling

Design-time security analysis of a system or feature before it's built — trust boundaries, attack surface, STRIDE per element, abuse cases, prioritized mitigations that become security requirements. Triggers: threat model, STRIDE, trust boundary, attack surface, what could go wrong security-wise, security design review, abuse case, secure this design, security requirements. Reviewing EXISTING code/config for vulnerabilities → security-audit; use this skill while the design is still on the whiteboard.

★ 1
SWEStash
SWEStash/swe-workflow-skills

test-suite-design

Design comprehensive test suites for existing code — strategy across unit/integration/e2e, fixtures, factories, helpers. Triggers: add tests, write tests for, increase coverage, test this module, testing strategy, test plan, what tests do I need, test infrastructure, test helpers, this has no tests. Not for TDD — use tdd-workflow.

★ 1