There is no 100% secure website

There is no such thing as a 100% secure website. Anyone offering you that number is selling something else, and the number is the tell.

What does exist is a site that costs more to break into than it returns, that degrades instead of collapsing when one part fails, and that can be restored to a known-good state without guesswork. That is the whole objective. Everything below serves it, and every layer is written on the assumption that the layer in front of it has already failed.

This follows on from the 2026 attack surface, which deliberately covered threats and stopped there.

The perimeter

Put a Web Application Firewall and a CDN in front of the origin, so traffic is inspected at the edge rather than by the machine that also runs your application. Botnets, injection probes and volumetric floods are filtered before they consume anything you pay for.

Enforce HSTS rather than settling for a valid certificate. Strict-Transport-Security tells the browser to use HTTPS for this host and never to accept a downgrade, which closes the window in which a first plaintext request can be intercepted.

Keep the origin IP address out of public view. If the origin answers direct requests from anywhere, the WAF in front of it is a suggestion - configure the server firewall so only the proxy ranges may reach ports 80 and 443, and so administrative ports are not publicly reachable at all.

Identity and access

Passwords are not a factor worth counting on their own. Require TOTP at minimum, and FIDO2/WebAuthn hardware keys where the account can change things that matter - hardware keys are the only widely deployed factor that resists phishing rather than merely slowing it down.

Grant the minimum that lets someone do today's work, and revoke it when the work ends. Most breached credentials in small projects belong to a contractor whose engagement finished eighteen months ago and whose access nobody remembered to close.

Move administration off predictable paths, and put access control in front of it rather than only inside it - an allowlist, a tunnel, or an identity-aware proxy. A login form that the whole internet can reach is a login form the whole internet will try.

Code and supply chain

Run software composition analysis in the pipeline, not once a quarter by hand. Third-party packages account for the majority of web application compromises, and the useful property of automation is that it reacts the day an advisory is published rather than the week someone next looks.

Validate and parameterise on the server. Client-side validation is a usability feature; it is bypassed by anyone who opens developer tools. Every query that touches user input uses prepared statements, without exception, because the exception is where the injection lives.

Keep secrets out of the source tree and out of the web root. Environment files, keys and database passwords live outside the directory the server can serve, and the server is configured to refuse /.env and /.git explicitly - an exposed .git directory hands over the entire history of the application, including the credentials somebody committed once and removed in the next commit.

When it goes wrong anyway

Keep backups on the 3-2-1 rule: three copies, two storage types, one off-site - and make the off-site copy immutable, so that ransomware which reaches your infrastructure cannot reach your recovery. Then restore from them on a schedule. A backup nobody has restored is a hypothesis, not a safeguard.

Set the response headers that constrain what a compromised page can do: Content-Security-Policy, X-Frame-Options, X-Content-Type-Options, Referrer-Policy. CSP is the one that repays real effort - a strict policy means an injected script has nowhere to load from and nowhere to send to.

Ship logs off the machine that generates them. Authentication events, file changes and database errors go to somewhere the attacker does not control, because the first thing a competent intruder edits is the log that records the intrusion. Alert on the boring signals: repeated failed logins, a file modified outside a deploy, a new admin account.

What "secure" actually means

Not a state, and not a purchase. It is the property of a system where every layer assumes a breach in front of it and limits what that breach reaches - and where somebody checks, on a schedule, that the assumptions still hold.

The honest version of the promise is not that nothing will happen. It is that when something does, it is contained, visible, and reversible.