Dev.to AI 🤖 Ai 👁 0 📖 4 min read

I sell a security audit. My own site scored a C.

I built a pre-launch audit tool for AI products, mostly because I kept shipping sites with the same dumb mistakes and wanted a checklist I would actually run. The night before I listed it for sale, I pointed it at my own

I built a pre-launch audit tool for AI products, mostly because I kept shipping sites with the same dumb mistakes and wanted a checklist I would actually run. The night before I listed it for sale, I pointed it at my own store.

It came back 70 out of 100. Grade C.

The tool had been running for maybe ten minutes.

What it found

Three missing response headers. Not exotic, not subtle, just absent:

$ curl -sI https://skills.alqedge.com/
strict-transport-security: (not returned)
content-security-policy:    (not returned)
x-frame-options:            (not returned)
x-content-type-options:     nosniff
referrer-policy:            strict-origin-when-cross-origin

Cloudflare was already setting the last two for me. The first three it does not set by default, and I had never noticed, because the site worked. It rendered, it sold, the checkout buttons did their thing. Nothing in a browser tells you a header is missing.

That is the whole problem with shipping by vibes. A missing HSTS header produces no error, no broken layout, no support ticket. It just means the first request to your site can be downgraded to plain HTTP on a hostile network before the redirect happens. You find out when someone steals a session, or you never find out at all.

CSP and X-Frame-Options have the same shape. Their absence looks like nothing. X-Frame-Options missing means someone can put your checkout page in an iframe and overlay their own buttons on it. That is the entire clickjacking attack, and it costs one line to prevent.

The fix

The site is Astro on Cloudflare Pages, so headers go in a plain file called _headers in the public directory. Cloudflare reads it at deploy time and applies the rules per route.

/*
  Strict-Transport-Security: max-age=31536000; includeSubDomains
  X-Frame-Options: SAMEORIGIN
  Content-Security-Policy: default-src 'self'; script-src 'self' 'unsafe-inline'; style-src 'self' 'unsafe-inline'; img-src 'self' data:; font-src 'self' data:; connect-src 'self'; frame-ancestors 'self'; base-uri 'self'; form-action 'self'

Four lines, one deploy. The CSP is not the strict version. I checked the built HTML first and found three inline scripts, so I allowed 'unsafe-inline' for scripts and left tightening it for later, probably with hashes generated at build time. A CSP that breaks your own site gets deleted within an hour, and a deleted CSP protects nothing.

Everything else in the policy is tight. No external script sources, no external fonts, frame-ancestors 'self', form-action 'self'. The checkout links go to a different domain, but they are <a href> navigations, which CSP does not block.

Then I checked that the site still worked, because a green deploy is not the same as a working site. Homepage 200, product page 200, Chinese page 200, and the stylesheet still loading:

/_astro/ai-launch-checkup.ClXNMeCW.css   200

If that CSS had come back 403, the deploy would have looked successful and the site would have been unstyled.

The second run

AI Launch Checkup — https://skills.alqedge.com
Grade: A (100/100)

P0 (0)
P1 (0)
P2 (0)

Passed: 13
Skipped: 0

Fifteen minutes between the two runs, counting the deploy.

I want to be careful about what that number means. A 100 does not mean the site is secure. It means every external check I know how to write passes right now. Three of the ten modules in the full checklist need a test account or repository access, and this site has neither a login nor anything worth stealing, so those modules did not run. The tool says so in the report. That "skipped" line is not a disclaimer I bolted on to look humble. It is the difference between a report someone trusts and one they should not.

What I actually learned

The audit is only useful because it is repeatable. The real bug here was not the missing headers, it was that I had no mechanism that would have caught them. Deploy day feels productive. You check the homepage, click a couple of links, ship. Nobody runs a header check by hand, ever, because it is boring and the site appears fine.

Two things make this kind of check worth automating. It has to be one command, and it has to grade. A list of thirty things to check gets run once and abandoned. A single number that goes from C to A gets run again after the next deploy.

The other thing I got wrong, and fixed while building this: my first version gave a completely unreachable domain a C. Seventy-five points, three findings, "solid B-minus, needs a little work" for a site that did not resolve in DNS. A passing grade for a dead server. I had written the scoring rule as "start at 100, deduct 25 per critical issue" and never thought about the case where nothing responds at all. Now an unreachable target gets F and zero, with the line "score not applicable" under it. That bug was in the tool for a day. It would have been found by the first customer, on their site, on a bad day.

If you are shipping something with an AI feature in it and you have not looked at your response headers, that takes about ninety seconds to check:

curl -sI https://yoursite.com/ | grep -iE 'strict-transport|content-security|x-frame'

Anything that comes back missing is a line in your config and a redeploy. The one that would have bitten me hardest is the frame options, since my whole product is a checkout page.

I built the tool because I wanted it for myself. The free Lite version is on GitHub, and there is a paid edition with the full 68-item checklist and the scanner, but honestly the three headers above are the part that matters most and they are free.

📰 Read the original article on Dev.to AI

Originally published by Dev.to AI. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.