fix(oscar): escape SQL identifiers and literals in metadata/DDL paths (#1914) - #2202
Merged
Conversation
…tainer review (OtterMind#1914) - strengthen OscarIdentifierProcessor: shared INSTANCE, escapeString with single-quote doubling, static escapeIdentifier for quoted-template content - OscarMetaData call sites use getSQLIdentifierProcessor().escapeString(...) - non-escapable validation moved to OscarSqlGuards (default expressions, length units, sort orders) - OscarSqlEscapes removed; tests migrated (15 green)
…e for DDL paths (OtterMind#1914) - quoteIdentifier(String) is conditional again: null/blank pass through, valid non-keyword identifiers return unquoted, everything else wraps with embedded-quote doubling; versioned overload delegates to it - new quoteIdentifierAlways(String) carries the old always-quote SqlEscapes semantics (null -> null, else wrap with doubling) - quoteIdentifierIgnoreCase keeps its SPI always-quote, case-preserving meaning by delegating to quoteIdentifierAlways, so DDL-generation sites (OscarUtils/builers/enums) keep emitting quoted identifiers - tests cover conditional and always behaviors incl. null passthrough (15 green)
…gex alert (OtterMind#1914) '([^']|'')*' -> '[^']*(?:''[^']*)*' (same language, no backtracking)
…eDoS) (OtterMind#1914) Regexes for quoted literals and function-call defaults are replaced by O(n) character scanners; numeric/keyword patterns (simple classes) stay.
openai0229
force-pushed
the
fix/sqli2-oscar
branch
from
July 29, 2026 12:36
79bab84 to
754564b
Compare
openai0229
approved these changes
Jul 29, 2026
openai0229
left a comment
Contributor
There was a problem hiding this comment.
Rebased on the latest main and verified Oscar identifier round trips, qualified DDL/DML quoting, structural type guards, and empty-index rejection. The clean 8-module reactor passes with Oscar 26/26, SPI 90/90, and tools 26/26.
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.
Related issue
Closes #1914
Summary
quoteIdentifierconditional while makingquoteIdentifierAlwayspreserve raw text exactly across embedded and boundary double quotes.SETandWHEREpaths.Affected surfaces
Verification
mvn -f chat2db-community-server/pom.xml -pl chat2db-community-plugins/chat2db-community-oscar -am clean test -DskipTests=false -Dmaven.test.skip=falseBUILD SUCCESS; tools 26/26, SPI 90/90, Oscar 26/26; zero failures, errors, or skipped tests in these modules.git diff --check origin/main...HEADRisk and compatibility
Reviewer map
chat2db-community-server/chat2db-community-plugins/chat2db-community-oscar/src/main/java/ai/chat2db/plugin/oscar/identifier/OscarIdentifierProcessor.java, thenOscarSqlGuards.java,enums/type/OscarColumnTypeEnum.java, andbuilder/OscarSqlBuilder.java.Contributor declaration
AI assistance: Maintainer used AI-assisted code review and test development; all resulting changes were source-reviewed and verified with the clean Maven reactor reported above.