Repository navigation
Conversation
The audit list, summary and export pass the search box value to a LIKE pattern across operator, resource_name and detail without escaping. Searching for % matches every row; underscores in resource names act as single-character wildcards. Add a shared SqlLikeUtil and apply an explicit ESCAPE clause so the pattern is literal on both MySQL and H2. Fixes apache#4289
7 tasks done
Contributor
Author
|
Closing in favour of #4458, which covers the audit LIKE escape as part of the full Studio search domain (auth, ACL, alert, audit, instance, credentials) and adds the explicit ESCAPE CHAR(92) clause this PR did not. Keeping both open only splits review. |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Which Issue(s) This PR Fixes
Brief Description
GET /api/audit/logs,GET /api/audit/summaryand the export path pass the search box value to a SQLLIKEacrossoperator,resource_nameanddetailwithout escaping.%and_therefore keep their wildcard meaning:search=%matches every audit rowsearch=_matches every non-empty value_matches unintended rowsAdd a shared
SqlLikeUtil(escape + explicitESCAPE '\\'clause, H2-compatible) and use it inMybatisPlusAuditRepository.applyFilters, the single filter builder shared by the paged list, summary and export.How Did You Test This Change?
New tests:
SqlLikeUtilTestpins escape order and the explicit ESCAPE clausefindPageShouldEscapeLikeWildcardsInSearchTestasserts the bound pattern is%100\%\_done%summarizeShouldEscapeLikeWildcardsInSearchTestasserts the summary path uses the same escaped patternChecklist
fix:)...Test