JWT mistakes that keep showing up in code review
The token is signed, not encrypted. Pin the algorithm, check the claims, and think twice about where you store it and how you will ever revoke it.
Practical security notes for people who build and run web applications and servers.
The token is signed, not encrypted. Pin the algorithm, check the claims, and think twice about where you store it and how you will ever revoke it.
Choosing Argon2id, scrypt, bcrypt or PBKDF2 is the easy part. Setting the cost, upgrading old hashes and avoiding bcrypt truncation is where audits find problems.
Removing a key from the latest commit does nothing for the copies that already exist. The order of the response matters more than the cleanup tool.
A blocklist of "localhost" and "127.0.0.1" fails against decimal IPs, short forms and DNS names that point inward. Validate what the name resolves to.
A fresh server is scanned within minutes. Key-only SSH, automatic security updates and knowing what is listening cover most of what actually gets exploited.
The ORM parameterises values. It does not help with raw fragments, dynamic column names, sort orders or LIKE patterns, which is where the bugs are.
Use the raw request body, compare in constant time, check the timestamp and make the handler idempotent. Most broken verifications fail on the first of those.
Pinning versions protects you from surprises. Pinning hashes protects you from a different package with the same version. Private package names need care too.
Two SPF records, ten DNS lookups, a DKIM key nobody rotated and a DMARC policy that is still p=none after two years. All common, all fixable in DNS.
Technologies