Repository navigation
feat(connections): add enforced read-only mode per connection - #1463
NewtTheWolf merged 3 commits into
Conversation
| "mysql" => { | ||
| // Protected exports use the same bounded query path as the editor, | ||
| // including for built-ins, rather than bypassing it with a raw stream. | ||
| match (driver, params.read_only) { |
There was a problem hiding this comment.
SUGGESTION: Read-only dumps of built-in drivers fall into the plugin paging arm
With params.read_only set, mysql/postgres/sqlite no longer use their native streaming arms and instead go through the generic _ arm: LIMIT/OFFSET paging of SELECT * FROM table (1000 rows per page), plugin_row_cells, and json_column_names. That is quadratic on large tables and loses the type-aware SqlCell extraction (extract_value, type_info() == "JSON") the native arms provide, so dump fidelity can differ between a writable and a read-only connection. Consider keeping the native streaming arms for built-ins, since their pools are already protected at connection level (default_transaction_read_only, SET SESSION TRANSACTION READ ONLY, query_only), or at least add a test that compares dump output for both modes.
Code Review SummaryStatus: No Issues Found | Recommendation: Merge Incremental review of
Assumption: PostgreSQL protection ( Files Reviewed (4 files)
Previous Review Summary (commit afc9c2f)Current summary above is authoritative. Previous snapshots are kept for context only. Previous review (commit afc9c2f)Status: 1 Issue Found | Recommendation: Merge after considering the suggestion Overview
Issue Details (click to expand)SUGGESTION
Notes outside the changed lines (not inline-commented)
Backend enforcement ( Fix these issues in Kilo Cloud Files Reviewed (53 files)
Reviewed by claude-sonnet-5.5 · Input: 252 · Output: 1.6K · Cached: 176.4K Review guidance: REVIEW.md from base branch |
NewtTheWolf
left a comment
There was a problem hiding this comment.
Thanks for enforcing the saved connection policy in the shared backend as well as the UI, and for keeping protected pools separate from writable sessions. I reviewed 712f1d5, including startup-script suppression, mutation/import guards, protected exports and the plugin's fail-closed RPC path.
The full frontend suite and targeted read-only/backend coverage pass locally, and typecheck and lint are green. I will now exercise read-only SQLite, PostgreSQL and MySQL connections in the real app, including a database-side write hidden behind a SELECT, finish the full checks, and merge this revision if verification passes.
|
Tested 89773a5 in the real Linux Tauri app with disposable SQLite, PostgreSQL 17 and MySQL 8.4 connections. After resolving the main/translation conflicts, reads work, saved startup writes are skipped, and direct IPC DELETE attempts are blocked for all three. On PostgreSQL, a SELECT calling a write function is rejected by the read-only transaction. A protected read still exports all three rows to CSV, and the protected MySQL path also stops at its one-second query timeout and remains usable.
|
Closes #301
Adds a persistent read-only option in the connection settings to prevent accidental database writes, including queries generated through text-to-SQL.
Builds on #473: read-only mode blocks writes before production confirmation, regardless of the session's “don't ask again” setting. Existing production warnings remain unchanged when read-only mode is disabled.
Changes
Plugin support
Writable plugins can opt in through
capabilities.read_only_queriesand implement theexecute_read_only_queryRPC.Unsupported plugins cannot enable the option. RPC or protection failures never fall back to ordinary execution. Intrinsically read-only plugins require no new RPC.
Includes the manifest schema, TypeScript contract, documentation and compatibility tests.
Current limitations
Validation
cargo check --no-default-featurespassed.Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.