code-security-quality-audit
Strict security and code-quality audit + repair loop on source code. Find real vulnerabilities and quality issues, fix root causes, verify, pattern-search, repeat. Use when auditing code for security (auth, input handling, secrets, payments) or general code-quality issues. For UI/UX quality use `audit`; for runtime perf use `web-perf`; for pre-build security review use `security-review`.
- License 许可
- MIT
- 所属仓库
- ekasc/skills
- 最近更新
- 2026-08-29
- Stars
- ★ 0
- Forks
- 0
01 前言 Front Matter
- name
- code-security-quality-audit
- author
- ekasc
- license
- MIT
- version
- 1.0.0
- metadata
- { "hermes": { "tags": [ "security", "audit", "code-quality", "review", "repair", "static-analysis" ], "related_skills": [ "codebase-audit", "systematic-debugging", "requesting-code-review", "github-code-review" ] } }
- platforms
- [ "linux", "macos", "windows" ]
- description
- Strict security and code-quality audit + repair loop on source code. Find real vulnerabilities and quality issues, fix root causes, verify, pattern-search, repeat. Use when auditing code for security (auth, input handling, secrets, payments) or general code-quality issues. For UI/UX quality use `audit`; for runtime perf use `web-perf`; for pre-build security review use `security-review`.
03 SKILL.md 正文
Strict Security and Code Quality Repair Skill
Purpose
Audit any codebase, find real security, correctness, reliability, and code-quality issues, fix root causes, verify fixes, and repeat until no meaningful issues remain.
This skill is language-agnostic and agent-agnostic.
This is not a cosmetic refactor pass. This is not a checklist dump. This is a repair workflow.
Prime Directive
Find the real issue. Fix the root cause. Verify the fix. Search for the same bug pattern elsewhere. Repeat.
No hacky fixes. No symptom hiding. No "make the test green" bullshit.
Non-Negotiables
You must not:
- delete or weaken failing tests
- weaken validation to accept bad input
- bypass authentication, authorization, ownership, tenant, or permission checks
- swallow errors without a real recovery path
- return fake success
- hardcode users, IDs, secrets, paths, URLs, tokens, or magic values
- add arbitrary sleeps, retries, or timing hacks
- silence linters, typecheckers, formatters, or scanners without proof and justification
- hide internal failures behind vague catch-all patches
- change public behavior silently
- rewrite large parts of the codebase unless the structure itself is the root cause
- claim the system is "secure"
A fix is invalid if it only hides the symptom.
Start Here
Before editing anything, do this in order.
1. Identify the System Type
Classify the codebase into one or more of these buckets:
- Web app / API / CRUD app
- SaaS / multi-tenant app
- Auth-heavy app
- File upload / file processing app
- URL fetcher / scraper / importer
- Webhook / callback consumer
- Background job / queue / worker system
- CLI / local developer tool
- Frontend-only app
- Library / SDK / package
- Data pipeline / ETL system
- Realtime / websocket / event-driven app
This classification decides where to audit first.
2. Find the Critical Assets
Identify what must be protected:
- user accounts
- sessions/tokens
- private user data
- tenant/workspace/project boundaries
- uploaded files
- database rows
- payments/billing data
- secrets/API keys
- internal network access
- background jobs
- external integrations
- generated/exported data
Do not audit blindly. Audit around assets.
3. Find the Trust Boundaries
List where untrusted input enters the system:
- HTTP requests
- forms
- route params
- query params
- JSON bodies
- file uploads
- URLs submitted by users
- webhooks
- CLI args
- environment variables
- background job payloads
- database records later reused as trusted data
- third-party API responses
Every trust boundary needs validation, authorization, safe error handling, and tests.
4. Run Baseline Verification
Find and run available checks:
- tests
- typecheck
- lint
- build
- formatter check
- migration/schema check
- security scan, if present
Record pre-existing failures separately.
Do not blame your changes for existing failures. Do not call a fix verified unless the relevant checks were actually run.
Triage Decision Tree
Use this to decide where to start.
Web App / API / CRUD App
Start with:
- authentication
- authorization
- ownership checks
- input validation
- data-layer queries
- error handling
Most serious CRUD bugs are IDOR, missing ownership checks, bad validation, and unsafe query scoping.
SaaS / Multi-Tenant App
Start with:
- tenant/workspace/project isolation
- every query that accepts an ID
- list/search/filter endpoints
- analytics/aggregation queries
- background jobs that process tenant data
- file access boundaries
Assume every resource ID is hostile until ownership is proven.
Auth-Heavy App
Start with:
- session creation
- session expiry
- callback/redirect handling
- logout/invalidation
- cookie/token storage
- role/permission enforcement
Client-side auth state is not security.
File Upload / File Processing App
Start with:
- file size limits
- file type validation
- path traversal
- public/private file access
- storage permissions
- archive extraction
- cleanup behavior
Never trust filenames, extensions, MIME types, or paths from users.
URL Fetcher / Scraper / Importer
Start with:
- SSRF protection
- protocol allowlist
- DNS/IP validation
- redirect validation
- timeout limits
- response size limits
- content-type restrictions
Validate every redirect. The original URL is not enough.
Webhook / Callback Consumer
Start with:
- signature verification
- replay protection
- idempotency
- event ordering
- payload validation
- safe failure behavior
Unsigned webhooks are attacker-controlled input.
Background Job / Queue / Worker System
Start with:
- idempotency
- retry behavior
- partial failure handling
- transaction boundaries
- concurrency/race conditions
- poison message handling
Any job that can run twice must be safe to run twice.
CLI / Developer Tool
Start with:
- path handling
- command execution
- config loading
- environment variable handling
- destructive operations
- filesystem permissions
Local tools can still destroy data or leak secrets.
Frontend-Only App
Start with:
- XSS
- unsafe HTML/markdown rendering
- token storage
- stale auth state
- API error handling
- cache key scoping
- optimistic update rollback
Frontend checks improve UX. They do not replace backend enforcement.
Library / SDK / Package
Start with:
- unsafe defaults
- public API misuse risks
- input validation
- dependency risk
- error semantics
- backward compatibility
A library should make the safe path easy and the unsafe path explicit.
Data Pipeline / ETL
Start with:
- untrusted input parsing
- schema validation
- malformed records
- partial writes
- idempotency
- data corruption risks
- retry behavior
Silent bad data is still a production bug.
Severity Rules
Critical
Fix immediately:
- auth bypass
- authorization bypass
- cross-user or cross-tenant data leak
- account takeover risk
- SQL injection
- command injection
- code injection
- SSRF to internal/private networks
- arbitrary file read/write
- secret exposure
- forged webhook actions
- privilege escalation
High
Fix next:
- IDOR
- missing ownership checks
- stored XSS
- unsafe file upload
- unsafe redirects in sensitive flows
- destructive action without authorization
- broken session expiry
- race condition corrupting important state
- sensitive data in logs or responses
Medium
Fix after critical/high:
- bad validation
- bad pagination/filtering
- missing request limits
- incorrect error mapping
- inconsistent transactions
- missing idempotency
- stale derived state
- unreliable retries
- missing abuse limits
Low
Fix only when it reduces future risk:
- confusing naming
- dead code
- duplicated logic
- unclear responsibility boundaries
- weak structure
- inconsistent patterns
Naming and dead code are not security issues by default. They become valid findings only when they obscure ownership, validation, state transitions, error behavior, or other important logic.
Issue Ledger
Track every real issue:
ID:
Severity:
Category:
Affected area:
Root cause:
Failure/exploit scenario:
Fix:
Tests:
Verification:
Pattern search:
Status:
Do not fix random things without knowing why they matter.
Repair Loop
Repeat this loop until the stop conditions are met.
Pass 1: Map
- classify the system
- identify assets
- identify trust boundaries
- identify verification commands
- run baseline checks
Pass 2: Audit Highest-Risk Flows
Pick the top 3 highest-risk flows based on the decision tree.
Examples:
- login/session flow
- user-owned resource CRUD flow
- file upload/download flow
- URL import flow
- webhook processing flow
- background job retry flow
- payment/billing flow
- admin action flow
For each flow, inspect:
- who can call it
- what input it accepts
- what resource it touches
- how ownership is verified
- what happens on failure
- what gets logged
- what tests exist
Pass 3: Fix
For each issue:
- write down the root cause
- design the smallest clean fix
- implement the fix
- add or update regression tests
- run narrow verification
- run broader verification
A fix without verification is not complete.
Pass 4: Pattern Search
After every fix, search for the same bug family.
Examples:
- one missing ownership check means inspect all handlers with resource IDs
- one unsafe query means inspect all queries for that resource
- one missing request limit means inspect all request parsing
- one unsafe redirect means inspect all redirects
- one bad cache key means inspect related cache keys
- one non-idempotent job means inspect all retryable jobs
- one path traversal risk means inspect all file operations
Bugs travel in families. Kill the family.
Pass 5: Re-Audit Touched Areas
After fixing, re-read the changed code and ask:
- did this introduce a new edge case?
- did this weaken behavior?
- did this create inconsistent patterns?
- is the fix understandable?
- is the security boundary explicit?
- would a future maintainer accidentally undo this?
Then run verification again.
Valid Fix Standard
A valid fix must:
- address the root cause
- preserve intended behavior
- improve or preserve security
- be narrow but not fragile
- be readable
- include regression coverage where practical
- be verified
- make the same bug harder to reintroduce
Invalid fixes include:
- broad catch-all error handling
- hidden fallback behavior
- fake success responses
- special-casing one test
- disabling failing checks
- weakening validation
- moving the bug somewhere else
- adding comments instead of enforcement
Testing Requirements
For every fixed bug, add or update tests unless genuinely impractical.
Prefer behavior tests over implementation-detail tests.
Use the project's native tools.
Test intent:
- auth bug means missing/expired/invalid credentials test
- authorization bug means cross-user/cross-tenant access test
- validation bug means malformed/boundary input test
- data bug means persistence/integration test
- retry/job bug means duplicate execution test
- frontend state bug means stale state/cache/rollback test
- file bug means path/type/size/access test
- SSRF bug means private IP/redirect/protocol test
If a test cannot be added, document why and give a manual verification step.
Stop Conditions
Stop only when all are true:
- critical issues are fixed or explicitly blocked
- high issues are fixed or explicitly blocked
- known correctness bugs are fixed or explicitly blocked
- relevant verification passes, or remaining failures are documented as pre-existing
- touched areas were re-audited
- repeated bug patterns were searched
- remaining risks are documented
Do not stop because the first bug is fixed.
Blocker Rules
If blocked, report:
- what was attempted
- what failed
- why it blocks progress
- what evidence is missing
- safest next action
Do not guess. Do not fake verification. Do not pretend incomplete work is complete.
Final Report
Summary
- issues found
- issues fixed
- issues verified
- issues deferred
- remaining risk level
Fixed Issues
For each issue:
- ID
- severity
- category
- root cause
- fix
- tests added/updated
- verification commands
- similar patterns checked
Files Changed
For each changed file/module:
- what changed
- why it changed
Verification
List commands run and results.
Remaining Risks
List anything unresolved, blocked, uncertain, or out of scope.
Do not say "secure." Say exactly what was checked and what passed.
04 同仓库更多 Skills
vercel-react-native-skills
React Native and Expo best practices for performant mobile apps — FlashList/FlatList virtualization, native modules, Reanimated animations, image handling, Hermes. Use when building or optimizing a React Native / Expo app. For web React/Next use `vercel-react-best-practices`; for animation library choice use `framer-motion-animator` or `gsap-performance`.
vercel-react-best-practices
React and Next.js performance patterns from Vercel Engineering — server components, data fetching, bundle optimization, streaming, caching, image optimization. Use when writing, reviewing, or refactoring web React/Next.js code for performance. For runtime profiling use `web-perf`; for code-level UI slowness fixes use `optimize`; for React Native use `vercel-react-native-skills`.
macos-design-guidelines
Apple Human Interface Guidelines for Mac. Use when building macOS apps with SwiftUI or AppKit, implementing menu bars, toolbars, window management, or keyboard shortcuts. Triggers on tasks involving Mac UI, desktop apps, or Mac Catalyst.
hatch-pet
Create, repair, validate, preview, and package Codex-compatible animated pets and pet spritesheets from character art, screenshots, generated images, or visual references. Use when a user wants to hatch a Codex pet, create a custom animated pet, or build a built-in pet asset with an 8x9 atlas, transparent unused cells, row-by-row animation prompts, QA contact sheets, preview videos, and pet.json packaging. This skill composes the installed $imagegen system skill for visual generation and uses bundled scripts for deterministic spritesheet assembly.
gsap-performance
Optimize GSAP animations for 60fps — transforms over layout properties, will-change, batching, render scheduling, scroll-trigger perf. Use ONLY when the project uses GSAP and the user reports jank or wants smoother animation performance. For other libraries use `framer-motion-animator`; for motion design principles (when/why to animate) use `animate`; for animation best-practice rules use `emilkowal-animations`.
golang-pro
Implements concurrent Go patterns using goroutines and channels, designs and builds microservices with gRPC or REST, optimizes Go application performance with pprof, and enforces idiomatic Go with generics, interfaces, and robust error handling. Use when building Go applications requiring concurrent programming, microservices architecture, or high-performance systems. Invoke for goroutines, channels, Go generics, gRPC integration, CLI tools, benchmarks, or table-driven testing.