Learn about security
Leaked keys, DDoS attacks and weak settings take projects down. Learn how to protect what you publish.
Featured
- ConceptsWhat is a brute force attack and how to defend against itA brute force attack tests passwords in bulk until one works. Learn the types (spraying, credential stuffing), how they work and the defenses, with code that runs.
- Problems and errorsMy app was hacked: what to do nowIf your app was hacked, contain access, rotate every secret and preserve the logs before cleaning up. See the right order, how to find the cause and how to recover.
- How-to guidesSecurity checklist for deploying a bot, site or APIA security checklist before you deploy a bot, site or API: secrets in environment variables, dependencies, HTTPS, headers, least privilege and logs.
Concepts6
- What is SQL injection and how to prevent itSQL injection happens when user input becomes part of a SQL query. See how the attack works and how to prevent it with parameterized queries in Node.js and Python.
- What is a brute force attack and how to defend against itA brute force attack tests passwords in bulk until one works. Learn the types (spraying, credential stuffing), how they work and the defenses, with code that runs.
- What is XSS (cross-site scripting) and how to prevent itXSS is when a site delivers an attacker's script to other users' browsers. Learn the types (reflected, stored, DOM), context-aware escaping and what CSP adds.
- What is CSRF and how to protect your forms and APIsCSRF is when another site makes the victim's browser send an authenticated request to yours. See how SameSite, tokens and Origin checks stop the attack.
- What is a DDoS attack?A DDoS attack floods a server with traffic from thousands of machines until it stops serving real users. Learn the three types, how it works and how to spot it.
- What is a web application firewall (WAF)?A WAF is a web application firewall: it reads HTTP requests and blocks attacks like SQL injection and XSS. Learn how it works, its limits and when to use one.
How-to guides5
- HTTP security headers: CSP, HSTS and the restHTTP security headers tell the browser what a page is allowed to do. Learn how to set up CSP, HSTS, nosniff, Referrer-Policy and Permissions-Policy, with code.
- Security checklist for deploying a bot, site or APIA security checklist before you deploy a bot, site or API: secrets in environment variables, dependencies, HTTPS, headers, least privilege and logs.
- How to protect your app from DDoS attacksTo protect against DDoS, combine edge mitigation (CDN and WAF) with rate limiting, timeouts and caching in your app. Step-by-step guide with working code.
- How to keep secrets out of your codeKeep API keys, tokens and passwords out of Git: use environment variables, ignore .env files, scan commits for leaks and rotate any secret that escapes.
- SSH keys: how they work and how to create oneAn SSH key is a key pair (public and private) that proves who you are without a password. Learn to generate an Ed25519 key, use ssh-agent and test it on GitHub.
Problems and errors4
- My app was hacked: what to do nowIf your app was hacked, contain access, rotate every secret and preserve the logs before cleaning up. See the right order, how to find the cause and how to recover.
- Malicious npm packages: how to spot them and what to doA malicious npm package steals credentials or runs code at install time. Learn how it gets in, how to tell if you were hit and what to do right now.
- API key exposed on GitHub: how to revoke and prevent itPushed an API key to GitHub? Revoke it first, then clean the history and rotate the value. Here are the steps and how to stop it from happening again.
- Leaked your bot token? What to do right nowIf your bot token leaked, reset it in the Discord Developer Portal (or with /token in BotFather) first. Learn the right order and how to check the damage.
Costs3
- How much does DDoS protection cost?DDoS protection ranges from included with your hosting or CDN to annual subscriptions. See how each model bills, what drives the price and what going without costs.
- How much does a WAF cost?A WAF can come included with your hosting, cost a flat plan fee, bill per rule and request or run as open source. See each model and the costs that stay hidden.
- Pentest vs vulnerability scanner: what each one costsDependency scanners and DAST have open source tools with no license; a manual pentest is billed per project or per tester-day. See what each one finds and costs.
Comparisons3
- Authentication vs authorization: the difference in practiceAuthentication confirms who you are; authorization decides what you can do. Learn 401 vs 403, roles, scopes and the bug of checking only the login, with code.
- JWT vs cookie sessions: which to use for loginWith sessions, state lives on the server and the cookie holds an ID; with JWT, the data travels in the token. Compare logout, CSRF, XSS and multiple instances.
- Hashing vs encryption vs encoding: the differencesEncoding changes format with no secret, hashing makes a one-way digest and encryption hides data behind a key. See code examples and when to use each one.
Which to choose3
- Best way to store passwords: bcrypt, scrypt or Argon2To store passwords, use Argon2id at the minimum OWASP recommends today (19 MiB of memory). See when scrypt, bcrypt or PBKDF2 fit, with code and a migration path.
- npm audit, pip-audit, Dependabot or OSV: how to find vulnerable dependenciesTo find vulnerable dependencies, run npm audit or pip-audit in CI and turn on Dependabot. See what each tool reads, where alerts come from and when OSV-Scanner fits.
- Where to store secrets: .env, platform variables or a vaultKeep secrets in a .env file only for local work, in platform variables in production, in CI secrets for the pipeline and in a vault once teams and rotation grow.