Security
The security basics AI-built apps skip — secrets, logins, row-level security, bot abuse — and the isolation that keeps untrusted code contained.
140 posts · page 2 of 6
CIDR Notation Explained: What /24, /16 and /32 Mean
CIDR notation like 192.168.1.0/24 describes a range of IP addresses in one line — you'll meet it in firewall rules, database access lists and cloud networking. What the slash number means, a cheat sheet of common sizes, how to allow a single IP, and the mistakes that open your server to the whole internet.
403 Forbidden Error: What It Means and How to Fix It
A 403 Forbidden means the server understood your request and refuses to allow it. The common causes — file permissions and missing index files in Nginx, wrong API keys or roles, private S3 buckets, CSRF and CORS confusion, Cloudflare and WAF blocks — and how to tell which one you've hit.
"Your Connection Is Not Private" on Your Own Site: Causes and Fixes
When visitors see NET::ERR_CERT_DATE_INVALID, ERR_CERT_COMMON_NAME_INVALID or ERR_CERT_AUTHORITY_INVALID on your site, the SSL certificate is expired, for the wrong name, or incomplete. How to tell which, and how to fix each one.
What Is Tailscale? A Private Network for Your Devices and Servers
Tailscale builds a private, encrypted network (a tailnet) between your laptops, phones and servers using WireGuard, with no ports to open. How it works, common uses — private SSH, reaching databases and admin tools, home labs — MagicDNS, ACLs, Funnel and Serve, and alternatives like Headscale and plain WireGuard.
What Is HSTS? Strict-Transport-Security Explained
HSTS tells browsers to only ever use HTTPS for your site, closing the gap where a first HTTP request could be intercepted. How the header works, max-age, includeSubDomains and preload, how to roll it out safely, and how to set it in Nginx, Caddy, Express and Next.js.
What Is Cloudflare? What It Does When You Put Your Site Behind It
Cloudflare sits between your visitors and your server: DNS, a CDN, free SSL, DDoS protection and a firewall. What changes when you turn on the orange cloud, what it costs, what it can break, and whether a small app needs it.
WebAssembly as a Sandbox: Running Untrusted Code With Wasmtime and WASI
WebAssembly's design makes it a strong in-process sandbox: linear memory, no ambient authority, and capability-based access through WASI. How the isolation works, limiting CPU with fuel and epochs, memory limits, the component model, real uses for plugins and user code, and where it falls short.
UFW Firewall Basics: Lock Down a Linux Server in Five Commands
A firewall decides which network traffic can reach your server. UFW makes Linux's firewall simple: allow SSH, HTTP and HTTPS, deny the rest. The commands, how not to lock yourself out, why your database port should never be open, and the Docker gotcha that bypasses UFW.
The TLS 1.3 Handshake Explained: What Happens Before the First Byte
What actually happens when a browser connects over HTTPS: ClientHello, key shares, the server's certificate and signature, Finished messages, one round trip instead of two, 0-RTT resumption and its replay risk, SNI and ECH, certificate chain validation, and how to inspect it all with openssl.
Writing a systemd Service File for Your App (With Hardening)
A production-ready systemd unit for a Node.js or Python app, explained: Type, User, WorkingDirectory, EnvironmentFile, Restart and backoff, graceful stop, resource limits, logging, and the sandboxing options (ProtectSystem, NoNewPrivileges, PrivateTmp) that limit damage if the app is compromised.
The Supabase MCP Server: Let AI Work With Your Database (Safely)
Supabase's MCP server lets Claude Code, Cursor and other AI tools inspect your tables, run SQL, apply migrations and read logs. How to connect it, why you should scope it to one project in read-only mode, and the risks of giving an AI database access.
SSRF Explained: When Your Server Fetches URLs for Attackers
Server-side request forgery tricks your server into making requests to places it shouldn't — internal services, cloud metadata endpoints, localhost admin panels. Where SSRF hides (URL previews, webhooks, imports, AI agents with fetch tools), why blocklists fail, and the defences that work.
SSH Hardening: Lock Down SSH on Your Server
A practical SSH hardening checklist: key-only authentication, no root login, AllowUsers, modern key types, sshd_config drop-ins, testing safely without locking yourself out, fail2ban, firewall rules or a private network like Tailscale, 2FA, and auditing who has access.
How to Secure a New VPS: The First 30 Minutes
A fresh server is scanned within minutes of going online. The essential hardening steps for a new Ubuntu VPS: updates, a non-root user, SSH keys only, firewall, automatic security patches, fail2ban, safe service binding, backups and monitoring — in order, with commands.
GitHub Secret Scanning and Push Protection: Stop Leaking API Keys
Secret scanning finds API keys, tokens and passwords committed to your repository; push protection blocks them before they're pushed. How both work on GitHub, what to do when one fires, why deleting the commit isn't enough, and local tools like gitleaks and pre-commit hooks.
Refresh Tokens Explained: Short-Lived Access, Long-Lived Sessions
Access tokens should expire quickly; refresh tokens let users stay logged in without re-entering passwords. How the pair works, where to store each, refresh token rotation and reuse detection, revocation, handling refresh in the front end, and when plain session cookies are simpler.
The Principle of Least Privilege, Explained for App Builders
Give every user, service, key and AI agent only the access it needs — nothing more. What least privilege means, and practical examples for databases, API keys, cloud accounts, servers, team members and AI coding agents, so one mistake or breach can't take everything down.
Postgres Roles and Permissions: CREATE USER, GRANT, and Least Privilege
Most apps connect to Postgres as a superuser, so one SQL injection or rogue AI command can drop everything. How Postgres roles, privileges, schemas and default privileges work, and a practical setup with separate owner, app and read-only roles.
What Are Passkeys? Passwordless Login Explained
Passkeys replace passwords with a key pair stored on your device and unlocked with your fingerprint, face or PIN. How they work, why they can't be phished or leaked from a database, syncing across devices, and what adding passkey login to your own app involves.
What Is an Open Redirect Vulnerability? (And How to Fix It)
An open redirect lets anyone use your domain to send people to any other site — perfect for phishing links that look trustworthy. How it happens with ?next= and ?returnTo= parameters, why it's worse with OAuth, and the safe ways to redirect after login.
OAuth PKCE Explained: Why Every OAuth Flow Should Use It
PKCE (Proof Key for Code Exchange) protects the OAuth authorization code flow from code interception. How code_verifier and code_challenge work step by step, why it's required for SPAs and mobile apps and recommended for everyone, the state parameter, and the mistakes to avoid.
Next.js Server Actions: Forms and Mutations Without API Routes
Server Actions (Server Functions) let a form or button call a function that runs on the server, without writing an API route. How 'use server' works, forms with useActionState, validation with Zod, revalidating data, pending states — and why every action is a public endpoint that needs its own auth checks.
"new row violates row-level security policy" in Supabase: How to Fix It
Supabase (Postgres) blocked an insert or update because no RLS policy allows it. Why it happens, how to write an INSERT policy with WITH CHECK, the user_id default trick, the hidden SELECT-after-insert problem, storage uploads, and why you must never 'fix' it by disabling RLS.
Mutual TLS (mTLS) Explained: When the Server Checks You Too
In normal TLS only the server proves its identity. With mutual TLS the client presents a certificate too. How the mTLS handshake works, running a private CA, issuing and rotating short-lived client certificates, configuring Nginx and Node, mTLS in service meshes and webhooks, and the operational traps.