Commit Graph

576 Commits

Author SHA1 Message Date
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 8df9484447 feat(ai): support auth methods 2026-06-10 12:14:36 +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 dadcc348cb fix(ssh): handle invalid key comment encoding 2026-06-10 10:45:14 +08:00
t8y2 ed6d275ca2 fix: remove turso integration tests that hardcode unreachable server 2026-06-10 09:57:27 +08:00
t8y2 edba8214b5 feat: show username/password fields for Access database connections 2026-06-10 08:37:18 +08:00
t8y2 2e021d37d1 fix(ci): add etcd to MCP type description, skip turso tests when unreachable 2026-06-10 04:52:35 +08:00
t8y2 1be4c6afcc fix: resolve clippy, typecheck, and test failures in CI (#933) 2026-06-10 04:40:23 +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 9ffa4c41d9 feat: add SQL library panel with folder/file management, rename, and sync support 2026-06-10 02:46:10 +08:00
t8y2 d7a8f5d285 fix: add etcd to driver manifest, fix SQL library rename focus and remove dblclick rename 2026-06-10 02:45:47 +08:00
t8y2 2796e5c824 fix: enable etcd driver visibility in driver store UI 2026-06-10 02:05:49 +08:00
t8y2 56e1895e91 fix(iotdb): use tree SQL for table cleanup 2026-06-09 22:26:50 +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 348f39ff35 perf(tauri): move blocking command work off async runtime 2026-06-09 17:53:07 +08:00
t8y2 bc3c7c52ea fix(mysql): retry re-prepared statements with text protocol 2026-06-09 17:13:44 +08:00
John Jin 354d21d086
feat(grid): 列是否可排序 (#935) 2026-06-09 16:43:53 +08:00
t8y2 96e11935c2 fix(mongodb): support ObjectId filters by _id 2026-06-09 16:42:36 +08:00
t8y2 ee65fa660d fix(db): always bypass system proxy for all HTTP-based database drivers
Replace per-driver proxy bypass logic with a shared http_client_builder()
that always calls .no_proxy(). Previously ES and rqlite only bypassed for
localhost, causing remote connections to be routed through system proxy
(like Clash Verge) and failing — the same issue #922 fixed for ClickHouse.
2026-06-09 16:42:04 +08:00
srako 46eaaed8f1
fix(clickhouse): bypass system proxy to prevent connection failure 2026-06-09 16:23:13 +08:00
Oleksandr Liakhevych efb0dba0ae
fix(ai): do not provide temperature for OpenAI reasoning models 2026-06-09 16:22:28 +08:00
t8y2 6a14b11efc fix(mongodb): skip SQL semantic diagnostics for MongoDB connections
MongoDB shell syntax like db.collection.find({}) was incorrectly
parsed as SQL, causing a "sql parser error" diagnostic in the editor.
Added MongoDB guards in shouldRunSqlSemanticDiagnostics and
refreshSemanticDiagnostics, matching existing Elasticsearch logic.

Also fix a pre-existing TiDB cloud URL param ordering test failure.
2026-06-09 16:20:50 +08:00
t8y2 ada58dd88f fix(redis): enhance hash value text extraction for search
Extract field names and values from hash-type arrays in
redis_search_value_text() instead of serializing the whole JSON,
so that value search can match individual hash fields and values.
2026-06-09 13:15:20 +08:00
Holata Seminole 70dad4e00b
fix(mysql): require TLS for TiDB Cloud connections (#911)
Thanks!
2026-06-09 12:06:38 +08:00
Yong Studt 98342184af
feat(elasticsearch): translate SELECT * WHERE to ES DSL in-process (#910)
* feat(elasticsearch): translate SELECT * WHERE to ES DSL in-process

`SELECT *` with clauses our hand-written parser doesn't cover (WHERE, IN, BETWEEN, LIKE, IS NULL, ...) is now parsed with sqlparser-rs and translated to a /_search body locally — we no longer hand it off to ES's _sql endpoint.

Why: _sql refuses several common shapes — LIKE on a text field with no .keyword sub-field (the typical filebeat / log-shipper mapping), and SELECT * over docs containing an array field like host.ip. Both translate cleanly to raw DSL. Going through _sql/translate doesn't help either — that lives in the same ES SQL engine and inherits the same restrictions.

Translation:
- field = 'v'                  → term
- field LIKE 'prefix%'         → prefix (optimised)
- field LIKE '%x%'             → wildcard, case_insensitive
- field IN ('a','b')           → terms
- field BETWEEN a AND b        → range gte/lte
- field >/<>=/<=               → range
- field IS NULL / IS NOT NULL  → bool.must_not.exists / exists
- A AND B AND C                → flattened bool.must
- A OR B                       → bool.should, minimum_should_match: 1
- NOT A                        → bool.must_not
- ORDER BY f ASC|DESC          → sort
- LIMIT N OFFSET M             → size / from

SQL LIKE patterns: % → *, _ → ?, backslash escapes preserved, user-written * / ? in patterns escaped back to literals.

Input runs through the existing adapt_elasticsearch_sql_query first so hyphenated indices (filebeat-7.17.1-…) and @timestamp-style identifiers reach sqlparser as double-quoted identifiers.

Also: 0-hit _search bodies now surface as an empty grid (with an _id column placeholder) instead of falling back to the raw status/response JSON view — `.filter(|h| !h.is_empty())` was masking the empty-result case.

Adds docs/screenshot-es-sql-where.png demonstrating SELECT * with WHERE log.offset = N on a long field — would 400 through _sql, works through the in-process translator.

Follows up on #874.

* chore(test): fill ConnectionConfig::idle_timeout_secs in test fixtures

After the new pub idle_timeout_secs: u64 field was added to ConnectionConfig, 11 #[cfg(test)] / tests fixture constructors still built the struct without it, so `cargo test --workspace --locked` and `cargo clippy --all-targets` would fail with E0063 against the test profile. `cargo check` alone passed because the lib path doesn't compile tests.

Filled in with default_idle_timeout_secs() (matches the field's own #[serde(default = …)]) so future bumps to the default flow through automatically.

---------

Co-authored-by: t8y2 <1156263951@qq.com>
2026-06-09 11:59:49 +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 80895fe273 fix(mongodb): support replica set connection URL parsing and timeout
Frontend: add regex-based MongoDB URL parser to handle multi-host URIs
that the WHATWG URL parser rejects. Backend: separate
server_selection_timeout from connect_timeout for multi-host URIs to
prevent topology discovery from being cancelled by tokio timeout.
2026-06-09 01:02:11 +08:00
t8y2 619573a69d fix(oracle): skip SQL pagination clauses for Oracle 11g compatibility
Oracle 11g does not support FETCH FIRST / LIMIT syntax. Skip appending
pagination clauses at SQL level and rely on JDBC setMaxRows for row
limiting, which already works across all Oracle versions.
2026-06-09 00:44:20 +08:00
t8y2 befee2fd4c feat(postgres): support sequence objects 2026-06-08 22:54:14 +08:00
t8y2 87b8f1f462 fix(ai): support proxied API channels 2026-06-08 20:32:54 +08:00
t8y2 9dfc2ba294 feat: support H2 file connections 2026-06-08 20:09:27 +08:00
Yong Studt 2628fb8374
feat(elasticsearch): add SQL-model execution with mapping-aware completion
- Route SELECT * FROM <index> through /_search for simple browses; aggregates/projections stay on /_sql
- Drive completion columns from /_mapping (flattened dotted fields, multi-fields)
- Switch editor completion to SQL when the active statement starts with SELECT/WITH on ES
- Skip generic SQL semantic diagnostics for ES (hyphenated wildcard indices caused 500s)
- Wire ES into server-side pagination plan; derive completion context from line blocks
- Fix result-grid pagination exceeding in-memory result sets (allRowsLoaded)
2026-06-08 17:53:05 +08:00
t8y2 531634d9b6 fix(import): accept JSON files with UTF-8 BOM 2026-06-08 17:07:17 +08:00
t8y2 433c38473a fix(goldendb): quote identifiers with backticks 2026-06-08 16:42:45 +08:00
t8y2 83c3be5a67 fix(trino): pass SSL options to agent JDBC URL 2026-06-08 16:25:56 +08:00
t8y2 90a1316037 fix(jdbc): avoid IRIS max rows SQL rewrite 2026-06-08 16:17:27 +08:00
t8y2 ab739e9dcb fix(duckdb): render complex values as json 2026-06-08 14:45:26 +08:00
t8y2 2b0af57be8 fix(mysql): handle common connection URL params 2026-06-08 14:34:56 +08:00
t8y2 afc8d8f3c1 fix(mysql): preserve session variables across query runs 2026-06-08 12:39:18 +08:00
t8y2 57fe578789 fix: hide YashanDB recyclebin objects 2026-06-08 12:35:14 +08:00
t8y2 b777cddde5 feat: add user-facing debug logs 2026-06-08 12:16:49 +08:00
t8y2 c38994d02b fix: expand tilde in file path validation for SSH keys and TLS certs
`validate_file_path` now expands leading `~` to the user's home directory
before checking file existence, so paths like `~/.ssh/id_rsa` work on macOS
and Linux. Also fixes error messages that incorrectly said "Database file".
2026-06-08 11:14:11 +08:00
t8y2 47ee9c6d58 chore: release 0.5.30 2026-06-08 02:26:25 +08:00
t8y2 c54e43e4b9 fix: exclude etcd from driver store and fix CI test overlap 2026-06-08 02:08:08 +08:00