StackPractices

Tag: security

Browse 126 practical software engineering resources tagged with "security". Discover code recipes, design patterns, documentation templates, and in-depth guides to help you build, deploy, and maintain production-ready solutions involving security. Each resource is written for engineers who ship real systems, with copy-paste examples and practical trade-offs.

Application and Infrastructure Security

Security is not a checklist; it is a continuous practice that must be embedded in every layer of the stack. From input validation and secrets management to network hardening and compliance, defensive design reduces risk before it becomes an incident.

The resources below provide practical recipes for authentication, authorization, encryption, secure coding, vulnerability scanning, and incident response. Each guide explains what to do, why it matters, and how to implement it in real code.

Every resource includes clear explanations, copy-paste code, and practical warnings. Use them to make informed decisions, avoid production pitfalls, and speed up your delivery. If you are just getting started, read the beginner-friendly articles first; if you are experienced, jump straight to the advanced patterns and architecture guides. New resources are added regularly, so bookmark this page and check back for the latest patterns.

API Rate Limiting

Protect APIs from abuse and ensure fair resource usage with token bucket, sliding window, and leaky...

WebSocket Authentication and Security Patterns

How to authenticate WebSocket connections, implement token validation, and handle authorization for...

Secure API Key Authentication for Services and Clients

How to generate, distribute, validate, and rotate API keys for machine-to-machine authentication...

Hash Passwords with Argon2

How to hash and verify passwords securely with Argon2id, the winner of the Password Hashing...

Implement ABAC

How to implement attribute-based access control with policy engines, live context evaluation, and...

Implement RBAC

How to implement role-based access control with hierarchical roles, permission grants, and...

Implement SSO with SAML

How to implement SAML 2.0 single sign-on as a Service Provider with XML signature verification, IdP...

JWT Authentication

How to generate, validate, and refresh JSON Web Tokens for stateless API authentication.

Implement Passwordless Login with Magic Links

How to build secure passwordless authentication using time-limited magic links sent via email, with...

Node.js JWT Authentication: Verify and Refresh Tokens

Implement JWT authentication in Node.js with access and refresh tokens

Node.js OAuth2 GitHub Login with Express

Implement GitHub OAuth2 login flow in Node.js with Express and Passport

OAuth 2.0 Login

How to implement OAuth 2.0 authentication with Google, GitHub, and other providers.

How to Hash Passwords Securely (Python, JavaScript, Java)

Learn how to hash and verify passwords with bcrypt, Argon2, and PBKDF2. Practical examples in...

Implement Secure Session Management

How to create, validate, and expire user sessions securely across web applications using cookies,...

Two-Factor Authentication (2FA / TOTP)

How to implement time-based one-time password (TOTP) two-factor authentication for secure user...

Rate Limiting with Redis Token Bucket Algorithm

Implement a distributed token bucket rate limiter using Redis atomic operations for API throttling...

Execute Raw SQL

How to execute raw SQL queries safely with parameterized statements.

Container Image Security Scanning with Trivy

Scan Docker images for vulnerabilities, misconfigurations, and secrets using Trivy, integrate...

Scan Docker Images for CVEs with Trivy and Grype

Scan Docker images for vulnerabilities before deployment using Trivy and Grype. Covers CI...

Slim Production Images with Multi-Stage Docker Builds

How to build minimal production Docker images using multi-stage builds with distroless base images,...