Secure Development Mindset
Security comes from how software is designed and written. Assume that mistakes, misuse and attacks will happen, and build so that their impact stays small.
Design rules that limit damage
- Least privilege: give every user, service and token only the access it needs. A compromised component then does limited damage.
- Defence in depth: use several checks. Validate input, authorise each request, log what happens and restrict the network, so one failure is not fatal.
- Anything that crosses a boundary (a browser, an API caller, a file, another service) may be wrong or hostile, so never trust input. See Input Validation.
- Make the safe option the default: closed by default, encrypted by default, no debug features in production.
- When something breaks, deny access and do not leak internals in error messages. See Error Handling.
- Less code and fewer features mean fewer places for flaws. Use well-tested libraries for cryptography and login code.
Habits in daily work
- Ask “what could go wrong, and who might abuse this?” when you design a feature or review a pull request.
- Keep secrets out of code, logs and chat.
- Update dependencies regularly.
- Collect only the data you need (see Data Privacy Awareness).
- Treat security findings as normal bugs: report, prioritise and fix them without blame.
Learning the main attacks
You do not need to memorise attack techniques. Skim lists such as the OWASP Top 10 and learn the main ones in Common Vulnerabilities. When you are unsure whether something is safe, ask a colleague or the security team early. That is cheaper than a fix after release.
Try it
Pick a small feature you built or use, such as a login form or a file upload. Work out how someone could misuse it, and which design rule above would limit the damage.
Common mistakes
- Trusting input because it comes from your own front end or another service.
- Leaving debug features on in production.
- Writing your own cryptography or login code.
- Waiting until after release to ask whether something is safe.
Check yourself
- How does least privilege limit the damage from a compromised service?
- What does defence in depth mean in practice?
- What question should you ask when designing a feature or reviewing a pull request?