Repository navigation
Closed
Labels
Description
Status: filed
Drives: docs/audits/routine.md
Findings
Critical (P0/P1)
- F1 [P0] [security] RoutineViewer DROP routes through raw executeQuery with identifier string concat — no escape, no production-safety, no read-only, no dedicated command — [P0][security] RoutineViewer DROP routes through raw executeQuery with identifier string concat — no escape, no production-safety, no read-only #393
- F2 [P0] [bug] executeProcedure runs USE + SET + CALL + SELECT @vars as multi-statement SQL — single-statement failure rolls back nothing; identifier interpolation in CALL — [P0][bug] executeProcedure runs USE + SET + CALL + SELECT @vars as multi-statement SQL — partial apply, identifier interpolation in CALL #394
- F3 [P1] [bug] parseSingleParam doesn't extract DEFAULT clauses — default values are lost; user can't see them in the input hint — [P1][bug] parseSingleParam doesn't extract DEFAULT clauses — default values are lost #395
- F4 [P1] [bug] RoutineViewer outParamResults reads from the LAST query result set — if the procedure emits multiple SELECTs, the real result is hidden — [P1][bug] RoutineViewer outParamResults reads from the LAST query result set — multiple SELECTs hide the real result #396
- F5 [P1] [security] executeFunction constructs SELECT with raw identifier concat; formatParamValue uses backslash-escape — [P1][security] executeFunction constructs SELECT with raw identifier concat; formatParamValue uses backslash-escape #397
- F6 [P1] [bug] formatParamValue returns invalid SQL for typed input that fails numeric/date parsing — no client-side validation, errors only at execute time — [P1][bug] formatParamValue returns invalid SQL for typed input that fails numeric/date parsing #398
Backlog (P2/P3)
- F7 [P2] [bug] RoutineViewer Monaco editor hardcodes theme=vs-dark — doesn't respect app theme setting
- F8 [P2] [bug] parseRoutineMetadata RETURNS regex doesn't capture CHARSET / COLLATE modifiers on the return type
- F9 [P2] [ux] RoutineViewer DROP uses window.confirm — native browser dialog, not styled
- F10 [P2] [test] RoutineViewer.test.tsx doesn't cover the OUT-param execution flow
- F11 [P3] [bug] routine-parser.ts doesn't handle backslash-escaped single quotes
- F12 [P3] [arch] RoutineViewer calls api.executeQuery directly — bypasses resultStore safety
- F13 [P3] [test] No unit tests for lib/routine-parser.ts — fragile regex-heavy code is untested
- F14 [P3] [arch] RoutineViewer reuses Monaco editor with raw import — no shared abstraction
Good (👍)
- parseRoutineMetadata correctly handles NOT DETERMINISTIC before DETERMINISTIC
- splitParams respects parens depth and single-quote escaping
- IPC chain is clean (api.* only)
- Procedure execution via session variables (canonical MySQL pattern)
- Type-aware input rendering (number/date/datetime-local/time/text)
- Result display handles both result sets and rows_affected statements
- Direction badges color-coded (IN blue, OUT amber, INOUT purple)
- Retry button on load failure
- Edit button opens new query tab and copies DDL
- DROP confirmation via window.confirm (minimal friction)
- Function vs procedure render paths are distinct
- Test coverage: 11 tests for happy-path, error-retry, FUNCTION vs PROCEDURE
Doc drift
- DESIGN_REQUIREMENTS FR-4.2.3 promises "definer" but parser doesn't extract DEFINER=…@…
- DESIGN_REQUIREMENTS doesn't promise a "Drop routine" UI — viewer has one, not in spec
- TESTING_STRATEGY has no routine_tests.rs table
Activity
EVWorth commentedon Sep 12, 2026
Routine viewer is clear.
The P0/P1s
executeQuerywith string concat@xon the shared connection, so parameters now go through@sqlpilot_param_<name>. The transaction the issue asked for is rejected: session variables are not transactional, and wrapping a CALL changes the semantics of procedures that manage their own transactionssql-quotework; now verified live on MySQL 8.0.46 and MariaDB 11.8 rather than assumed, with tests pinning the statement shapestype="number"reads back""for anything the browser cannot parse, which this dialog sends as NULL, so a mistyped id became a call with no id, silentlyThe P2/P3 backlog
Fixed:
theme="vs-dark", so on a light theme it was the only black rectangle on the screen.RETURNS varchar(80) CHARSET utf8mb4— which is whatSHOW CREATE FUNCTIONactually prints — showed asvarchar(80), and a function returning utf8mb4 is a different function from one returning latin1. COLLATE and theCHARACTER SETspelling too.window.confirmfor the drop. Replaced with the app's own dialog — and while there, the five in the schema tree (view, procedure, function, trigger, event) as well, since they were the same call. On a production connection it does not ask twice: the drop runs throughresultStore, whose production dialog names the statement and is the stronger of the two.buildProcedureBatch, covering OUT and INOUT initialisation, the read-back SELECT, and the case where there is nothing to read back.routine-parser.ts— 22 now.Not done, with reasons:
api.executeQuerydirectly — no longer true for the destructive path, which was the point: the drop goes throughresultStore. The reads still call the API directly, which is correct — there is no gate to skip on aSHOW CREATE.Nothing from this audit is outstanding.