askill
security-best-practices

security-best-practicesSafety 100Repository

Secure programming best practices based on the OWASP Cheat Sheet Series. Use this skill whenever writing, reviewing, or discussing application security, input validation, authentication, authorization, cryptography, session management, error handling, logging, or any code that handles user input, secrets, HTTP headers, file uploads, or API endpoints. Also use when someone asks about preventing common vulnerabilities (XSS, SQL injection, CSRF, SSRF, etc.), securing infrastructure (Docker, Kubernetes, CI/CD), or reviewing dependencies for supply chain risks. This skill should be consulted proactively during code review and security audit tasks, even if the user does not explicitly mention security.

0 stars
1.2k downloads
Updated 3/18/2026

Package Files

Loading files...
SKILL.md

Secure Programming Best Practices

Actionable security checklists organized by OWASP Top 10 (2021) categories. Each item links to the relevant OWASP Cheat Sheet for detailed guidance.

When you need more detail on a specific topic, fetch the linked cheat sheet URL.

How to Use

  1. Identify which categories are relevant to the code being written or reviewed
  2. Walk through the checklist items for those categories
  3. Fetch the linked OWASP cheat sheet for every checklist item that could be relevant — do not rely solely on the checklist summaries here; load the full cheat sheet to get detailed, up-to-date guidance. When in doubt about relevance, fetch it.
  4. For framework-specific guidance, see the Framework-Specific Security section and fetch the corresponding cheat sheet
  5. Always include OWASP cheat sheet URLs in your output so the reader can follow up

Base URL for all cheat sheets: https://cheatsheetseries.owasp.org/cheatsheets/


A01: Broken Access Control

  • Deny access by default; require explicit grants (Access Control)
  • Enforce authorization server-side; never rely on client-side checks (Authorization)
  • Use indirect object references or validate ownership before returning resources (IDOR Prevention)
  • Apply rate limiting and account lockout to prevent brute-force
  • Log all access control failures and alert on repeated attempts
  • Invalidate sessions and tokens on logout and password change (Session Management)
  • Validate CORS configuration; avoid Access-Control-Allow-Origin: * for authenticated endpoints (HTTP Headers)
  • For multi-tenant systems, enforce tenant isolation at every data access layer (Multi-Tenant Security)

A02: Cryptographic Failures

  • Use TLS 1.2+ for all data in transit; disable older protocols (TLS)
  • Enable HSTS with includeSubDomains and adequate max-age (HSTS)
  • Use strong, modern algorithms (AES-256-GCM, ChaCha20-Poly1305); avoid DES, RC4, MD5, SHA-1 (Cryptographic Storage)
  • Store passwords with Argon2id, bcrypt, or scrypt — never plain hashes (Password Storage)
  • Manage secrets through a vault or environment variables; never hardcode (Secrets Management)
  • Rotate keys on a defined schedule; support key versioning (Key Management)

A03: Injection

A04: Insecure Design

A05: Security Misconfiguration

  • Disable unnecessary features, ports, services, and default accounts
  • Harden Docker containers: non-root user, read-only filesystem, minimal base image (Docker Security)
  • Apply Kubernetes security best practices: pod security policies, network policies, RBAC (Kubernetes Security)
  • Scan IaC templates for misconfigurations before deployment (IaC Security)
  • Disable XML external entity processing in all XML parsers (XXE Prevention)
  • Set security headers: X-Content-Type-Options, X-Frame-Options, Referrer-Policy, etc. (HTTP Headers)
  • Secure CI/CD pipelines: least-privilege tokens, signed artifacts, audit logs (CI/CD Security)

A06: Vulnerable and Outdated Components

A07: Identification and Authentication Failures

  • Enforce minimum password complexity and check against breached password lists (Authentication)
  • Implement MFA for privileged and sensitive operations (MFA)
  • Generate session IDs server-side with high entropy; regenerate after authentication (Session Management)
  • Secure password reset flows: time-limited tokens, side-channel verification (Forgot Password)
  • Prevent credential stuffing with rate limiting, CAPTCHA, and device fingerprinting (Credential Stuffing Prevention)
  • Implement OAuth 2.0 with PKCE for public clients (OAuth 2.0)
  • Set cookie attributes: Secure, HttpOnly, SameSite, proper Path and Domain (Cookie Theft Mitigation)

A08: Software and Data Integrity Failures

  • Never deserialize untrusted data; if required, validate schema and use safe libraries (Deserialization)
  • Protect against mass assignment: explicitly allowlist assignable fields (Mass Assignment)
  • Validate file uploads: check type via magic bytes (not just extension or Content-Type header), enforce size limits, and re-encode/re-process content to strip metadata and neutralize polyglots. Store outside webroot with random names. Explicitly reject dangerous types: SVG (can contain embedded JavaScript), HTML, executable files (.exe, .sh, .bat), and server-side scripts (.php, .jsp). (File Upload)
  • Verify integrity of software artifacts with checksums and signatures

A09: Security Logging and Monitoring Failures

  • Log authentication events, access control failures, input validation failures, and application errors (Logging)
  • Use consistent log format and vocabulary for automated analysis (Logging Vocabulary)
  • Never log sensitive data: passwords, tokens, PII, credit card numbers
  • Return generic error messages to users; log detailed errors server-side (Error Handling)
  • Set up alerts for anomalous patterns: brute force, privilege escalation, unusual data access

A10: Server-Side Request Forgery (SSRF)

  • Validate and sanitize all user-supplied URLs (SSRF Prevention)
  • Use allowlists for permitted domains and protocols
  • Block requests to internal/private IP ranges (127.0.0.0/8, 10.0.0.0/8, 169.254.0.0/16, etc.)
  • Disable unnecessary URL schemes (file://, gopher://, ftp://)
  • Run server-side HTTP clients in network-restricted environments when possible

API Security

  • Authenticate and authorize every API request (REST Security)
  • Validate request content types and reject unexpected media types
  • Apply rate limiting and request size limits
  • For GraphQL: limit query depth and complexity; disable introspection in production (GraphQL)
  • For gRPC: use TLS, validate protobuf messages, implement interceptor-based auth (gRPC Security)
  • For WebSockets: validate origin, authenticate the handshake, validate all messages (WebSocket Security)
  • Prevent CSRF with synchronizer tokens or SameSite cookies (CSRF Prevention)
  • Validate redirect URLs against an allowlist (Unvalidated Redirects)

AI and LLM Security

Framework-Specific Security

When working with a specific framework, consult the relevant cheat sheet for framework-specific pitfalls and mitigations:

FrameworkCheat Sheet
DjangoDjango Security, Django REST Framework
LaravelLaravel
SymfonySymfony
Ruby on RailsRuby on Rails
Node.jsNode.js Security, Node.js Docker
.NET.NET Security
JavaJava Security, Injection Prevention in Java
C/C++C-Based Toolchain Hardening

Additional References

For topics not covered above, browse the full index: OWASP Cheat Sheet Series Index

Install

Download ZIP
Requires askill CLI v1.0+

AI Quality Score

95/100Analyzed 2/23/2026

Excellent security best practices skill based on OWASP Top 10 (2021). Comprehensive coverage of all categories with actionable checklists, direct links to OWASP cheat sheets, and clear usage instructions. Well-structured, reusable, and safe. Not project-specific - applies universally to any codebase. Minor room for improvement would be adding A10 (Server-Side Request Forgery) if OWASP updated their list, but otherwise near-complete.

100
90
95
95
95

Metadata

Licenseunknown
Version-
Updated3/18/2026
Publisherlklimek

Tags

apici-cddatabasegraphqlllmobservabilitypromptingsecurity