-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
feat(database/gdb): improved automatic escaping of special characters in WhereLike method #4621
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This pull request introduces automatic escaping of special characters (backslash, percent, and underscore) in all WhereLike and WhereNotLike methods across the database ORM layer to prevent SQL injection and unintended wildcard behavior in LIKE queries.
Changes:
- Added
EscapeLikeStringfunction to escape special characters (\,%,_) in LIKE operations - Updated all WhereLike and WhereNotLike methods to automatically escape input strings
- Modified both regular Where and WhereOr variants, including their prefix versions
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| database/gdb/gdb_func.go | Added EscapeLikeString function with documentation for escaping LIKE special characters |
| database/gdb/gdb_model_builder_where.go | Updated WhereLike and WhereNotLike to use automatic escaping |
| database/gdb/gdb_model_builder_where_prefix.go | Updated WherePrefixLike and WherePrefixNotLike to use automatic escaping |
| database/gdb/gdb_model_builder_whereor.go | Updated WhereOrLike and WhereOrNotLike to use automatic escaping |
| database/gdb/gdb_model_builder_whereor_prefix.go | Updated WhereOrPrefixLike and WhereOrPrefixNotLike to use automatic escaping |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…l characters in the WhereLike method. Signed-off-by: yuluo-yx <[email protected]>
85b7593 to
921f241
Compare
Signed-off-by: yuluo-yx <[email protected]>
Signed-off-by: yuluo-yx <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Signed-off-by: yuluo-yx <[email protected]>
b773c75 to
2348697
Compare
Signed-off-by: yuluo-yx <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 7 out of 7 changed files in this pull request and generated 4 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Closes #4565