Completes the front-end shell with footer, status pages and SEO
Adds the footer, back-to-top button, skip link, placeholder routes, 404 and error pages inside the shell, plus per-page SEO from a single page registry (canonical URLs, Open Graph image, JSON-LD, generated sitemap.xml and robots.txt). Theme tokens and recipes replace repeated styling, the hero loads only the active and neighbouring slides, and the e-mail address is joined in the browser to keep it out of the HTML and bundle. Adds Vitest with property-based (fast-check) and axe tests, ESLint, security headers for dev and preview, Lighthouse CI and a `pnpm check` script that runs all quality gates. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,49 @@
|
||||
// HTTP-securityheaders voor de Vite dev- en preview-server. De productieset is
|
||||
// ook het voorschrift voor de toekomstige host (zie NFR-SEC-01/02).
|
||||
|
||||
type Mode = 'production' | 'development';
|
||||
|
||||
// Chakra/Emotion zetten tijdens runtime <style>-tags in de pagina, daarom
|
||||
// staat style-src 'unsafe-inline' toe. Scripts komen alleen van de eigen site.
|
||||
const productionCsp: Record<string, string[]> = {
|
||||
'default-src': ["'self'"],
|
||||
'script-src': ["'self'"],
|
||||
'style-src': ["'self'", "'unsafe-inline'"],
|
||||
'img-src': ["'self'", 'data:'],
|
||||
'font-src': ["'self'"],
|
||||
'connect-src': ["'self'"],
|
||||
'object-src': ["'none'"],
|
||||
'base-uri': ["'self'"],
|
||||
'form-action': ["'self'"],
|
||||
'frame-ancestors': ["'none'"],
|
||||
};
|
||||
|
||||
// Alleen wat de Vite dev-server zelf nodig heeft: een inline script voor
|
||||
// React Refresh en een websocket voor hot reload.
|
||||
const developmentExtras: Record<string, string[]> = {
|
||||
'script-src': ["'unsafe-inline'"],
|
||||
'connect-src': ['ws:'],
|
||||
};
|
||||
|
||||
export function contentSecurityPolicy(mode: Mode): string {
|
||||
return Object.entries(productionCsp)
|
||||
.map(([directive, sources]) => {
|
||||
const extra =
|
||||
mode === 'development'
|
||||
? (developmentExtras[directive] ?? [])
|
||||
: [];
|
||||
return [directive, ...sources, ...extra].join(' ');
|
||||
})
|
||||
.join('; ');
|
||||
}
|
||||
|
||||
export function securityHeaders(mode: Mode): Record<string, string> {
|
||||
return {
|
||||
'Content-Security-Policy': contentSecurityPolicy(mode),
|
||||
// Browsers negeren HSTS over http://localhost; telt pas op de echte host
|
||||
'Strict-Transport-Security': 'max-age=31536000; includeSubDomains',
|
||||
'X-Content-Type-Options': 'nosniff',
|
||||
'X-Frame-Options': 'DENY',
|
||||
'Referrer-Policy': 'strict-origin-when-cross-origin',
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user