Skip to content

fix(mysql): harden custom SELECT validation in table browser (#274) - #288

Merged
ZhuchkaTriplesix merged 1 commit into
devfrom
issue/274-mysql-sql-validation
Jul 10, 2026
Merged

fix(mysql): harden custom SELECT validation in table browser (#274)#288
ZhuchkaTriplesix merged 1 commit into
devfrom
issue/274-mysql-sql-validation

Conversation

@ZhuchkaTriplesix

Copy link
Copy Markdown
Member

Summary

  • Rewrite isAllowedMysqlSelectQuery to split statements only on semicolons outside string literals, quoted identifiers, and comments (--, #, /* */).
  • Block write-side MySQL constructs (INTO OUTFILE, FOR UPDATE, DML/DDL keywords) when they appear outside masked literals/comments.
  • Add unit tests for semicolons in strings, trailing comments, CTEs, and blocked constructs.

Fixes #274.

Test plan

  • flutter test test/features/mysql/mysql_table_utils_test.dart
  • In MySQL TableView custom SQL, run SELECT * FROM t WHERE col = 'a;b' — should execute
  • Confirm SELECT 1; SELECT 2 and SELECT * INTO OUTFILE ... are rejected

Tokenize SQL outside string literals and comments before splitting on
semicolons so valid queries with ';' in literals are not blocked.
Reject INTO OUTFILE, FOR UPDATE, and other write-side constructs when
they appear outside masked literals/comments.
@github-actions github-actions Bot added bug Something isn't working core Core library logic and services mysql MySQL database driver and workspace labels Jul 10, 2026
@ZhuchkaTriplesix
ZhuchkaTriplesix merged commit 8aab4c0 into dev Jul 10, 2026
4 checks passed
@ZhuchkaTriplesix ZhuchkaTriplesix self-assigned this Jul 12, 2026
@ZhuchkaTriplesix
ZhuchkaTriplesix deleted the issue/274-mysql-sql-validation branch July 26, 2026 14:39
ZhuchkaTriplesix added a commit that referenced this pull request Jul 27, 2026
fix(mysql): harden custom SELECT validation in table browser (#274)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working core Core library logic and services mysql MySQL database driver and workspace

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant