001
Authentication You Do Not Invent
Sign-in is not the place for original ideas. I use a proven provider or a well-maintained library, and I offer passkeys where I can, because they are resistant to phishing in a way passwords never will be. When passwords are stored, they are hashed with Argon2id or bcrypt.
Sessions live in cookies marked HttpOnly, Secure and SameSite, expire after a reasonable time and are revoked on the server when someone signs out. Sign-in and code verification are rate limited, so guessing is slow and noisy.
002
Authorise Every Request
Broken access control sits at the top of the OWASP Top 10 for a reason. Being signed in is not the same as being allowed: on every request, the server checks that this user may read or change this particular record. Someone will change the id in the URL.
Input is validated against a schema at the edge of the system, queries are parameterised, output is encoded for where it is shown, and a Content Security Policy limits the damage if a script ever slips through.
003
Guard the Supply Chain
Most of an application is other people’s code. Lock files are committed, dependency updates arrive as automated pull requests that run the full test suite, and known vulnerabilities fail the build instead of filling a report nobody reads.
New packages get a quick look before they are installed: who maintains them, how widely they are used, and whether the name is spelt exactly right. In CI, third-party actions are pinned to a commit and tokens get only the permissions each job needs.
004
Keep Secrets Secret
Secrets live in the hosting platform’s environment settings or a secrets manager, never in the repository. Secret scanning with push protection catches the mistakes that happen anyway.
Each environment has its own keys with the least access it needs, and keys are rotated when someone leaves or anything looks wrong. Security events such as sign-ins and permission changes are logged, so there is a record to read when it matters.

