fix(server-utils): Sanitize SQL Server bracketed identifiers - #24255
Open
s1gr1d wants to merge 3 commits into
Open
fix(server-utils): Sanitize SQL Server bracketed identifiers#24255s1gr1d wants to merge 3 commits into
s1gr1d wants to merge 3 commits into
Conversation
s1gr1d
added this pull request to stack #24251
September 9, 2026 14:36
s1gr1d
requested review from
logaretm and
stephanie-anderson
and removed request for
a team
September 9, 2026 14:36
Member
Author
|
bugbot run |
Contributor
size-limit report 📦
|
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 92e939b. Configure here.
s1gr1d
force-pushed
the
sig/db-tests-improvements-1
branch
from
September 9, 2026 15:25
92e939b to
1fe12a3
Compare
Lms24
approved these changes
Sep 9, 2026
Lms24
left a comment
Member
There was a problem hiding this comment.
SQL really is another one of those "there are 15 competing standards" XKCD situations 😅
Good change, thanks!
| if (system === 'mssql' || system === 'sqlserver' || system === 'microsoft.sql_server') { | ||
| return 'mssql'; | ||
| } | ||
| return undefined; |
Member
There was a problem hiding this comment.
l: should this return 'standard', to better match with the SqlDialect type? logaf-l, feel free to disregard!
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.
Follow-up for #24248, which left the SQL Server case open.
The sanitizer had no state for T-SQL
[bracketed]identifiers, so a quote inside one desynced it:SELECT * FROM [dbo].[user's] WHERE email = 'jane@example.com'leaked the address intodb.query.textanddb.query.summary.There is now an
mssqldialect that reads[...]as an identifier, and tedious, knex and Prisma route to it through a newtoSqlDialect()helper.Two older leaks turned up while testing it: an identifier run ending in an escaped closer (
[a]],"") was treated as closed and copied out whole, and T-SQL money literals ($1000) survived because the integer pattern protects PostgreSQL$nplaceholders.Known limit: SQLite accepts
[...]too, but shares thestandarddialect with PostgreSQL, where reading brackets as identifiers would keepARRAY['secret']raw.Sources:
N'...'): https://learn.microsoft.com/en-us/sql/t-sql/data-types/constants-transact-sql