Security Fundamentals for Builders
Most security breaches come from a handful of well-understood mistakes. Knowing the fundamentals - and using standard, verified tools instead of home-grown ones - prevents the vast majority.
Security can feel like a vast, intimidating field, but in practice most real-world breaches come from a small set of well-known mistakes, and most can be prevented by following a few principles - chief among them, using correct, standard, well-tested tools rather than inventing your own. This course uses the Larz stack's security family; first, the mindset and fundamentals that underpin all of it.
The common mistakes
A handful of vulnerability classes cause a large share of breaches. Knowing them is half the battle.
| Common vulnerability | The defence |
|---|---|
| Injection (SQL, etc.) | Never mix untrusted input into code (use larzsql) |
| Weak/plaintext passwords | Strong hashing (never store plaintext) |
| Leaked secrets/keys | Proper secrets management, never in code |
| Broken auth / missing checks | Standard auth, verify on every request |
These aren't exotic - they're the same mistakes, repeated. Defending against this short list prevents most trouble, and the stack gives you correct tools for each.
Don't roll your own crypto
The cardinal rule: never invent your own cryptographic algorithms or security-critical code. Use standard, well-reviewed, verified implementations.
The security mindset
- Assume input is hostile - validate and never mix it into code.
- Never store secrets in plaintext - hash passwords, encrypt secrets.
- Use standard, verified tools - don't invent crypto or auth.
- Defence in depth - multiple layers; assume any one can fail.
๐งฉ Do it with LarzOS
Turn this lesson into action with the exact free tools and AI workflows for the job:
๐ฏ Key takeaways
- Most breaches come from a short list of well-known mistakes - injection, weak passwords, leaked secrets, broken auth.
- Defending that short list prevents most trouble; the stack provides a correct tool for each.
- Never roll your own crypto - use standard algorithms via verified implementations.
- The stack's security libraries implement standard algorithms and verify them against RFC test vectors.
Frequently asked
Why is 'don't roll your own crypto' such an absolute rule?
Because cryptography fails silently and catastrophically. Unlike normal code, where a bug usually produces a visible wrong result, a flawed crypto implementation often looks like it works perfectly - it encrypts, it decrypts - while being completely broken in ways only an expert attacker will find and exploit. Subtle issues (timing, randomness, padding, protocol details) can undermine security entirely with no outward sign. Getting it right requires deep specialist expertise and extensive review, which is why you use standard algorithms via well-tested, widely-reviewed implementations rather than inventing your own. The stack follows this: it implements the standard algorithms and verifies them against the official RFC test vectors, giving you checkable correctness instead of invisible risk.
I'm not a security expert - can I really build secure software?
Yes - because building securely is mostly about using correct tools and following well-known principles, not about being a cryptographer. The vast majority of breaches come from avoidable, well-understood mistakes (injection, plaintext passwords, leaked keys, missing checks), and defending against those is achievable with standard practices and libraries: use injection-safe queries, hash passwords properly, manage secrets outside your code, verify auth on every request, and never invent crypto. The stack's security libraries handle the hard cryptographic parts correctly for you, so your responsibility is to use them properly and apply the fundamentals. You don't need to be an expert to avoid the common, costly errors - which is what security is largely about in practice.
Related lessons
Hashing & Encryption with larzcrypt
The two workhorses of security: hashing (for passwords and integrity) and encryption (for โฆ
Security & Identity with the Larz StackManaging Secrets with larzvault
API keys, passwords, tokens - every app has secrets, and leaking them is a top cause of brโฆ