Repository navigation
Conversation
|
Thanks for the request @chiliec Sorry for the late response. We will take a look |
|
@codex review |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex Review: Didn't find any major issues. 🚀 Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
|
@chiliec, hi, could you please fix the commit names? They should be a
This is required for CI checks |
…ould be == -1)
LibSqlUtils.escape() doubles single quotes for values embedded in
concatenated metadata SQL (pragma index_list/index_info/foreign_key_list
and related DatabaseMetaData queries). The early-return guard read
`indexOf('\'') == 1` instead of `== -1`, so any value whose first
single quote is at index 1 (e.g. `x'`) was returned un-escaped, letting
the quote close the surrounding string literal.
Change the guard to `== -1` (return unchanged only when no quote is
present) and add LibSqlUtilsTest#testEscape covering quotes at the start,
middle, end, and the index-1 regression case.
a268960 to
0ba33a6
Compare
|
Done — opened #68 and renamed the commit to |
Summary
LibSqlUtils.escape()doubles single quotes for values that get embedded into concatenated metadata SQL (e.g.pragma index_list('+ escape(table) +'),pragma index_info(...),pragma foreign_key_list(...), and the string-builtgetPrimaryKeys/getImportedKeys/getExportedKeysqueries inLibSqlDatabaseMetaData).The early-return guard was:
The intent is "return unchanged when there is no quote to escape", which is
indexOf(...) == -1. As written (== 1), any value whose first single quote is at index 1 — e.g.x'orx' OR '1'='1— is returned un-escaped, so the quote is not doubled and closes the surrounding SQL string literal.Fix
Change the guard to
== -1so the fast path is taken only when the value contains no single quote; otherwise every quote is doubled as intended.Behaviour
x'x'(unescaped)x''x' OR '1'='1x' OR '1'='1(unescaped)x'' OR ''1''=''1tabletabletable'ab''ab''abTests
Added
LibSqlUtilsTest#testEscapecovering quotes at the start, middle, end, and the index-1 regression case. The regression assertions fail on the previous== 1code and pass with this change.I noticed this while reading the code. The un-escaped path affects identifier values flowing into concatenated metadata queries; the one-line guard fix plus the added tests close it. Happy to adjust anything.
I'm a TS/Go/Swift/Kotlin engineer and currently open to remote contract work. If DBeaver could use an extra pair of hands, I'd be glad to talk.