PureCode Software Interview Question

How do you ensure the security of a web application against common vulnerabilities like XSS and SQL injection?