Know what you are protecting
Start by identifying the systems that can change what visitors see. Your registrar controls the domain, GitHub controls the source, and the hosting account controls published files. A compromised account in any of these systems can be more damaging than a bug in a page.
Protect your source and hosting accounts
Use individual accounts, multifactor authentication and the narrowest permissions that allow collaborators to do their jobs. Store recovery codes securely outside the project. Remove access when a contractor leaves and inspect authorization scopes when connecting AI tools.
- Enable MFA and keep a tested recovery path.
- Review repository, DNS and hosting permissions.
- Review changes before allowing production deployment.
Never ship privileged secrets
A static site is public by design. Anyone can inspect delivered HTML and JavaScript. Do not embed a private API key, administrator credential, mail service token or secret database connection string in frontend code. Use a server-side endpoint for privileged operations. If a secret has leaked, rotate it; deleting the file is not enough.
Harden the browser and the build pipeline
Reduce third-party scripts and maintain your dependencies. Add appropriate response headers and test a content security policy before enforcing it. Inspect both the repository and the generated output; a build-time variable can become public if it is embedded in client-side code.
Test the boundaries
A static contact form still needs an endpoint that validates inputs, handles spam and protects stored submissions. Test it from a staging URL. Record the previous working deployment and confirm you can restore it before making infrastructure changes.
- Inspect the published files for secrets.
- Test forms, redirects and HTTPS.
- Review dependency alerts and account permissions regularly.
Common questions
Are static websites unhackable?
No. Static delivery removes some attack surface, but the deployment pipeline, accounts, browsers and external services remain security-critical.
Do static sites need maintenance?
Yes. Keep dependencies and integrations reviewed, renew domains, monitor critical functionality and maintain recovery procedures.
References
Provider interfaces and limits can change. Consult the original documentation before changing production settings.