RED-9760: Do not check blacklisted keywords in Strings

This commit is contained in:
Dominique Eifländer 2024-08-13 11:11:25 +02:00
parent b4ecbde89e
commit 305cd8f5ac

View File

@ -283,7 +283,9 @@ public class DroolsValidationService {
private DroolsBlacklistErrorMessage checkAndGetBlackListedMessages(SearchImplementation blacklistedKeywordSearchImplementation, String stringToCheck, int lineIndexStart) { private DroolsBlacklistErrorMessage checkAndGetBlackListedMessages(SearchImplementation blacklistedKeywordSearchImplementation, String stringToCheck, int lineIndexStart) {
String sanitizedRuleText = StringUtils.deleteWhitespace(stringToCheck); String nonWhitespaceRuleText = StringUtils.deleteWhitespace(stringToCheck);
String sanitizedRuleText= nonWhitespaceRuleText.replaceAll("\"(\\\\.|[^\"\\\\])*\"|'(\\\\.|[^'\\\\])*'" ,"");
List<SearchImplementation.MatchPosition> matches = blacklistedKeywordSearchImplementation.getMatches(sanitizedRuleText); List<SearchImplementation.MatchPosition> matches = blacklistedKeywordSearchImplementation.getMatches(sanitizedRuleText);
if (!matches.isEmpty()) { if (!matches.isEmpty()) {