Skip to content

fix(gel-core): escape embedded double quotes in escapeName (CVE-2026-39356) - #6026

Open
rakibulism wants to merge 1 commit into
drizzle-team:mainfrom
rakibulism:fix/gel-escape-name-sql-injection
Open

rakibulism wants to merge 1 commit into
drizzle-team:mainfrom
rakibulism:fix/gel-escape-name-sql-injection

Conversation

@rakibulism

Copy link
Copy Markdown

Summary

GHSA-gpj5-g38j-94v9 / CVE-2026-39356 was fixed for pg-core, mysql-core, sqlite-core, and singlestore-core in #5534 (released as 0.45.2), but gel-core/dialect.ts was not updated in that PR.

GelDialect.escapeName() still does:

escapeName(name: string): string {
  return `"${name}"`;
}

which does not double embedded " characters, so untrusted input passed to sql.identifier() / .as() can break out of the quoted identifier and inject arbitrary SQL — the same issue the original advisory describes, just still present in one dialect.

  • Applied the same fix pattern used for the other four dialects (name.replace(/"/g, '""')).
  • Added drizzle-orm/tests/gel-escape-name.test.ts, a regression test using the same injection payload from the original advisory's PG test. Confirmed it fails against the unpatched code and passes with the fix.
  • Ran the full drizzle-orm unit test suite (568 tests) — all passing.

Test plan

  • npx vitest run tests/gel-escape-name.test.ts passes with the fix
  • Same test fails when reverted to the vulnerable escapeName implementation (verifies the test actually catches the bug)
  • npx vitest run tests/ — 568/568 passing, no regressions

…39356)

GHSA-gpj5-g38j-94v9 was fixed for pg-core, mysql-core, sqlite-core and
singlestore-core in drizzle-team#5534 (0.45.2), but gel-core/dialect.ts was missed.
GelDialect.escapeName() still wrapped identifiers in quotes without
doubling embedded `"` characters, allowing SQL injection via
sql.identifier()/.as() when fed untrusted input.

This applies the same fix used for the other dialects and adds a
regression test using the payload from the original advisory.
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant