Skip to content

fix(plugins): view quoting, SQL injection, pagination, and misc SQL fixes#1926

Open
HandSonic wants to merge 6 commits into
OtterMind:mainfrom
HandSonic:fix/sql-plugins
Open

fix(plugins): view quoting, SQL injection, pagination, and misc SQL fixes#1926
HandSonic wants to merge 6 commits into
OtterMind:mainfrom
HandSonic:fix/sql-plugins

Conversation

@HandSonic

Copy link
Copy Markdown
Contributor

Summary

Fixes 6 verified bugs across PostgreSQL, SQL Server, and Oracle database plugins.

Fixes included:

  • PostgreSQL view quoting: backticks → double quotes (PG syntax)
  • PostgreSQL view comment: added DOT separator between schema and view name
  • SQL Server view quoting: backticks → square brackets (SQL Server syntax)
  • Oracle view comment: added DOT separator between schema and view name
  • Oracle SQL injection: escapes single quotes in table name via replace("'", "''")
  • Oracle pagination: always applies outer SELECT wrapper to prevent CAHT2DB_AUTO_ROW_ID column leak on first page
  • SQL Server misc: fixes TIMESTAMP dead code (Arrays.asList()Arrays.asList("TIMESTAMP")), GO separator trailing newline, rename script bracket quoting

…ent SQL

- View name was quoted with backticks (MySQL syntax) instead of double quotes
- Comment SQL was missing DOT separator between schema and view name,
  producing "schema""view" instead of "schema"."view"
View name was quoted with backticks (MySQL syntax) instead of square
brackets (SQL Server syntax).
View comment SQL was missing DOT between schema and view name identifiers,
producing "SCOTT""MY_VIEW" instead of "SCOTT"."MY_VIEW".
tableName was concatenated directly into SQL without escaping. Table names
containing single quotes (e.g. O'Brien) would break SQL syntax or allow
injection. Now escapes single quotes with replace("'", "''").
When offset==0 (first page), the outer SELECT * FROM (...) wrapper was
skipped, leaking CAHT2DB_AUTO_ROW_ID into the result set. Now both
wrappers are always applied for consistent column schema across pages.
- Arrays.asList() was empty, making TIMESTAMP precision block dead code.
  Now uses Arrays.asList('TIMESTAMP') to enable the code path.
- RENAME_COLUMN_SCRIPT parameters now use square bracket quoting for
  names with spaces or reserved words.
- COLUMN_MODIFY_COMMENT_SCRIPT now ends with 'go\n' (with trailing
  newline) so the batch separator is recognized when concatenated.
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