Skip to content

Brief for Cedric: Quack TLS between Cloud Run and the Verse4Verse Quack server (FLT-281)

You are Cedric Jones-Gaffney (Codex), the implementer. Clahadore orchestrates. Andrew is AFK.

The problem (observed 2026-10-30 ~08:55Z)

Server side (v4v-quack, 10.10.0.10): - The DuckDB 2.0.0 CLI runs CALL quack_serve('quack:10.10.0.10', token = ..., allow_other_hostname = true). - It reports listen_url https://10.10.0.10:9494. That is HTTPS with an ephemeral self-signed certificate, the default for non-local binds.

Client side (the app, Cloud Run): libduckdb v2.0.0, our build, under DuckDB.NET 1.5.6.1. - It runs ATTACH 'quack:10.10.0.10' AS app (TOKEN '...') through src/EFCore.DuckDB/Diagnostics/DuckDBQuackConnectionInterceptor.cs:80. - It fails with "Quack connection initialization failed". The inner error is suppressed, to keep the token out of logs. - Network is ruled out: - the server is active and listening; - the firewall admits 10.10.1.0/26, the Cloud Run egress range; - systemd IPAddressAllow matches that range. - The most likely cause is that the client rejects the self-signed certificate.

What the docs say (2.0)

  • Client ATTACH options are documented as TOKEN, DISABLE_SSL (boolean) and TYPE. Example: ATTACH 'quack:host' AS r (TOKEN '...', DISABLE_SSL true).
  • Server: non-local binds serve HTTPS with a self-signed certificate unless given ssl_cert_file / ssl_key_file.
  • A CA trust option (ca_cert_file) and certificate pinning (ssl_fingerprint) appear only in PRs and third-party docs. Verify them before use.
  • Docs: https://duckdb.org/docs/2.0/quack/overview, https://duckdb.org/docs/current/quack/reference, https://duckdb.org/docs/2.0/quack/security

Task, in order

  1. Find out empirically, with the DuckDB 2.0.0 CLI at C:\Tools\duckdb\2.0.0\duckdb.exe on this PC, which option combination works for each of these:
  2. (a) Preferred: TLS with verification.
    • Generate a long-lived self-signed CA and a server certificate for IP SAN 10.10.0.10 (and, for the local test, this PC's LAN IP). Use .NET or openssl if present.
    • Serve with ssl_cert_file / ssl_key_file.
    • Connect from a second CLI process to the LAN IP, with whatever client option makes it trust that CA or pin the cert.
    • If no client trust option exists in 2.0.0, record that with the exact error.
  3. (b) Fallback: plain HTTP. Find the server-side option that serves plain HTTP on a non-local bind, plus client DISABLE_SSL true.

For both, generate any token at runtime from an environment variable. Never put a token literal in a command line, because a hook blocks that. Write SQL to temp files that read getenv(...). 2. Add an option to the provider, e.g. UseQuack(uri, token, Action<DuckDBQuackOptions> configure), with DisableSsl and, if (a) works, CaCertFile / pinning. Emit them as ATTACH options in the interceptor. Keep the token-redaction behavior. - Add unit tests for the generated ATTACH text (no token in logs). - Run dotnet build -c Release -m:1 and dotnet test -c Release -m:1 serially. The PC is at about 95% memory commit. 3. Work on branch quack-tls, created from round-2. Commit with explicit paths, message "EFCore.DuckDB: Quack ATTACH TLS options", plus the trailer Co-Authored-By: Cedric (Codex gpt-6-astra) <noreply@openai.com>. Run dotnet pack -c Release. Do NOT push. 4. Write QUACK-TLS-RESULT.md in this repo root. It must contain: - which option set works, with the exact CLI output as receipts and any token redacted; - the exact server quack_serve(...) arguments and the client ATTACH options to use in production; - for (a), where the cert and key files must live. The key goes in Secret Manager, never in git.

Never touch GCP, the VM or any other repo. Andrew will be shown the security trade-off if only (b) works.