Repository navigation
fix(safe-mode): read MySQL, MariaDB and TiDB executable comments as each server runs them - #3791
Merged
Merged
Conversation
…sql-executable-comments
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
SQLExecutableCommentReadings: the texts a MySQL, MariaDB or TiDB server may run from a statement, one per server family and version threshold. A skipped or plain comment is blanked, a run comment is unwrapped./*!NNNNNskipped above the server's version past one nested/* */, MariaDB's/*!50700../*!99999band, 5 or 6 version digits,/*M!plain on MySQL,/*T!run on TiDB,/*m!plain everywhere, OceanBase's flat retry.SQLLexicalReadings.lexings(of:)and keeps the worst: Safe Mode levels, MCP, AI chat, AppleScript, the CLI, dashboard tiles, iOS, catalog refresh, row write refusal./*!and/*M!as executable, and lexes a run body as code: nested comments,#and--, no second level. The PluginKit lexer matches.INTO/**/OUTFILE,LOAD_FILE (), andALTER TABLE ... TRUNCATE PARTITIONis destructive.MySQLSessionFootprintreads the statement behind a version comment a server may skip.DELIMITER ;;.apple/scripts/probes/check-mysql-executable-comments.sh: passes on MySQL 8.0.46 and 8.4.11, MariaDB 11.4.13, TiDB 8.5.1.Test plan
SQLExecutableCommentReadingsTests: each measured text drops the table under exactly the servers that dropped it, and every server's statements are among the texts the gates read.ExecutionGateExecutableCommentTests: each executable comment form hiding a DROP is refused in Read-Only and confirmed as destructive at every other Safe Mode level, on MySQL and MariaDB.QueryClassifierExecutableCommentTests,ExternalStatementGateExecutableCommentTests,DashboardTilePolicyTests,SQLWriteClassifierTests,CatalogChangeClassifierTests,SQLFileParserTests,SQLStatementSplittingTests,SQLLexicalFeatureMappingTests,MySQLSessionFootprintTests.Fixes #3784