code-security
Security guidelines for writing secure code. Use when writing code, reviewing code for vulnerabilities, or asked to 'check for SQL injection' or 'review security'. IMPORTANT: Always consult this when writing or reviewing code that handles user input, authentication, file operations, database queries, network requests, cryptography, or infra config - even if security is not mentioned.
- License 许可
- MIT
- 最近更新
- 2026-11-02
- Stars
- ★ 0
- Forks
- 0
01 前言 Front Matter
- name
- code-security
- description
- Security guidelines for writing secure code. Use when writing code, reviewing code for vulnerabilities, or asked to 'check for SQL injection' or 'review security'. IMPORTANT: Always consult this when writing or reviewing code that handles user input, authentication, file operations, database queries, network requests, cryptography, or infra config - even if security is not mentioned.
02 资源文件 32
- 参考文档AGENTS.md109.6 KB
- 参考文档README.md2.7 KB
- 参考文档rules/_sections.md6.9 KB
- 参考文档rules/_template.md635 B
- 参考文档rules/authentication-jwt.md2.9 KB
- 参考文档rules/best-practice.md3.1 KB
- 参考文档rules/code-injection.md3.7 KB
- 参考文档rules/command-injection.md3.4 KB
- 参考文档rules/correctness.md3.2 KB
- 参考文档rules/csrf.md3.8 KB
- 参考文档rules/docker.md2.7 KB
- 参考文档rules/github-actions.md5.3 KB
- 参考文档rules/insecure-crypto.md4.1 KB
- 参考文档rules/insecure-deserialization.md6.7 KB
- 参考文档rules/insecure-transport.md5.3 KB
- 参考文档rules/kubernetes.md4.4 KB
- 参考文档rules/maintainability.md1.8 KB
- 参考文档rules/memory-safety.md3.1 KB
- 参考文档rules/path-traversal.md5.4 KB
- 参考文档rules/performance.md3.1 KB
- 参考文档rules/prototype-pollution.md2.6 KB
- 参考文档rules/race-condition.md7.0 KB
- 参考文档rules/regex-dos.md3.7 KB
- 参考文档rules/secrets.md4.1 KB
- 参考文档rules/sql-injection.md5.3 KB
- 参考文档rules/ssrf.md5.0 KB
- 参考文档rules/terraform-aws.md4.3 KB
- 参考文档rules/terraform-azure.md9.8 KB
- 参考文档rules/terraform-gcp.md8.5 KB
- 参考文档rules/unsafe-functions.md4.9 KB
- 参考文档rules/xss.md5.2 KB
- 参考文档rules/xxe.md4.5 KB
03 SKILL.md 正文
Code Security Guidelines
Comprehensive security rules for writing secure code across 15+ languages. Covers OWASP Top 10, infrastructure security, and coding best practices with 28 rule categories.
How to Use This Skill
Proactive mode — When writing or reviewing code, automatically check for relevant vulnerabilities based on the language and patterns present. You don't need to wait for the user to ask about security.
Reactive mode — When the user asks about security, use the categories below to find the relevant rule file, then read it for detailed vulnerable/secure code examples.
Workflow
- Identify the language and what the code does (handles input? queries a DB? reads files?)
- Check the relevant rules below — focus on Critical and High impact first
- Read the specific rule file from
rules/for detailed code examples in that language - Apply the secure patterns, or flag the vulnerable patterns if reviewing
Language-Specific Priority Rules
When writing code in these languages, check these rules first:
| Language | Priority Rules to Check |
|---|---|
| Python | SQL injection, command injection, path traversal, code injection, SSRF, insecure crypto |
| JavaScript/TypeScript | XSS, prototype pollution, code injection, insecure transport, CSRF |
| Java | SQL injection, XXE, insecure deserialization, insecure crypto, SSRF |
| Go | SQL injection, command injection, path traversal, insecure transport |
| C/C++ | Memory safety, unsafe functions, command injection, path traversal |
| Ruby | SQL injection, command injection, code injection, insecure deserialization |
| PHP | SQL injection, XSS, command injection, code injection, path traversal |
| HCL/YAML | Terraform (AWS/Azure/GCP), Kubernetes, Docker, GitHub Actions |
Categories
Critical Impact
- SQL Injection (
rules/sql-injection.md) - Use parameterized queries, never concatenate user input - Command Injection (
rules/command-injection.md) - Avoid shell commands with user input, use safe APIs - XSS (
rules/xss.md) - Escape output, use framework protections - XXE (
rules/xxe.md) - Disable external entities in XML parsers - Path Traversal (
rules/path-traversal.md) - Validate and sanitize file paths - Insecure Deserialization (
rules/insecure-deserialization.md) - Never deserialize untrusted data - Code Injection (
rules/code-injection.md) - Never eval() user input - Hardcoded Secrets (
rules/secrets.md) - Use environment variables or secret managers - Memory Safety (
rules/memory-safety.md) - Prevent buffer overflows, use-after-free (C/C++)
High Impact
- Insecure Crypto (
rules/insecure-crypto.md) - Use SHA-256+, AES-256, avoid MD5/SHA1/DES - Insecure Transport (
rules/insecure-transport.md) - Use HTTPS, verify certificates - SSRF (
rules/ssrf.md) - Validate URLs, use allowlists - JWT Issues (
rules/authentication-jwt.md) - Always verify signatures - CSRF (
rules/csrf.md) - Use CSRF tokens on state-changing requests - Prototype Pollution (
rules/prototype-pollution.md) - Validate object keys in JavaScript
Infrastructure
- Terraform AWS/Azure/GCP (
rules/terraform-aws.md,rules/terraform-azure.md,rules/terraform-gcp.md) - Encryption, least privilege, no public access - Kubernetes (
rules/kubernetes.md) - No privileged containers, run as non-root - Docker (
rules/docker.md) - Don't run as root, pin image versions - GitHub Actions (
rules/github-actions.md) - Avoid script injection, pin action versions
Medium/Low Impact
- Regex DoS (
rules/regex-dos.md) - Avoid catastrophic backtracking - Race Conditions (
rules/race-condition.md) - Use proper synchronization - Correctness (
rules/correctness.md) - Avoid common logic bugs - Best Practices (
rules/best-practice.md) - General secure coding patterns
See rules/_sections.md for the full index with CWE/OWASP references.
Quick Reference
| Vulnerability | Key Prevention |
|---|---|
| SQL Injection | Parameterized queries |
| XSS | Output encoding |
| Command Injection | Avoid shell, use APIs |
| Path Traversal | Validate paths |
| SSRF | URL allowlists |
| Secrets | Environment variables |
| Crypto | SHA-256, AES-256 |
04 同仓库更多 Skills
clarify-requirements
Resolve genuine pre-execution ambiguity by scanning repo context, generating 1-6 grounded options, and asking 1-3 focused questions via AskUserQuestion. NOT for mid-task use (injection risk); NOT when the goal is already unambiguous; use to disambiguate vague prompts before any file edits.
openmm-md
Run FREE, open-source, Windows-native GPU molecular dynamics via the openmm-md MCP (OpenMM + CUDA on the local NVIDIA GPU). Use for protein / protein-ligand MD when you want a free stack or are on Windows without a Schrodinger license. Covers the full workflow (prepare, solvate, minimize, equilibrate, production, analyze, mmgbsa) AND an honest decision guide vs Schrodinger Desmond, including how to run Desmond legitimately on Linux or a cloud GPU with a real license. This is a deliberately LESSER free alternative and does NOT replace the schrodinger MCP tools. Do NOT use it to pick a free tool when a validated FEP+, WaterMap, IFD-MD, or Prime MM-GBSA result is actually required.
visual-review
Take screenshots of web pages and UI using Playwright for visual review and iteration
status
Diagnostic status report — shows metaswarm installation state, project setup, and potential issues
start
Use when starting work on any task, when the user mentions metaswarm, or when the user wants to begin tracked development work
setup
Interactive project setup — detects your project, configures metaswarm, writes project-local files