Website Specification Audit: Fix Headers, CSP and Manifest
Auditing a site against the Website Specification's 140-item checklist turned up a broken web manifest, missing security headers, a Content Security Policy that blocked third-party services, and cookie problems.
- By
- Brennan Kenneth Brown
- Published
- Reading time
- 10 minutes
- Level
- Advanced
- You need
- A website you can edit and deploy
- Access to your host's headers config
The Website Specification is a checklist of about 140 items for well-made websites, covering foundations, SEO, accessibility, security, well-known URIs, "agent readiness", performance, privacy, resilience and internationalisation. Each item has a one-line justification and a Required, Recommended, Optional or Avoid tag. Skippy shared it on the omg.lol IRC channel, and I went through it item by item to see what my Eleventy site needed.
This guide walks through what the audit turned up and how I fixed it: a broken web manifest, missing security headers, a Content Security Policy (CSP) that blocked third-party services, cookie questions, a service worker, and a set of small CSS and header additions. Most examples use Netlify, so adjust the header syntax for your own host.
Which checklist categories did I skip?
I skipped the entire "Agent Readiness" category. I'm not adding a llms.txt or per-page Markdown endpoints, and I have no AI-crawler-specific robots.txt rules, because I don't want to maintain a cat-and-mouse list of blocked crawlers. The category assumes you want agents reading your site efficiently, and for me it would make content easier to copy without bringing more human readers. I did add a few honeypot paths for high-risk application paths, default CMS paths, secrets and configuration file locations, and API discovery endpoints.
How do I fix a broken web manifest?
The audit made me re-examine old files. My site.webmanifest had empty name and short_name fields:
{"name":"","short_name":"","icons":[{"src":"/android-chrome-192x192.png", ...
Any Android user who tried to "Add to Home Screen" would've gotten a shortcut with no label. Even worse, the icon paths were root-relative (/android-chrome-192x192.png) when the actual files live at /assets/images/favicon/android-chrome-192x192.png. The manifest had been pointing at 404s since I generated it with an online favicon tool and never checked the output. I fixed both:
{
"name": "brennan.day",
"short_name": "brennan.day",
"start_url": "/",
"scope": "/",
"icons": [
{"src": "/assets/images/favicon/android-chrome-192x192.png", "sizes": "192x192", "type": "image/png"},
{"src": "/assets/images/favicon/android-chrome-512x512.png", "sizes": "512x512", "type": "image/png"}
],
"theme_color": "#fbf1c7",
"background_color": "#fbf1c7",
"display": "standalone"
}
The <meta name="theme-color"> was also set to #65312fff. Eight-digit hex values are valid and the extra two digits add an alpha channel, but I had not intended that. I replaced it with a light/dark pair matching my site's palette:
<meta name="theme-color" content="#fbf1c7" media="(prefers-color-scheme: light)">
<meta name="theme-color" content="#282828" media="(prefers-color-scheme: dark)">
Which security headers should I add?
My netlify.toml initially had X-Frame-Options and an outdated X-XSS-Protection header. I removed X-XSS-Protection, as it does nothing in any current browser and the spec says to avoid it.
I also had no Content Security Policy, no HSTS, and nothing about cross-origin isolation.
Writing a CSP for a site that embeds webring widgets, uses KaTeX and Mermaid, and has an IndieAuth comment flow took some work:
Content-Security-Policy = default-src 'self';
script-src 'self' 'unsafe-inline' 'wasm-unsafe-eval'
https://cloud.umami.is https://neatstats.net https://cdn.jsdelivr.net
https://webring.fun https://silly.possiblyaxolotl.com
https://bubbles.town https://status.lol;
style-src 'self' 'unsafe-inline' https://cdn.jsdelivr.net
https://silly.possiblyaxolotl.com;
img-src 'self' data: https:;
font-src 'self' data: https://cdn.jsdelivr.net;
connect-src 'self' https://cloud.umami.is https://*.supabase.co
https://webring.fun https://neatstats.net https://bubbles.town;
frame-src https://www.youtube.com;
object-src 'none'; base-uri 'self';
form-action 'self' https://indieauth.com https://buttondown.com
https://*.supabase.co;
frame-ancestors 'none'; upgrade-insecure-requests;
report-to default;
This is not a strict CSP. It still has 'unsafe-inline' for both scripts and styles, because my site has inline <style> blocks for critical CSS (which is a debateable practice) and quite a few one-off inline <script> tags (theme toggle, scroll progress, the IndieAuth PKCE flow) scattered across templates.
Doing this properly would mean nonces or hashes on every script, which is a refactor I have not done. The current policy still helps if an XSS bug appears, by locking down which domains can be a script/style/connect/frame source at all.
For Strict-Transport-Security and Permissions-Policy, there was nothing complicated to add:
Strict-Transport-Security = "max-age=63072000; includeSubDomains"
Permissions-Policy = "camera=(), microphone=(), geolocation=(), payment=(), usb=(), interest-cohort=()"
For Cross-Origin-Embedder-Policy, the spec's default recommendation is require-corp, which blocks any cross-origin resource that doesn't explicitly opt in with its own Cross-Origin-Resource-Policy header. For instance, my site loads badge images from aaronparecki.com, indieweb.org, and mirrors.creativecommons.org, none of which I control. require-corp would've broken these images. I used credentialless instead, which strips credentials from cross-origin requests rather than blocking them.
I also wrote a Reporting-Endpoints header pointing at a tiny new Netlify Function that logs whatever the browser sends it:
// netlify/functions/csp-report.js
exports.handler = async (event) => {
if (event.httpMethod !== "POST") return { statusCode: 405, body: "" };
console.warn("[reporting-api] " + (event.body || "").slice(0, 4000));
return { statusCode: 204, body: "" };
};
This is not a full observability pipeline: it only writes to the function logs with console.warn. But if my CSP breaks something for a visitor, I can find out.
Why did my Content Security Policy break third-party widgets?
Copying the spec's recommendations was not enough. My initial CSP broke several things on my site:
- The webring widgets from
webring.funandsilly.possiblyaxolotl.comstopped loading - The bubbles.town upvote button failed to load
- The status.lol widget was blocked
- NeatStats analytics stopped working
The issue was that these third-party services make API calls to their own domains for data, and I hadn't included those domains in my connect-src directive. Additionally, some services load their own CSS files that I hadn't whitelisted in style-src.
I had to iteratively add missing domains:
script-src 'self' 'unsafe-inline' 'wasm-unsafe-eval'
https://cloud.umami.is https://neatstats.net https://cdn.jsdelivr.net
https://webring.fun https://silly.possiblyaxolotl.com
https://bubbles.town https://status.lol;
style-src 'self' 'unsafe-inline' https://cdn.jsdelivr.net
https://silly.possiblyaxolotl.com;
connect-src 'self' https://cloud.umami.is https://*.supabase.co
https://webring.fun https://neatstats.net https://bubbles.town;
form-action 'self' https://indieauth.com https://buttondown.com
https://*.supabase.co;
A CSP requires knowing exactly which domains your third-party services use, both for loading scripts and for any API calls they make in the background. Browser console errors were the main debugging tool.
After implementing my initial CSP, I noticed my Umami metrics suddenly dropped to near-zero. It turned out that Umami had changed their API gateway domains, moving from just cloud.umami.is to also using gateway.umami.is, eu.umami.is, and various api-gateway.*.umami.dev endpoints. This is a known issue that breaks tracking for sites with strict CSPs. I had to add all these new gateway domains to my connect-src directive to restore analytics functionality.
I also had to update my service worker to skip cross-origin requests entirely. The service worker was trying to handle requests to external domains (webring scripts, badge images, etc.) but couldn't properly cache them due to CORS restrictions, which was causing "undefined" response errors. By adding a check to only handle same-origin requests, the service worker now focuses on my own content while letting external resources load normally.
Do I need a cookie banner?
The checklist's Privacy category flags cookie consent as Required. My website sets no cookies: Umami, my analytics, is documented as cookie-free and I already say so in my privacy policy, and nothing else on the site creates cookies. Not every item applies just because the checklist says Required; read the justification and check it against your own site.
For saving user preferences without cookies, use localStorage:
// Set it
localStorage.setItem('theme', 'dark');
// Get it
const theme = localStorage.getItem('theme'); // 'dark'
// Remove it
localStorage.removeItem('theme');
Local storage also has a 10MB storage limit vs. 4KB limit for cookies. The catch is data persists forever unless cleared.
sessionStorage works exactly like localStorage, but automatically clears the data when the user closes the browser tab.
sessionStorage.setItem('formStep', '3');
For large, complex data (e.g., offline images, large cached JSON), you can use localForage (a library that yes, rhymes). Native IndexedDB is powerful but complicated (uses callbacks, cursors, and databases). localForage is a tiny library that gives you a localStorage-style API but stores data in IndexedDB behind the scenes.
// Include the library, then:
localforage.setItem('shoppingCart', { items: 200, total: '$500' });
localforage.getItem('shoppingCart').then((cart) => console.log(cart));
This handles binary data (blobs/files) and holds over 50MB, and uses Promises (async) so it doesn't freeze your webpage.
How do I fix a service worker that caches nothing?
My old service worker cached /assets/css/style.css, a file that hasn't existed since I split my CSS into multiple files, so it was actually caching nothing. I rewrote it so a failed navigation falls back to a real offline page instead of the browser's own "no internet" screen, and images load cache-first instead of network-first:
if (event.request.mode === 'navigate') {
event.respondWith(
fetch(event.request).catch(() =>
caches.match(event.request).then(response => response || caches.match(OFFLINE_URL))
)
);
return;
}
I also added a check to skip cross-origin requests entirely, which was causing CORS-related errors. The service worker now only handles same-origin requests, letting external resources (webring scripts, badge images, etc.) load normally:
// Skip cross-origin requests to avoid CORS issues
if (!event.request.url.startsWith(self.location.origin)) {
return;
}
How do I stop the flash of unstyled content on page load?
While testing, I dealt with elements in the main content and sidebar visibly resizing on every page load, including repeat visits.
The cause was the deferring technique media="print" onload="this.media='all'". This is a known pattern for loading CSS asynchronously to improve performance, but it has the annoying downside of causing flashes of Unstyled Content and layout shifts when the deferred CSS finally loads and applies.
I removed the deferred loading and let CSS load normally. The tradeoff is a slightly slower initial render, but no more flashing. For other layout-shift fixes, see how I improved my Lighthouse score.
What other small fixes did the audit suggest?
These were quick once I knew to look for them:
text-wrap: balance / text-wrap: pretty on headings and body copy, so the browser handles orphaned last-line words nicely.
h1, h2, h3, h4, h5, h6 {
text-wrap: balance;
}
p, li, dd, figcaption {
text-wrap: pretty;
}
scrollbar-gutter: stable so pages that scroll (nearly every post) and pages that don't aren't shifting width against each other.
html {
scrollbar-gutter: stable;
}
scroll-margin-top / scroll-padding-top on headings and anchor targets, so jumping to #comments or a table-of-contents link doesn't land the heading directly underneath my sticky header.
html {
scroll-padding-top: 5rem;
}
h1, h2, h3, h4, h5, h6,
:target,
[id] {
scroll-margin-top: 5rem;
}
A @view-transition block with navigation: auto, so Chrome (for now) animates between page loads. Unsupported browsers just navigate normally, but it's a one-line opt-in.
@view-transition {
navigation: auto;
}
Forced colours mode support, for people running accessibility options, like Windows High Contrast. My rainbow nav underline and scroll-progress bar are pure decoration with no border to fall back on, so this snippet allows them to remain:
@media (forced-colors: active) {
.site-header::after,
nav.site-nav a::after {
background: CanvasText;
forced-color-adjust: none;
}
button, .hero-btn, input[type="submit"] {
border: 1px solid ButtonText;
}
}
:user-valid / :user-invalid on form fields, real-time validation styling in CSS instead of JS class-toggling, and it only triggers after you've interacted with the field, so a required-but-empty input doesn't pop up before you've typed anything.
input:user-invalid, textarea:user-invalid {
border-color: var(--link-hover);
}
input:user-valid, textarea:user-valid {
border-color: var(--nav-green);
}
A container query on the sidebar modules, this way the badge grid responds to the module's rendered width instead of just the viewport.
.sidebar .module {
container-type: inline-size;
container-name: sidebar-module;
}
@container sidebar-module (max-width: 220px) {
.badges-grid {
grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
}
}
contain: layout paint on post cards and sidebar modules, telling the browser those subtrees can't affect anything outside themselves.
a.post-card {
contain: layout paint style;
}
Speculation Rules for same-origin prefetching, skipping honeypot paths and anything marked rel="nofollow":
<script type="speculationrules">
{
"prefetch": [{
"source": "document",
"where": { "and": [
{ "href_matches": "/*" },
{ "not": { "href_matches": "/honeypot/*" } },
{ "not": { "selector_matches": "[rel~=\"nofollow\"]" } }
]},
"eagerness": "moderate"
}]
}
</script>
Visible breadcrumbs on posts and pages, matching the BreadcrumbList JSON-LD I already wrote but never rendered on the site:
<nav class="breadcrumbs" aria-label="Breadcrumb">
<ol>
<li><a href="/">Home</a></li>
<li aria-current="page">{{ title }}</li>
</ol>
</nav>
inputmode, enterkeyhint, and autocomplete on the comment sign-in, newsletter, contact, and guestbook forms, so the correct mobile keyboard shows up:
<input type="url" name="me" inputmode="url" enterkeyhint="go" autocomplete="url" required>
<input type="email" name="email" inputmode="email" enterkeyhint="send" autocomplete="email" required>
A /500.html page and a /maintenance.html page, the latter being a documented, one-line redirect flip in netlify.toml for putting the site into maintenance mode:
# Commented out until I actually need it
# [[redirects]]
# from = "/*"
# to = "/maintenance.html"
# status = 503
# force = true
The audit also led to several well-known URIs, feed additions and headers.
IndexNow lets Bing, Yandex and a few other search engines receive a "changes made" ping instead of waiting for a crawl. Generate a key, put it at the site root, and add a post-deploy hook next to the WebSub ping I already had:
curl -s -X POST "https://api.indexnow.org/indexnow" \
-H "Content-Type: application/json; charset=utf-8" \
-d "{\"host\": \"brennan.day\", \"key\": \"...\", \"urlList\": [...]}"
A webfinger endpoint at /.well-known/webfinger, which is how the Fediverse resolves acct:brennan@brennan.day-style identifiers to profile links. Mine is a static file instead of a query-aware endpoint, since there is only one identity to resolve:
{
"subject": "acct:brennan@brennan.day",
"links": [
{ "rel": "self", "type": "application/activity+json", "href": "https://social.lol/@brennan" }
]
}
A /.well-known/traffic-advice file, which is Chrome-specific and tells its private prefetch proxy whether it's allowed to send prefetch traffic to my origin:
[{ "user_agent": "prefetch-proxy", "google_prefetch_proxy_eap": { "fraction": 1.0 } }]
A Syndication module (sy:updatePeriod, sy:updateFrequency) in my RSS feed, so feed readers with the ability can now display how frequently my blog is updated:
<rss version="2.0" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/">
<channel>
<sy:updatePeriod>daily</sy:updatePeriod>
<sy:updateFrequency>1</sy:updateFrequency>
</channel>
</rss>
Redirect-By: Netlify, a header that states which system issued a redirect, in case I'm debugging a redirect chain:
[[headers]]
for = "/*.html"
[headers.values]
No-Vary-Search = '''params=("utm_source" "utm_medium" "utm_campaign" "fbclid" "gclid")'''
[[headers]]
for = "/*"
[headers.values]
Redirect-By = "Netlify"
[[headers]]
for = "/assets/*"
[headers.values]
Cross-Origin-Resource-Policy = "cross-origin"
A few more additions:
No-Vary-Searchon HTML responses, listing out the usual tracking parameters (utm_source,fbclid,gclid, etc.) so a cache treats/post/and/post/?utm_source=mastodonas the same page instead of two (I try my best to avoid any tracking params, but other sites don't).Cross-Origin-Resource-Policy: cross-originon my asset headers, so nothing about the other origin isolation changes stops someone else from embedding my own images.- Core Web Vitals as a category is just reviewing what real users experience, which I did with PageSpeed Insights. The current assessment is Passed: Largest Contentful Paint (LCP) 1.8 s, Interaction to Next Paint (INP) 68 ms, Cumulative Layout Shift (CLS) 0. Other metrics: First Contentful Paint (FCP) 1.6 s, Time to First Byte (TTFB) 1.6 s. These were taken from the latest 28-day Chrome UX Report for mobile.
Which checklist items did I not address?
I did not get to several items:
- DNS CAA records and DNSSEC are controlled by CDN, and not in this repo, so I still need to review those.
- Trusted Types would require auditing every
innerHTML-style sink across my templates and the third-party widgets I don't control. - SRI on the webring/reaction-button scripts isn't happening until they're pinned to a version instead of
@main. Subresource Integrity on a moving target just means the hash breaks the next time I push a commit. I did add it to my pinned Mermaid script, where it made sense. - Actual uptime monitoring means picking and paying for a third-party service, which I decided is not necessary for my site.
- Strict CSP with nonces/hashes would require refactoring all my inline scripts and styles to use proper CSP mechanisms, which is more work than I have taken on so far.
Was the checklist worth running?
Yes, mainly for finding things I had stopped seeing: the broken web manifest, the theme-colour meta tag doing nothing, and the breadcrumb schema I never rendered. Not every item applies to every site, so treat the tags as prompts and decide per item. Run your own site through the checklist and check each fix in your browser's console and network panel afterward, since a new CSP in particular can break things silently.