guest@websec ~ % cat README
Developer Field Guide
Practical security, server hardening, and Rails API engineering for our team — organized into three hands-on tracks. Press / (or ⌘K) anytime to search every topic.
track #1 · 23 topics + 2 surveysWeb SecurityEvery lesson breaks down one real-world attack in plain English, lets you try it live, and states clearly: does Rails protect us, or is it our job?track #2 · 4 interactive lessonsUbuntu Server & SSLTake a brand-new Ubuntu 24.04 box to production-ready: SSH keys, firewall, folders, Let's Encrypt SSL (single & wildcard), and how TLS works.track #3 · 10 interactive lessonsRuby on Rails API GuideHow we structure and build API-only Rails apps: commands, migrations, models, callbacks, base controllers, services, routes and tests.
_ __ __ _____ _ __
| | / /__ / /_ / ___/___ _______ _______(_) /___ __
| | /| / / _ \/ __ \ \__ \/ _ \/ ___/ / / / ___/ / __/ / / /
| |/ |/ / __/ /_/ / ___/ / __/ /__/ /_/ / / / / /_/ /_/ /
|__/|__/\___/_.___/ /____/\___/\___/\__,_/_/ /_/\__/\__, /
/____/
#1 · Web Security: how to read this guide
Each page covers one topic in 5–10 minutes. Going in order (1–2 topics per week for team sessions) works best because later chapters build on earlier ones.
★ TL;DR & ChecklistsEvery lesson starts with the single rule to remember and ends with quick self-check questions.
▶ Sequence FlowsStep through animated request/response diagrams (or click any numbered step) to trace an attack and its fix.
⚡ Interactive LabsPurple boxes run safe, real simulations in your browser — test payloads and flip defenses on and off.
Rails / Node CodeCode blocks default to Rails; click Node on any dual-language block (or in the top bar) to compare.
Every topic also shows where Rails stands so nobody assumes the framework is handling something it isn't:
Rails handles this out of the box. Know what not to bypass or undo.
Rails gives you safe building blocks, but you must enable, configure or finish the job.
Rails does nothing here. Protection comes entirely from our own code, architecture and process.
part 1 · start here: injectionWhen untrusted input gets interpreted as SQL, HTML, JS, or shell commands
part 2 · accounts and access controlProving who the user is (AuthN) and enforcing what they may touch (AuthZ)
part 3 · files, browsers and headersHardening redirects, file uploads, browser policies, TLS, and cookies
part 4 · server side and secretsOutbound fetches, unsafe parsers, secret keys, cryptography, and gem CVEs
part 5 · operations and designAdmin isolation, safe error handling, business-logic races, and incident response
part 6 · questionnairesPrivate self-assessments to check what stuck
OWASP Top 10:2025 at a glance
The OWASP Top 10 is the industry's list of the biggest web risks. Here's where each one lives in this guide, and how much Rails helps:
| # | risk | Rails | pages |
|---|
| A01 | Broken Access Control incl. IDOR, BFLA, CSRF, SSRF | partial CSRF tokens and open-redirect protection on by default; authorization and object scoping are ours | 07 08 09 13 18 |
| A02 | Security Misconfiguration debug modes, dashboards, defaults, headers | partial good production defaults; mounted dashboards, hosts, CSP are ours | 11 12 19 |
| A03 | Software Supply Chain Failures vulnerable gems, CDNs, CI | your job Brakeman in CI for new apps; patching gems and pinning scripts is ours | 12 17 |
| A04 | Cryptographic Failures TLS, storage, keys, randomness | partial force_ssl, encrypted cookies, has_secure_password; field encryption is opt-in | 05 12 15 16 |
| A05 | Injection SQL, XSS, command, header | partial ERB escaping and AR parameterization by default; raw/html_safe/interpolation are ours | 02 03 04 |
| A06 | Insecure Design business logic, races, threat modeling | your job nothing built in | 20 |
| A07 | Authentication Failures passwords, sessions, MFA, brute force | partial auth generator, rate_limit, secure sessions; MFA and lockout are ours | 05 06 08 |
| A08 | Software or Data Integrity Failures deserialization, SRI, unsigned data | partial JSON cookies and safe YAML by default; Marshal and CDN scripts are ours | 12 14 |
| A09 | Security Logging & Alerting Failures what to log, alerts, response | partial request logs with filtered params; security events and alerts are ours | 08 21 |
| A10 | Mishandling of Exceptional Conditions fail-open, errors, limits | partial generic error pages, transactions roll back; fail-closed logic is ours | 19 |
The threat model in one picture
Almost every attack in this guide targets one of these trust boundaries. Hover or tap a layer.
trust boundariestap a layer
Browser → Network → Server → Database. Pick a layer.
#2 · Ubuntu Server & SSL
Set up a fresh Ubuntu server, issue Let's Encrypt certificates (single-domain and wildcard), and understand how HTTPS works under the hood.
lesson s01Ubuntu Server SetupSSH, sudo user, root login off, ufw, Docker, nvm, rvm, pyenv○ unread
lesson s02Ubuntu Server FoldersWhat every folder from / is for, what you may touch, and where things live○ unread
lesson s03Let's Encrypt SSL CertificatesRequest single-domain (HTTP-01) and wildcard (DNS-01) certs with Certbot○ unread
lesson s04How SSL / TLS WorksCertificates, CAs, public/private vs session keys, and TLS 1.3 — zero math○ unread
#3 · Ruby on Rails API Guide
How we build API-only Rails apps, based on our real code. Every lesson has terminals you can run, interactive simulators and short quizzes. Go in order: basics → models → controllers → routes and tests.
part 1 · basicsProject layout, daily CLI commands, and safe schema changes
part 2 · modelsData rules, ApplicationRecord defaults, and callback execution order
part 3 · controllers and servicesRequest filtering, base controllers, and clean layer boundaries
part 4 · routes and testsRESTful URL design, named helpers, and Minitest integration tests