You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[P0][security] RoutineViewer DROP routes through raw executeQuery with identifier string concat — no escape, no production-safety, no read-only #393
src/components/routine/RoutineViewer.tsx:209-219 (handleDrop) calls api.executeQuery(connectionId, DROP ${routineType} `${database}`.`${routineName}`) with three identifier interpolations and no escape helper. Routine/database names cannot legally contain backticks in MySQL, but the helper-name pattern matches compare F4 (sync-generator.ts:5-7 escapeId unused) and admin F16 (escapeIdentifier mis-named). Concrete: (a) the DROP bypasses resultStore.executeQuery's production-safety check (DESTRUCTIVE regex would trigger confirm dialog — but api.executeQuery is called directly, skipping it). (b) No read_only enforcement (admin F1 pattern). (c) No routine-existence check first. (d) window.confirm is browser-native, not styled, not accessible.
Files
src/components/routine/RoutineViewer.tsx:209-219
Repro
Connect to production DB
Open Routine Viewer for sp_test
Click Drop — confirm dialog appears (window.confirm)
The DROP runs without production-safety check from resultStore
Expected
Drop on a non-existent routine returns CoreError::RoutineNotFound. Drop on read_only=true profile is rejected. The styled confirm dialog matches the app's design; ESC closes.
Proposed fix
(1) Add a Tauri command drop_routine(connection_id, database, routine_name, routine_type) -> Result<(), CoreError> in commands/mod.rs that (a) validates the routine exists via inspector.rs:get_routines, (b) checks ConnectionManager::get_profile(connection_id).read_only and rejects with CoreError::ReadOnlyViolation if true, (c) uses ? placeholder binding for the identifier (or server-side escaping), (d) emits a tracing::info!(actor=%connection_user, target=%routine_name) audit line. (2) Frontend handleDrop calls this single command. (3) Replace window.confirm with a styled confirm modal (matching the rest of the app) that shows the routine name and database. (4) Use escapeId from sync-sql-generator.ts (or a new src/lib/sql-quote.ts) at the IPC boundary. Scope: M.
Acceptance
Drop on a non-existent routine returns CoreError::RoutineNotFound. Drop on read_only=true profile is rejected. The styled confirm dialog matches the app's design; ESC closes.
Activity
fix(safety): gate every destructive write on production, not just the…
fix(safety): gate every destructive write on production, not just the…