XSS, CSRF, weak headers and exposed secrets โ the practical security checklist every website owner should run through.
Why Small Sites Get Hacked
Attackers do not hand-pick targets โ they scan the whole internet for known vulnerabilities automatically. Small business sites are hit constantly precisely because nobody expects them to be targeted and they are rarely patched.
The good news: the overwhelming majority of attacks are automated and generic. A modest set of defences defeats almost all of them.
The Headers Checklist
HTTPS everywhere (with HSTS), a Content-Security-Policy that controls which scripts can run, X-Content-Type-Options: nosniff, and frame protection so your site cannot be embedded by others. These headers cost nothing and neutralise entire attack classes.
CSP is the highest-value one: it blocks injected scripts even when other defences fail. Start in report-only mode, watch the violations, then enforce.
Input and Output Discipline
XSS: never inject user input into HTML without escaping. React's JSX escapes by default โ the danger is dangerouslySetInnerHTML, href attributes with user data, and markdown renderers. Sanitise on output, not just input.
SQL injection is solved by parameterised queries โ if you are writing SQL, never concatenate user input into the string. CSRF is handled by SameSite cookies and CSRF tokens on state-changing requests.
Secrets and Access
API keys belong in server-side environment variables โ never in client code, never in the repository. Anything in a browser bundle is public, full stop.
Rotate credentials after staff changes. Enable two-factor authentication on your host, registrar and admin panels. The registrar is the crown jewel: lose it and attackers can redirect your whole domain.
Maintenance Is Security
Most breaches happen through known vulnerabilities in outdated dependencies. Automate updates (Dependabot or similar), review and merge the safe ones weekly, and subscribe to security advisories for your stack.
Backups complete the picture: automated, tested, and stored off-site. A backup you have never restored is a hope, not a backup.
Conclusion
Security is not a feature you add once โ it is a short checklist you run consistently: strong headers, sanitised output, secrets on the server, dependencies current, backups tested. Small sites that do these five things are dramatically safer than the average site on the internet.
I ship every site with hardened headers and security best practices configured from day one. Want an audit of your current site? Let's talk.
Want help with your project?
I build fast, modern and SEO-ready websites. Let's talk about what you need โ I usually respond within a few hours.
Get in Touch โ
Malik Kashan
Frontend & WordPress Developer ยท Lahore, Pakistan
I build fast, SEO-ready websites for startups and businesses worldwide using Next.js, React and WordPress.
Hire Me for Your Project
