Web Application Security: Decisions to Make Before Writing Code

Where to address common weaknesses such as XSS, CSRF and SQL injection, and the mistakes we see most often.

Web Application Security: Decisions to Make Before Writing Code

The most expensive security mistake in web development is treating security as a checklist before release. Authentication, authorisation and input validation decisions are made during architecture. Every patch added later pays for an earlier decision.

For SQL injection, use prepared statements and never concatenate user input into query text. Against XSS, encode output for its context, because the HTML body, attributes and JavaScript each need different rules. Against CSRF, validate a token on every request that changes state. Set HttpOnly, Secure and SameSite on session cookies. Keep passwords and tokens out of logs, and update dependencies regularly. Each of these steps closes a different class of attack, and none of them replaces the others.

Share:

Planning a similar project?

We can talk through how the topic in this article applies to your product.

More articles

Browse our other technical articles