-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
### TL;DR Implemented query validation to enhance security and prevent potential SQL injection attacks. ### What changed? - Added a `ValidateQuery` function in `utils.go` to check for disallowed patterns and ensure only allowed functions are used in queries. - Integrated query validation in the `ClickHouseConnector` methods for executing queries. - Updated error handling in `logs_handlers.go` and `transactions_handlers.go` to potentially use `BadRequestError` for disallowed functions. ### How to test? 1. Try running queries with allowed functions (e.g., `sum`, `count`, `reinterpretAsUInt256`) and ensure they work as expected. 2. Attempt to use disallowed patterns or functions in queries and verify that they are rejected with appropriate error messages. 3. Test different types of queries (SELECT, INSERT, UPDATE, etc.) to confirm that only SELECT queries are allowed. ### Why make this change? This change enhances the security of the application by preventing potential SQL injection attacks and restricting the use of potentially harmful functions or query patterns. It ensures that only safe, pre-approved functions can be used in queries, reducing the risk of unauthorized data access or manipulation.
- Loading branch information
Showing
4 changed files
with
66 additions
and
1 deletion.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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