#2747·WrenAI

[BUG] Trino connector: relative verify CA path resolves against CWD, not a stable root

Author: kongyqCreated Sep 15, 2026Updated Sep 15, 2026
Labelsbug

Bug

When a relative path is provided for the verify SSL kwarg in TrinoConnectionInfo.kwargs (e.g. verify: certs/ca-chain.pem), it is passed as-is through _build_trino_connect_kwargs_apply_trino_ssl_overridestrino.dbapi.connect()requests.

The requests library resolves relative paths against os.getcwd(). This means the CA bundle is only found when the process happens to start from the project root. If the application is launched from a different working directory (e.g. as a subprocess of another service, from an IDE, or a CI runner), the connection fails with a certificate error even though the file exists at the expected relative location.

Where

wren/connector/trino.py_apply_trino_ssl_overrides() already coerces string values like "false" / "true" into proper booleans, but does not resolve relative file paths.

Expected behavior

A relative verify path should be resolved to an absolute path before being passed to trino.dbapi.connect(), so SSL verification works regardless of the process's current working directory.

Suggested fix

In _apply_trino_ssl_overrides, after coercion, resolve relative paths with pathlib.Path:

python
from pathlib import Path

def _apply_trino_ssl_overrides(connect_kwargs: dict) -> dict:
    if "verify" in connect_kwargs:
        coerced = _coerce_trino_verify(connect_kwargs.pop("verify"))
        if coerced is not None:
            # Resolve relative CA paths so they don't depend on CWD
            if isinstance(coerced, str) and not Path(coerced).is_absolute():
                coerced = str(Path(coerced).resolve())
            connect_kwargs["verify"] = coerced
    # ... rest of function unchanged

Alternatively, accept an optional root_path parameter to resolve against, which would let callers anchor to their project root rather than relying on Path.resolve() (which still depends on CWD).

Reproduction

python
import os
os.chdir("/tmp")  # any directory that isn't the project root

from wren import DataSource, WrenEngine
# configure with verify: "certs/my-ca.pem" (relative path)
# connection fails — requests looks for /tmp/certs/my-ca.pem

Environment

  • wrenai 0.14.0
  • Python 3.14
  • macOS / Linux