Upgrading to 0.6
0.6 turns on four protections by default. Most apps need no changes. Check each section that applies to you.
Security headers and CSP
Every response now gets X-Content-Type-Options, X-Frame-Options: DENY and Referrer-Policy, and every page from your build gets a strict Content-Security-Policy built from its own inline scripts.
You are affected if your pages load scripts, images, fonts or API calls from another origin, such as analytics or a CDN, or if another site embeds your app in a frame. The browser console shows each blocked request.
Allow what you need:
install(Svelte) {
securityHeaders {
allowCspSources("script-src", "https://plausible.io")
allowCspSources("connect-src", "https://plausible.io")
frameOptions = "SAMEORIGIN"
}
}automaticContentSecurityPolicy = false drops the CSP and keeps the other headers. See Security headers.
Origin check
Writes to API paths, meaning every method except GET, HEAD, OPTIONS and TRACE, from a browser on another site now answer 403.
You are affected if a frontend on another origin, such as a separate admin app, calls your API. List it:
install(Svelte) {
allowedOrigins("https://admin.example.com")
}Behind a reverse proxy that changes the Host header, install Ktor's XForwardedHeaders or ForwardedHeaders, so the check compares against the public host. Server-to-server calls and tests without an Origin header are not affected.
Body size limit
Request bodies on API paths larger than 1 MiB now answer 413.
You are affected if you accept uploads or large imports. Raise the limit, or remove it with null:
install(Svelte) {
maxApiBodySize = 50L * 1024 * 1024
}If you installed Ktor's RequestBodyLimit yourself, keep it only with maxApiBodySize = null, because both cannot be installed together.
Generated validation
The generated client now has a validate() per request type, built from your schema constraints. Nothing changes for existing calls. See Validation to use it in forms.