← Writing

How this site is built and secured

· CI/CD · Cloudflare · Security headers

Most security portfolios are judged on their projects, but the site itself is the first thing anyone sees. I wanted mine to be something I’d be comfortable having a hiring manager open in developer tools.

The constraints

Static, typed content

The site is built with Astro, which renders Markdown to plain HTML at build time and ships no JavaScript framework to the browser. Projects and posts are content collections with a schema. A project without a status, stack or date doesn’t build, so every project page keeps the same structure: problem, what I built, how it works, results, and what I’d do next.

Headers that do the work

Cloudflare reads a _headers file from the build output, so every response carries:

Content-Security-Policy: default-src 'none'; script-src 'self'; style-src 'self'; img-src 'self' data:;
  connect-src 'self' https://formspree.io; form-action 'self' https://formspree.io;
  frame-ancestors 'none'; base-uri 'none'
Strict-Transport-Security: max-age=31536000; includeSubDomains
Referrer-Policy: strict-origin-when-cross-origin
Permissions-Policy: camera=(), microphone=(), geolocation=(), payment=(), usb=()
X-Content-Type-Options: nosniff

Getting to script-src 'self' with no 'unsafe-inline' meant two small decisions: keep the theme toggle as an external file rather than an inline snippet, and tell Astro never to inline stylesheets.

A gate before every deploy

The pipeline runs type checks and a build, then a short Node script walks the generated HTML and fails the build if it finds:

It’s the same idea as a detection: write down what must never happen, then check for it automatically every time, instead of trusting yourself to remember.

Deploying

GitHub Actions deploys to Cloudflare Workers static assets with Wrangler, using an API token scoped to this one job and stored as a repository secret. Third-party actions are pinned to commit SHAs, and Dependabot raises updates as pull requests that go through the same gate.

What’s next

The contact form currently posts to a form service. Next, I’ll replace it with a small Worker behind Cloudflare Turnstile, so form submissions never leave my own Cloudflare account. That will get its own write-up.