DuckDB security
DuckDB runs inside the ProxySQL process. Its queries share that process’s memory, CPU, and operating-system privileges. Restrict access to trusted users and set resource limits before admitting traffic.
Accounts and database permissions
The MySQL endpoint authenticates active frontend users from mysql_users; the
PostgreSQL endpoint uses pgsql_users. Users must be loaded to runtime.
The quickstart shows how to create dedicated
accounts.
Both endpoints share one DuckDB database. There are no separate DuckDB users, roles, or per-user schema and table permissions. An authenticated user can issue DuckDB SQL against the shared database, subject to its read-only setting and external-access restrictions. Only admit users trusted with that access.
The user tables are also used by ProxySQL’s normal proxy listeners. Dedicated credentials make access easier to manage, but do not restrict a credential to a particular listener. Control endpoint reachability with bind addresses and network policy.
Listener exposure and TLS
Both DuckDB listeners bind to all IPv4 interfaces by default. For local-only access, run these statements through ProxySQL Admin:
UPDATE global_variables
SET variable_value='127.0.0.1:6031'
WHERE variable_name='duckdb-mysql_ifaces';
UPDATE global_variables
SET variable_value='127.0.0.1:6034'
WHERE variable_name='duckdb-pgsql_ifaces';
SAVE DUCKDB VARIABLES TO DISK;
Restart ProxySQL to apply listener changes. The DuckDB endpoints are separate from ProxySQL Admin on 6032 and the normal MySQL proxy endpoint on 6033.
Both DuckDB endpoints support TLS. Configure ProxySQL’s frontend certificates
using the TLS configuration guide. Ensure
mysql-have_ssl=true for the MySQL endpoint and pgsql-have_ssl=true for the
PostgreSQL endpoint; load changes with LOAD MYSQL VARIABLES TO RUNTIME or
LOAD PGSQL VARIABLES TO RUNTIME, respectively. Configure clients to trust the
issuing certificate authority and verify the server’s identity. Set use_ssl=1
on the relevant user row and reload users to runtime to require encrypted
connections for that account.
External access
duckdb-enable_external_access defaults to false. Keep it disabled unless
all endpoint users are trusted with the filesystem capabilities of the
ProxySQL operating-system account.
Enabling it can permit operations such as reading files with read_csv,
writing files with COPY ... TO, attaching database files, and installing or
loading extensions. Operating-system permissions still apply.
duckdb-read_only controls writes to the main database. It does not replace
the external-access restriction or prevent reading sensitive files when
external access is enabled.
To disable external access on a running instance, update the Admin variable
and run LOAD DUCKDB VARIABLES TO RUNTIME. Enabling it after it has been
disabled requires saving the setting and restarting ProxySQL. Check
runtime_global_variables for the effective value after a runtime load.
Extension autoload and autoinstall are disabled by default in the bundled DuckDB build, and unsigned extensions are not allowed by default. Keep external access disabled when users should not install or load extensions.
Database files
For a persistent database:
- Use a directory dedicated to ProxySQL, owned by its service account.
- Apply restrictive file and directory permissions.
- Protect backups with the same access controls as the live database.
- Choose
duckdb-database_pathcarefully; do not point it at an unrelated file.
Settings and resource limits
Clients can change session settings but cannot change engine-wide settings.
Use ProxySQL Admin to configure duckdb-memory_limit, duckdb-threads, and
duckdb-max_connections. See the
configuration reference for
runtime and restart requirements.
Choose limits with normal proxy traffic in mind: an expensive analytical query can affect other work in the same process. There is no configurable per-query timeout.
SQL input
Prepared-statement protocols are unsupported. If an application constructs text queries, use appropriate library quoting functions and validate untrusted input. Do not concatenate untrusted values into SQL strings. The one-statement per-request limit does not prevent SQL injection within a statement.