Repository navigation
fix(grid): stop a typed boolean becoming 0, and widen the production gate - #531
Merged
Merged
Conversation
…gate Two ways a statement could do something other than what it looked like. A TINYINT(1) cell can be typed into as well as ticked, and whatever was typed went straight into the UPDATE. MySQL accepts a string for a boolean column and converts a non-numeric one to 0, so typing "true" set the column to false — the opposite of the intent — and the statement succeeded, so nothing reported it. Boolean columns now parse the spellings people actually type (true/false, yes/no, on/off, t/f, 1/0, any case) and refuse anything else rather than guessing, since guessing is what produced the wrong value. A cell that cannot be read is marked invalid and keeps focus instead of being written; leaving it reverts rather than committing something the server would reinterpret. The production confirmation matched DROP, DELETE, TRUNCATE and ALTER as a bare regex over the raw text. It missed RENAME TABLE, GRANT, REVOKE, SET PASSWORD, LOCK TABLES, KILL, CREATE USER and DROP USER, all irreversible or privilege-changing. It also matched keywords inside string literals and comments, so `WHERE msg = 'DROP TABLE users'` prompted for nothing. Both directions now go through one place that strips what the server ignores first. Conditional comments are deliberately kept: `/*! DROP */` is not a comment to MySQL, it executes the contents, so removing it like an ordinary comment is precisely how `/*! DROP */ TABLE users` read as harmless while dropping the table. Their inner SQL is unwrapped and checked like anything else. UPDATE and INSERT are still not prompted for. They are the ordinary business of a database client, and a dialog on every one teaches people to dismiss it, which costs more than it saves. Refs #415, #421
This was referenced Sep 4, 2026
Closed
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.
Refs #415, #421. Two ways a statement could do something other than what it looked like.
A typed boolean became its opposite (#421)
A
TINYINT(1)cell renders as a checkbox, but double-clicking opens a text field, and whatever was typed went into the UPDATE unchanged. MySQL accepts a string for a boolean column and converts a non-numeric one to 0 — so typingtrueset the column to false. The statement succeeded, so nothing reported it.Boolean columns now parse the spellings people actually type —
true/false,yes/no,on/off,t/f,1/0, any case — and refuse anything else rather than guessing, since guessing is exactly what produced the wrong value. An unreadable cell is marked invalid and keeps focus; blurring reverts rather than committing something the server would reinterpret.The production gate had holes on both sides (#415)
Missed entirely:
RENAME TABLE,GRANT,REVOKE,SET PASSWORD,LOCK TABLES,KILL,CREATE USER,DROP USER— all irreversible or privilege-changing. And it matched keywords inside strings and comments, soWHERE msg = 'DROP TABLE users'prompted for nothing.Both directions now go through one place that strips what the server ignores first.
The subtle part: conditional comments are deliberately kept.
/*! DROP */is not a comment to MySQL — it executes the contents — so stripping it like an ordinary comment is precisely how/*! DROP */ TABLE usersreads as harmless while dropping the table. Their inner SQL is unwrapped (version prefix removed) and checked like anything else. There's a test for it.UPDATEandINSERTare still not prompted for. They're the ordinary business of a database client, and a dialog on every one teaches people to dismiss it — which costs more than it saves.Verification
11 tests on the safety check (including the conditional-comment bypass and both false-positive directions), 2 on boolean parsing. 1687 unit tests and 292 browser-mode tests — I ran both this time, after CI caught the browser suite on #529 where I'd only run the unit one.
🤖 Generated with Claude Code