Commit Graph

393 Commits

Author SHA1 Message Date
t8y2 3f58526df8 fix(mcp): add back use std::env, use compile-time #[cfg] for locate_mcp_bin 2026-06-10 21:31:52 +08:00
Doracoin 7234d9ebd3
fix(desktop): Improve shell Node detection for MCP startup
Thanks for the detailed investigation and fix!
2026-06-10 21:30:44 +08:00
t8y2 20622bc762 fix: resolve clippy warnings and missing redis_key_separator field 2026-06-10 20:05:20 +08:00
John Jin 0bd07ccf46
feat: add InfluxDB support (#980) 2026-06-10 14:37:53 +08:00
t8y2 22928c51cc chore(release): bump version to 0.5.31 2026-06-10 13:01:57 +08:00
t8y2 1545224d34 fix: add missing read_only field and resolve clippy warnings 2026-06-10 12:55:39 +08:00
t8y2 bfec556e9b feat(readonly): add read-only mode for all database connections
- Add read_only field to ConnectionConfig with backward-compatible serde defaults
- SQL classifier with first-keyword + embedded keyword defense layers
- PRAGMA white-listing for safe read-only operations
- Guard all write entry points: SQL, Mongo, Redis, etcd, MCP Bridge
- 16 unit tests covering edge cases (CTE, case insensitivity, string masking)
- 7-language i18n support
- Fast-fail at command/route level before pool creation

Closes #889
2026-06-10 11:58:18 +08:00
t8y2 2f5469ce6d fix(oracle): add listener driver hint 2026-06-10 11:37:45 +08:00
runstone a440415e86 feat(readonly): add read-only mode for all database connections
## Background
Add a read-only toggle for database connections that blocks all write
operations (INSERT, UPDATE, DELETE, DROP, etc.) when enabled, allowing
only read queries (SELECT, SHOW, EXPLAIN, etc.). Closes #889.

## Changes

### Data Model
- Added `read_only: bool` field to ConnectionConfig (Rust struct, TS
  interfaces, and ConnectionConfigData deserialization layer)
- Used `#[serde(default, skip_serializing_if = "is_false")]` for
  backward/forward compatibility with existing configs

### Frontend UI
- Added "Read Only" checkbox in connection dialog
- 7-language i18n support (en/es/it/pt-BR/zh-CN/zh-TW)

### SQL Classification (query_execution_sql.rs)
- Added `is_write_sql()` with two-layer defense:
  - Layer 1: First-keyword check (must start with known read keyword)
  - Layer 2: Embedded dangerous keyword detection (catches CTE-wrapped
    writes like `WITH ... AS (DELETE FROM ...)`)
  - `FROM` keyword supported as DuckDB SELECT-less syntax indicator
- Added `check_read_only()` returning descriptive error with connection name
- Added 16 unit tests covering: pure reads/writes, CTE, case insensitivity,
  string literal masking, comment stripping, stored procedure calls, edge cases

### SQL Execution Guards (query.rs / transfer.rs)
- Added `check_read_only_for_connection()` and `_multi()` helper functions
  with lazy name clone (only allocates when read_only is true)
- 6 interception points: `do_execute`, MySQL batch, SQL Server batch,
  DuckDB batch, transaction execution, transfer execution

### Non-SQL Write Guards — Tauri Commands
- Added `ensure_connection_writable()` helper (connection.rs)
- Mongo: 6 write entry points (insert/update/delete, single + batch)
- Redis: 15 write entry points (SET, DEL, HSET, HDEL, LPUSH, LSET, LREM,
  SADD, SREM, ZADD, ZREM, EXPIRE, FLUSHDB, delete_keys, execute_command)
  - execute_command uses RedisCommandSafety classification to allow
    safe read commands through raw command interface
- etcd: 2 write entry points (put, delete)
- sql_file: SQL file execution guarded
- MCP Bridge: 4 write entry points (Insert/Update/Delete/SQL query)

### Non-SQL Write Guards — Web API
- Local `ensure_writable()` helper in each route module
- Redis: 12 write endpoints including classified execute_command
- Mongo: 6 write endpoints
- etcd: 2 write endpoints
- sql_file, table_import, transfer: early rejection

### Test Updates
- Updated ConnectionConfig construction in 7 test files with
  `read_only: false` initialization

## Defense-in-Depth
- Layer 1: Command/Route-level early rejection (saves resources)
- Layer 2: Core SQL classifier (`is_write_sql` — first keyword + embedded scan)
- Layer 3: Core execution-time interception (do_execute/transfer/transaction)
2026-06-10 10:58:52 +08:00
t8y2 edba8214b5 feat: show username/password fields for Access database connections 2026-06-10 08:37:18 +08:00
t8y2 d0bf6c3b53 feat(redis): persist command history across sessions (#933) 2026-06-10 04:34:45 +08:00
t8y2 d08385e75f feat: add Turso/libSQL database support
Turso is a distributed SQLite database built on libSQL, offering HTTP-based
connectivity with auth token authentication. This change adds full support:

- New DatabaseType::Turso and PoolKind::Turso variants
- TursoClient driver using libSQL HTTP pipeline API (/v2/pipeline)
- Bearer token auth via password or url_params (auth_token=)
- Multi-statement batch pipeline for transactional integrity
- Standalone BEGIN/COMMIT/ROLLBACK treated as no-ops (pipeline is auto-commit)
- Full metadata support: tables, columns, indexes, foreign keys, triggers, DDL
- Frontend: connection form, SQL completion (SQLite syntax), capability sets
- Built-in databases (SQLite/Turso/DuckDB/RQLite/Access) placed first in selector
- Unit tests (15) + integration tests against live libsql-server (12)
- Single connection pool, skips TCP probe

Closes #948
2026-06-10 04:18:05 +08:00
t8y2 2a424b6f75 fix: add parent folder for SQL sync directory, show toast when no sync dir set 2026-06-10 02:59:00 +08:00
t8y2 9ffa4c41d9 feat: add SQL library panel with folder/file management, rename, and sync support 2026-06-10 02:46:10 +08:00
DengQingNian 35692bc53b
feat(redis): add TTL, structured entries, Stream and JSON support to create key dialog (#947)
Thanks @DengQingNian! Great feature — TTL, structured entries, Stream, and JSON support for Redis key creation.
2026-06-09 22:08:08 +08:00
二丫讲梵 41758e6bb1
feat(connection): 增加可见数据库选择功能 (#944)
感谢 @eryajf 的贡献!此功能允许用户在创建或编辑连接时选择可见的数据库,支持多种数据库类型。
2026-06-09 20:56:39 +08:00
t8y2 699281c7a6 fix(ci): remove brittle source-text assertion tests
These tests checked for specific code patterns in source files via
include_str!, making them fail whenever unrelated code introduced
the same patterns elsewhere. They tested how code is written rather
than what it does.
2026-06-09 18:58:28 +08:00
t8y2 348f39ff35 perf(tauri): move blocking command work off async runtime 2026-06-09 17:53:07 +08:00
cl1107 3995524e5d
feat(import): 添加 DataGrip 连接导入支持 (#936)
- 新增 datagripImport 模块解析 XML 配置
- 支持从 macOS Keychain 自动填充密码
- 添加 Keychain 读取的 Tauri 命令
- 更新多语言翻译文件
- 集成到侧边栏导入流程中
2026-06-09 16:45:59 +08:00
t8y2 29bfe3f1c3 feat(mcp): enforce visible_databases filter in MCP bridge handlers
Add check_visible_database() helper and apply it to list_tables,
describe_table, and execute_query handlers to prevent MCP tools
from accessing databases outside the user's visibility whitelist.
2026-06-09 13:28:38 +08:00
t8y2 2a7b26baad fix: add missing idle_timeout_secs in ConnectionConfig constructors and fix clippy warnings 2026-06-09 11:56:39 +08:00
James-Leong 171c7cd8d7 fix(ssh): prevent duplicate SSH tunnels from concurrent pool creation (#891)
start_tunnel() and start_chain() had a check-then-act race condition:
multiple concurrent callers could all see an empty cache and each
spawn a new SSH tunnel. The tunnel that lost the insert race was
orphaned, causing queries routed through it to fail.

Use double-check locking with stale entry eviction: hold the lock for
the cache lookup, release it during the slow SSH handshake, then
re-check under the lock before inserting. If another caller already
created the tunnel, abort the duplicate and return the existing port.

Also check handle liveness on cache hits so that callers don't get a
dead port back when the background tunnel task has exited.

Add a matching re-check in the MongoDB connection pool creation path.

Add idle_timeout_secs connection option (default 60s) to preempt
server-side connection idle timeouts that cause "unexpected end of
file" errors on pooled MongoDB connections.

Reject MongoDB queries in the generic SQL execution path before any
pool or session-key creation. Previously, a typo in a MongoDB shell
command would fall through to executeMulti / execute_sql_statement,
which called get_or_create_pool_for_session and leaked a session-scoped
MongoDB Client (and SSH tunnel resources) before eventually returning
"Use MongoDB-specific commands".

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-06-09 10:29:42 +08:00
t8y2 9dfc2ba294 feat: support H2 file connections 2026-06-08 20:09:27 +08:00
t8y2 465ed195cf fix(sql): decode opened SQL files with charset fallback 2026-06-08 17:45:09 +08:00
t8y2 afc8d8f3c1 fix(mysql): preserve session variables across query runs 2026-06-08 12:39:18 +08:00
t8y2 b777cddde5 feat: add user-facing debug logs 2026-06-08 12:16:49 +08:00
t8y2 47ee9c6d58 chore: release 0.5.30 2026-06-08 02:26:25 +08:00
Quinlevi 897e6998fd
feat(dameng): full DM8 database support
Adds Dameng DM8 explain/autotrace support and user-management SQL support, with backend autotrace safety checks and escaped CREATE USER SQL.
2026-06-08 02:07:00 +08:00
t8y2 e6062b2b07 feat(etcd): add agent-backed etcd support 2026-06-08 00:58:42 +08:00
t8y2 7bd8d29a79 feat(sidebar): lazily load database object groups 2026-06-07 23:44:40 +08:00
t8y2 a473f4ff8f chore: switch license to Apache-2.0 2026-06-07 17:34:59 +08:00
Caisin 8c0fe3a6e7
Expose forwarded database port for local testing (#803)
Database connection context menus now show a copy action when the connection has enabled transport layers. The action starts or reuses the ordered transport chain, copies the final local forwarding port, and keeps runtime config cached so later disconnect cleanup can stop the created tunnel.

Constraint: Local testing sometimes needs external tools to connect through DBX's generated proxy/tunnel endpoint

Rejected: Copy full host:port endpoint | user specifically asked for the port and existing tunnel host is always localhost

Rejected: Require an active pool before copying | local test workflows may need the tunnel before opening the DBX connection

Confidence: high

Scope-risk: moderate

Tested: pnpm test -- packages/app-tests/connectionTransport.test.ts (ran full app-tests: 862 passed)

Tested: pnpm typecheck

Tested: pnpm exec oxlint --vue-plugin apps/desktop/src/components/sidebar/TreeItem.vue apps/desktop/src/lib/connectionTransport.ts apps/desktop/src/lib/api.ts apps/desktop/src/lib/tauri.ts apps/desktop/src/lib/http.ts

Tested: cargo check -p dbx-core -p dbx-web

Tested: cargo check -p dbx

Tested: cargo fmt --check --all

Co-authored-by: caisin <caisin@caisins-Mac-mini.local>
2026-06-07 01:00:34 +08:00
Caisin e9ee982843
Preserve ordered SSH and proxy connection layers (#802)
* Preserve ordered SSH and proxy connection layers

Replace separate SSH/proxy connection fields with ordered transport_layers while keeping legacy migration and secret fallback paths intact. The UI now edits SSH tunnel/proxy layers in configured order without a global SSH enable gate.

Constraint: Existing saved SSH tunnels, proxy settings, and secret-store keys must continue to load through migration.
Rejected: Folding proxy fields into SshTunnelConfig | mixes proxy semantics into an SSH-specific structure.
Confidence: high
Scope-risk: moderate
Directive: Keep SSH/proxy structs provider-specific; put cross-layer chaining in transport_layer_tunnel orchestration.
Tested: git diff --check; cargo fmt --check; cargo check --workspace; cargo test -p dbx-core --lib; vue-tsc --noEmit --project apps/desktop/tsconfig.json; tsc -p packages/node-core/tsconfig.json --noEmit; oxlint --vue-plugin apps/desktop/src; tsx --tsconfig apps/desktop/tsconfig.json --test packages/app-tests/*.test.ts; tsx --test packages/node-core/tests/*.test.ts
Not-tested: Live external SSH/proxy/database endpoint integration.

* Keep ordered transport changes CI-format clean

Constraint: CI pnpm check failed only on oxfmt formatting for two desktop TypeScript files
Confidence: high
Scope-risk: narrow
Directive: Keep generated/editor config changes out of this PR fix commit
Tested: PATH="/Volumes/data/code/rust/dbx/node_modules/.bin:/Users/hekx/.codex/tmp/arg0/codex-arg0nuL34n:/Users/hekx/.cargo/bin:/Users/hekx/.local/bin:/opt/homebrew/opt/llvm/bin:/opt/homebrew/opt/libpq/bin:/Volumes/data/Users/hekx/.opencode/bin:/Users/hekx/.bun/bin:/Volumes/data/sdks/flutter/bin:/Volumes/data/Users/hekx/.cargo/bin:/Users/hekx/.local/bin:/opt/homebrew/opt/llvm/bin:/opt/homebrew/opt/libpq/bin:/Volumes/data/Users/hekx/.opencode/bin:/Users/hekx/.bun/bin:/Volumes/data/Users/hekx/Library/pnpm:/Volumes/data/sdks/flutter/bin:/Volumes/data/Users/hekx/.cargo/bin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/pkg/env/global/bin:/opt/X11/bin:/Library/Apple/usr/bin:/Applications/Wireshark.app/Contents/MacOS:/usr/local/go/bin:/opt/homebrew/bin:/opt/podman/bin:/Applications/Ghostty.app/Contents/MacOS" rtk node scripts/run-check.mjs
Not-tested: GitHub Actions rerun not observed locally

* Keep Rust checks warning-clean

Constraint: cargo clippy --workspace --all-targets --all-features -- -D warnings failed across core, web, and tauri crates
Rejected: Broad workspace-level clippy suppression | kept allows local to long-argument command/API boundaries
Confidence: high
Scope-risk: moderate
Directive: Preserve src-tauri/tauri.conf.json as an unrelated local change outside this commit
Tested: rtk cargo clippy --workspace --all-targets --all-features -- -D warnings
Not-tested: Full GitHub Actions rerun not observed locally

* Reuse existing proxy tunnels on retry

Proxy tunnel startup now mirrors SSH tunnel behavior by returning the existing local port for an active connection id instead of replacing the managed handle. A second map check aborts a just-spawned duplicate handle if a concurrent retry won the race before insertion, preventing orphaned listeners while keeping the change narrow.

Constraint: Reviewer requested proxy tunnel behavior align with SSH local-port reuse

Rejected: Always overwrite and abort the previous handle | less consistent with SSH behavior and churns listeners during retries

Confidence: high

Scope-risk: narrow

Tested: cargo fmt --check --all

Tested: cargo test -p dbx-core db::proxy_tunnel::tests::start_tunnel_reuses_existing_local_port

Tested: cargo clippy -p dbx-core --all-targets -- -D warnings

---------

Co-authored-by: hekx <hekx@momandeMac-mini.local>
Co-authored-by: caisin <caisin@caisins-Mac-mini.local>
2026-06-06 23:22:29 +08:00
t8y2 0c3572d779 fix(mcp): detect node from user shell environment 2026-06-06 22:45:28 +08:00
t8y2 85e2cf1f2f fix: stabilize custom theme integration 2026-06-06 21:04:19 +08:00
polemp a067ee8d76
feat: custom theme system with PostgreSQL PL/pgSQL highlighting fix
- Fix PostgreSQL function highlighting by disabling doubleDollarQuotedStrings
  in extended PostgreSQL dialect, enabling PL/pgSQL syntax highlighting
  inside $ blocks
- Add complete custom editor theme system with multi-theme management
  (create, rename, duplicate, delete), visual color editor (12 colors),
  JSON import/export, real-time preview, and 12 preset color schemes
- Add background/foreground color customization with system theme defaults
- Optimize EditorSettingsDialog layout: 2-column grid with font selector
  taking available space and theme dropdown grouped with custom theme button
- Add i18n support for custom theme UI (en, zh-CN, zh-TW, es)
- Fix Tauri production build by adding custom-protocol feature
- Update .gitignore for temporary build artifacts

Closes t8y2#788

Co-authored-by: Sam <14344444@@qq.com>
2026-06-06 20:59:21 +08:00
t8y2 2b5300722f feat: optimize tab result lifecycle caching 2026-06-06 20:30:35 +08:00
t8y2 bcafb9bc93 Revert "feat: support multiple desktop windows"
This reverts commit 642fa39bb8.
2026-06-06 00:01:38 +08:00
t8y2 642fa39bb8 feat: support multiple desktop windows 2026-06-05 20:45:00 +08:00
Xudong Guo 9b15843e1a feat: add KWDB support 2026-06-05 16:55:38 +08:00
t8y2 0887b96236 feat: add rqlite database support 2026-06-05 01:02:07 +08:00
t8y2 a799958328 feat: add driver runtime manager 2026-06-04 23:20:15 +08:00
t8y2 8d51a5779b fix: cancel DuckDB queries via duckdb_interrupt instead of only cancelling async future
Previously, cancelling a DuckDB query only dropped the tokio CancellationToken,
but the actual DuckDB C call continued running in spawn_blocking. This caused
the UI to show "正在停止..." until timeout silently expired.

Now, RunningQueries stores per-execution interrupt callbacks. For DuckDB and
ExternalTabular branches, an InterruptHandle is registered on query start so
cancel() calls duckdb_interrupt() at the C level, truly stopping the query.
2026-06-04 17:20:13 +08:00
t8y2 293600d9b4 fix: pass connection query timeout to execute_batch so ALTER respects configured timeout
Previously execute_batch always used the hardcoded 30s default timeout,
ignoring the user's query_timeout_secs connection setting. This caused
long-running ALTER TABLE statements on large tables to time out even
when the user configured a longer timeout or disabled it entirely.
2026-06-04 13:54:20 +08:00
t8y2 0194adfa4c chore(release): bump version to v0.5.29 2026-06-04 02:10:39 +08:00
t8y2 69ecde8fdf perf(doris): speed up metadata browsing 2026-06-04 00:05:14 +08:00
t8y2 e3fec0f5d9 fix(elasticsearch): improve local TLS connection handling 2026-06-03 18:29:30 +08:00
t8y2 29118700b6 feat(mcp): improve setup defaults and config hints 2026-06-03 16:40:40 +08:00
t8y2 7fb53ee0b4 fix(drivers): skip blocked driver updates 2026-06-03 14:39:46 +08:00
t8y2 3f4521f550 chore(release): bump version to 0.5.28 2026-06-03 12:55:04 +08:00