BaCheWork and records of a photonics research workhorse
Language

Security for a static personal site: where the real risks are

A static website is hard to hack. The real risks are stolen accounts, accidental exposure, URLs leaking through side doors, and an expired domain.

Type
Essay
Published
2026-10-31
Updated
2026-11-22

A static website has no database and no login, so there are few places to attack. The real risks come down to four things: stolen accounts, things that should stay private being made public, URLs leaking through side doors, and domains expiring and getting taken over.

This chapter covers principles. It also records the fixes I actually made to my own site, including the fact that my own Cloudflare account did not have two-factor authentication turned on. The sequel series “After Your Site Goes Live: Hands-On Security”.

1. Accounts

Account What to do
Cloudflare Turn on two-factor authentication (2FA) with an authenticator app or a hardware key, not SMS alone; save the backup codes
GitHub (where the drafts are kept) Same as above; make the source repo private, unless you want the source code to be public
Email used to register the domain If this inbox is compromised, the domain is compromised too, so turn on 2FA here as well

If you sign in to Cloudflare with a Google account, the account starts out with no Cloudflare password. You have to set one first using “Forgot Password” on the sign-in page before you can turn on 2FA. For details, see Does signing in with Google mean two-step verification is already on?.

Token principles: for tokens used by AI assistants, automated builds, or the web dashboard, keep permissions to the minimum, limit each token to a single repo, and set an expiry date. Do not paste tokens into conversations or commit them to git. Store them in environment variables or in the platform’s “secret” field.

2. Domain

  • DNSSEC: on (see After buying the domain).
  • Auto-renewal: on, and check that the credit card on file has not expired. Once a domain expires, someone else can register it, and every old link ends up pointing to their site.
  • Transfer lock: already on by default when you buy through Cloudflare.
  • WHOIS privacy: Cloudflare masks WHOIS details by default; confirm this once after you buy.

3. HTTPS and extra URLs

  • Always Use HTTPS: on (see After buying the domain).
  • Turn off the extra public URLs: in the Worker settings, set workers_dev: false and preview_urls: false. If you leave them on, the same site gets a second URL at *.workers.dev, and a private page you protect with access control later can also be reached through that URL.
  • HSTS: turn it on only after the site is stable, because a wrong setting is hard to undo.

4. Security headers (_headers file)

Workers static sites support placing a _headers file in the site root. The one wizerdbache.com currently uses:

/*
  X-Content-Type-Options: nosniff
  Referrer-Policy: strict-origin-when-cross-origin
  Permissions-Policy: camera=(), microphone=(), geolocation=()
  • nosniff: browsers do not guess file types, so uploaded files cannot be run as programs.
  • Referrer-Policy: when a visitor clicks an external link, only the domain is sent, not the full URL.
  • Permissions-Policy: turns off the camera, microphone, and location, which the site does not need.
  • Advanced: Content-Security-Policy limits which sources the page may load scripts and images from. It gives the strongest protection, but when you embed YouTube or an external library you have to allow each source one by one, and a mistake can break the site. Add it once the site is stable, and try Content-Security-Policy-Report-Only first.

Verify:

curl.exe -sI https://example.com/ | findstr /i "x-content-type referrer-policy permissions-policy"

5. Pre-launch scan: things that should not be public

This is where personal sites most often go wrong: not because they get hacked, but because you expose something by accident.

Category Examples How to block it
Secrets API keys, tokens, passwords Use a scan script to block them before deploying
Personal data Private email, phone number, home address, the user-folder path on your computer (which often contains your account name) Same as above; also read through it by hand
EXIF data in photos GPS location, time taken, camera serial number Remove it before uploading. Conversion tools usually have an option for this, or ask the AI assistant to strip it automatically during the build
Client or collaboration work Unpublished proposals, internal material Get consent before publishing
Other people’s material Official screenshots, other people’s photos, fonts Check the license; if you are unsure, leave it out
AI config files CLAUDE.md, .claude/, and similar Keep them out of the site folder

How to do it:

  • Make a banned-word list (your real name, private email, client names) and keep it in a local file that is not in git, or in the build platform’s secret fields. Scan against it on every build, and if anything matches, do not deploy.
  • Test every scan rule once with a deliberately planted bad sample to confirm it really catches what it should. A check that catches nothing is no check at all.
  • Anything already published may remain in search engine caches, web archives, and git history even after you delete it. Blocking before publishing works better than deleting afterward.

6. Private pages (for specific people only)

For work you want to show only to a client or interviewer:

  • Create a subdomain, for example private.example.com, and protect the whole subdomain with Cloudflare Access (free for up to 50 people; sign-in sends a one-time code by email to the address you specify).
  • Order: lock first, then add content.
    1. Deploy a Worker that serves only a blank home page, bind it to the private. subdomain, and turn off workers.dev and the preview URLs.
    2. Dashboard → Zero Trust: set a team name, choose the free plan, and pick One-time PIN as the sign-in method.
    3. Access → Applications → Add self-hosted. Enter private.example.com as the domain, leave the path empty, set the rule to Allow, and set the condition to the allowed email addresses.
    4. Verify: open https://private.example.com/ while signed out. You should be redirected to the sign-in page.
    5. Only after verification passes should you add the real content.
  • If you want a public area that anyone with the URL can view, you can add a Bypass rule for the path /pub/. In that case, always check that similar paths such as /pubx/ still require sign-in (wildcard matching has changed before), and state clearly in the public area that anyone who knows the URL can see it, which makes it public.
  • Rerun verification after every rule change and every deployment. Some community members have reported a rule suddenly stopping working, with no acknowledgment from the vendor, so writing the checks as a script is the safer choice.
  • The steps in this section follow the design in the official documentation. wizerdbache.com has not actually set up private. yet, so when you do, follow what the dashboard actually shows.

A simpler alternative (the course-notes subdomain on wizerdbache.com actually uses this): protect one subdomain with a password. The Worker checks the password on the server and issues a sign-in cookie only when it matches. This suits a group that shares one password; the drawback is that if the password leaks, you have to change it.

7. Web-based admin (for editing content in the browser later on)

You can connect a Git-based CMS: content edits are committed straight to GitHub, and the cloud builds the site automatically. Watch these points:

  • Add X-Robots-Tag: noindex to the admin pages so search engines do not index them.
  • For the GitHub token used to sign in, use a fine-grained token, limited to the website repo, with content read and write only, and set an expiry date.
  • Keep the preview URLs (one preview site per branch) behind Access, so only you can see them.

8. When an AI assistant is doing the work

  • Do not paste passwords or tokens into the conversation. Do the steps that require sign-in yourself.
  • After an AI changes dashboard settings, test them with curl.exe. Do not just take its word when it says “Done.”
  • A “one-click setup prompt” downloaded from a remote source changes global settings. Read it carefully before deciding whether to run it.

Sources

  1. Workers static assets: Headers (Official)
  2. Cloudflare Access: Application paths (Official)
  3. Wrangler configuration (workers_dev, preview_urls) (Official)
  4. MDN: Content-Security-Policy (MDN)