9.4 Secure Software Development
Security is not a final scan before launch. Secure software development asks the team to reduce attack surface across requirements, design, implementation, testing, release, and operations.
Attackers do not follow your user manual, so engineers must ask how the system can be abused.
Common Web Risks
SQL injection happens when user input is concatenated into a query. Basic defenses include parameterized queries, least-privilege database accounts, and input validation.
XSS happens when untrusted content executes as page script. Basic defenses include output escaping, Content Security Policy, and avoiding dangerous HTML injection.
CSRF uses a user's logged-in state to trigger unintended requests. Basic defenses include CSRF tokens, SameSite cookies, and confirmation for sensitive actions.
Broken authorization lets users see or change resources they do not own. Basic defenses include server-side authorization, object-level checks, audit, and least privilege.
Frontend validation helps experience, but it does not replace server-side security control.
Threat Modeling
Threat modeling does not have to begin as a heavy document. It starts with a few questions:
- What asset are we protecting?
- Who might attack it?
- Where are the entry points?
- Where are the trust boundaries?
- Which controls prevent, detect, or recover from abuse?
Security Is An Engineering Tradeoff
Security controls have cost. Stronger authentication may add friction. Stricter input limits may affect usability. More detailed logs may create privacy risk. Security design also needs explicit tradeoffs and evidence.
A practical security flow includes:
- Identify sensitive assets during requirements.
- Do lightweight threat modeling during design.
- Use secure-default libraries and coding standards during implementation.
- Test abuse paths.
- Scan dependencies and configuration before release.
- Monitor abnormal behavior and prepare response during operations.
Security is not a fear culture. It is engineering discipline that protects users and team trust.