Skip to content

Prevent SQL injection by identifiers#129

Merged
barbosa89 merged 35 commits into
mainfrom
hotfix/security-improvements
May 13, 2026
Merged

Prevent SQL injection by identifiers#129
barbosa89 merged 35 commits into
mainfrom
hotfix/security-improvements

Conversation

@barbosa89
Copy link
Copy Markdown
Contributor

No description provided.

barbosa89 and others added 30 commits April 29, 2026 15:29
Co-authored-by: Copilot <copilot@github.com>
- Refactored ClauseBuilder to improve handling of where clauses and arguments.
- Updated BuildsQuery trait to utilize AST for managing query properties.
- Modified HasJoinClause and HasLock traits to store join and lock information in the AST.
- Improved HasWhereClause and HasWhereDateClause to push where clauses directly to the AST.
- Adjusted QueryBase to reset properties and manage AST effectively.
- Updated QueryGenerator to ensure driver and action are set in the AST.
- Enhanced tests to verify correct parameter handling and AST synchronization.
- Added normalization for placeholders in Postgres dialect.
- Implemented new tests to validate the integrity of query parameters across various scenarios.

Co-authored-by: Copilot <copilot@github.com>
Co-authored-by: Copilot <copilot@github.com>
- Updated ClauseCompiler interface to separate AST setting and compilation methods.
- Modified all compiler classes (Insert, Update, Delete, Select, Exists, etc.) to utilize the new AST handling.
- Removed redundant QueryAst parameters from compile methods.
- Ensured that all compilers now access the QueryAst through a protected method.
- Added tests to verify that compiler state does not leak between compilations.
- Replaced instances of Funct::count, Funct::sum, Funct::avg, and other aggregate functions with their corresponding global functions (count_of, sum, avg) across various test files.
- Updated test cases in GroupByStatementTest, HavingClauseTest, SelectColumnsTest, and WhereClausesTest for PostgreSQL, SQLite, and other drivers to reflect the new function usage.
- Ensured consistency in the use of function names and improved readability of the test cases.
- Introduced a new SqlData class to encapsulate SQL strings and parameters.
- Updated InsertCompiler, JoinCompiler, SelectCompiler, UpdateCompiler, and WhereCompiler to return SqlData instead of CompiledClause.
- Refactored compile methods to handle parameter collection more efficiently.
- Adjusted the handling of placeholders in SQL strings across various compilers.
- Ensured that the new structure maintains compatibility with existing query generation logic.
- Updated tests to verify correct parameter ordering and SQL generation for subqueries and joins.
@sonarqubecloud
Copy link
Copy Markdown

@barbosa89 barbosa89 merged commit 64c40e3 into main May 13, 2026
3 checks passed
@barbosa89 barbosa89 deleted the hotfix/security-improvements branch May 13, 2026 14:16
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