feat(database/gdb): improved automatic escaping of special characters in WhereLike method#4621
feat(database/gdb): improved automatic escaping of special characters in WhereLike method#4621yuluo-yx wants to merge 9 commits intogogf:masterfrom
Conversation
There was a problem hiding this comment.
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 <yuluo08290126@gmail.com>
85b7593 to
921f241
Compare
There was a problem hiding this comment.
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 <yuluo08290126@gmail.com>
b773c75 to
2348697
Compare
Signed-off-by: yuluo-yx <yuluo08290126@gmail.com>
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 7 out of 7 changed files in this pull request and generated 7 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
@gqcn any ideas? |
Closes #4565