Skip to content

fix(cubejs): fourth review of the confinement (MotherDuck and Databricks options) - #106

Merged
acmeguy merged 1 commit into
mainfrom
fix/confinement-round4
Oct 31, 2026
Merged

acmeguy merged 1 commit into
mainfrom
fix/confinement-round4

Conversation

@acmeguy

@acmeguy acmeguy commented Oct 31, 2026

Copy link
Copy Markdown

Why (urgent)

A fourth adversarial review of the confinement merged in #103 found two critical holes that are exploitable with default config. #103 is deploying to dev now.

Finding Impact Fix
MotherDuck md: options (motherduck_host, ports, download URLs) The pod requests any internal or metadata URL at DuckDB instance creation, before the sandbox, and the response body comes back in the error (reproduced) Only a database name and a token-shaped motherduck_token are accepted. The token is validated too, since Cube pastes it into the URL
Databricks JDBC options (VolumeOperationAllowedLocalPaths, StagingAllowedLocalPaths, SSL key stores, proxies) The in-JVM driver uploads or downloads pod files, e.g. /proc/self/environ, to the tenant's own workspace Allowlist of connection options in the URL and the properties, for every JDBC type that can load the driver
DuckDB unbounded memory, threads and spill (medium) One tenant query can OOM-kill the shared cube process or fill its disk Defaults of 1 GB memory, 2 threads and 4 GB spill, raisable through CUBEJS_DB_DUCKDB_MEMORY_LIMIT, _THREADS and _MAX_TEMP_DIRECTORY_SIZE

Verification

  • Image yarn test: 760/760, including new tests for every vector.
  • The reviewers' MotherDuck exploit was run against both images:
    • merged image: the internal server receives GET /leak?/extension_version= and its body is returned;
    • this image: refused with "MotherDuck connection options other than the token are not allowed".

🤖 Generated with Claude Code

…cks options)

Found by a fourth adversarial review of the merged confinement (#103), all
with default operator config:

- MotherDuck: md: connection strings take options (motherduck_host, ports,
  download URLs) that send the pod's requests to any host -- at instance
  creation, before the sandbox -- and returned the response body in the
  error. Only a database name and a token-shaped motherduck_token are
  accepted; a token can no longer carry options into the URL Cube builds.
- Databricks: the in-JVM driver's connection options include ones that read
  or write pod files (Volume/Staging allowed local paths, SSL key stores)
  and reach other hosts (proxies). Only the options a connection needs are
  accepted, in the URL and the properties, whichever JDBC type loads it.
- DuckDB: bounded by default (memory 1GB, 2 threads, 4GB spill), raisable
  with CUBEJS_DB_DUCKDB_MEMORY_LIMIT / _THREADS / _MAX_TEMP_DIRECTORY_SIZE,
  so one tenant query can't take down the shared process or disk.

The review's exploits rerun against this image: refused. 760/760.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@acmeguy
acmeguy merged commit 0a257cb into main Oct 31, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant