Skip to content

Commit 45e7317

Browse files
EC2 Default Userclaude
andcommitted
fix!: lock down the HTTP server by default and give each database its own server
Security (breaking changes): - Without an auth credential, httpserve_start now only binds loopback addresses (127.x, ::1, localhost). Serving 0.0.0.0 or another interface without auth needs SET httpserver_allow_unauthenticated_remote = true. - Wildcard CORS is gone. Cross-origin browser requests (an Origin that isn't the server itself, or Sec-Fetch-Site cross-site/same-site) get 403, so a web page can no longer make a browser run SQL on a local server. Allowed origins are listed in httpserver_allowed_origins ('*' restores the old any-origin behaviour, still without credentials). - Unauthenticated loopback servers reject requests whose Host header is not a loopback name (DNS rebinding). - httpserve_start is refused when enable_external_access is false. - The listening socket uses SO_REUSEADDR (SO_EXCLUSIVEADDRUSE on Windows) instead of httplib's SO_REUSEPORT, so starting on a port that is already listening is an error instead of silently sharing it. - Optional TLS: set httpserver_tls_cert and httpserver_tls_key to serve HTTPS. Lifecycle: - Server state lives in each database's object cache, guarded by a mutex, instead of one unsynchronised global. Each database can run its own server; closing the database stops it. The server holds the database weakly, so it no longer keeps a closed database alive (requests during shutdown get 503), and the process-exit hook is gone. - httpserve_stop() from a query the server is serving is an error instead of a deadlock (tracked on the connection, since scalar functions run on any worker thread). - The foreground-mode SIGINT handler only stops the listening socket and the previous handler is restored afterwards. Output and metadata: - JSONEachRow keeps JSON types (numbers, booleans, lists, structs) instead of quoting every value, matching JSONCompact. - httpserve_start/httpserve_stop are VOLATILE and have descriptions, examples and categories; per-row arguments are read per row. Tests: start/stop/restart, invalid ports, non-loopback refusal and override, TLS setting errors, enable_external_access, metadata, formats, origin checks and stop-from-request (httpfs), and python tests for formats, auth, origin/Host checks, port-in-use between two databases, close-stops-server and TLS. Test ports moved off 8123. Also removes template leftovers (docs/NEXT_README.md, docs/UPDATING.md) and the DuckDB 1.4 scheduled workflow. Version 2026110701. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent 70b4ec8 commit 45e7317

14 files changed

Lines changed: 1078 additions & 502 deletions

‎.github/workflows/scheduled-1.4.yml‎

Lines changed: 0 additions & 27 deletions
This file was deleted.

‎docs/NEXT_README.md‎

Lines changed: 0 additions & 86 deletions
This file was deleted.

‎docs/UPDATING.md‎

Lines changed: 0 additions & 23 deletions
This file was deleted.

0 commit comments

Comments
 (0)