SafeGuardAdvisor matches sensitive words as substrings; add opt-in whole-word matching
Current Behavior
SafeGuardAdvisor.containsSensitiveWord lower-cases the whole prompt and uses String.contains for each configured word. It is a plain substring match, so a word blocks any longer word that contains it. For example a list containing ass, key or kill blocks class, keyboard and skills, and the user just gets the failure response with no way to opt out.
Expected Behavior
Keep today's behavior as the default, and add an opt-in whole-word mode, for example SafeGuardAdvisor.builder().sensitiveWords(...).wholeWordMatch(true), which matches on word boundaries (\b plus Pattern.quote, case-insensitive). This is non-breaking and small, and it gives users a way out of substring false positives without writing their own advisor.
I searched existing SafeGuardAdvisor and guardrail issues (#4089, #3586, #1081, #3418, #5615, #5717) and none cover matching semantics. If the maintainers agree, I will open a PR with tests in SafeGuardAdvisorTests.
Source: spring-projects/spring-ai