Security headers & CSP
Content Security Policy with script hashes and frame-ancestors none, HSTS on HTTPS, frame denial, and strict referrer and permissions policies.
src/hooks.server.tsThis site is a small production system, not a multi-tenant platform. The controls are proportionate, documented, and implemented in code that is public.
GET /api/v1/status
Content Security Policy with script hashes and frame-ancestors none, HSTS on HTTPS, frame denial, and strict referrer and permissions policies.
src/hooks.server.tsJSON body size limits, strict media-type checks, full-origin verification, and Zod schema validation before any handler runs.
src/lib/server/http.tsBounded per-IP sliding-window counter rate limits with Retry-After responses, backed by separate Nginx edge zones in production.
src/lib/server/rate-limit.tsRuntime configuration through environment variables, no secrets in source control, and lockfile-based installs in CI.
.env.exampleNon-root runtime user, read-only root filesystem, log rotation, and a health check used by the deployment pipeline.
DockerfileStructured request logs with request IDs and latency, plus a cached, singleflight-deduplicated status endpoint for configured services.
src/lib/server/status.ts| Header | Policy |
|---|---|
Content-Security-Policy | HTTP header with script hashes, self-only resources, frame-ancestors none |
Strict-Transport-Security | One year, includeSubDomains, HTTPS only |
X-Content-Type-Options | nosniff |
X-Frame-Options | DENY |
Referrer-Policy | strict-origin-when-cross-origin |
Permissions-Policy | Camera, microphone, geolocation, payment, USB disabled |
Cross-Origin-Opener-Policy | same-origin |
Cross-Origin-Resource-Policy | same-origin (cross-origin on /openapi.json) |
X-Request-Id | Propagated or generated UUIDv4 per request for log correlation |
Header values live in src/hooks.server.ts and the CSP configuration in vite.config.ts.
If you find a security issue, email [email protected] with the affected URL, a reproduction, and the impact you believe it has. Do not access other users’ data, run denial-of-service tests, or modify the system.
This is a personal portfolio with no bug-bounty budget. I will acknowledge a valid report, investigate it, and credit you if you want credit. No external audit has been performed; the source is public for review.