fix: reject profanity matches inside hex/UUID tokens (#23) - #40
Conversation
UUIDs like `6ec3e80f-...-144a2ef5800b` were flagged because `800b` mapped to `boob` via character substitutions. Add an `isInsideHexToken` guard that skips matches embedded in UUIDs, MD5/SHA hashes, and other long hex strings while leaving normal profanity detection intact. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
📝 WalkthroughWalkthroughAdds a pre-filter in profanity detection to skip matches that occur inside UUIDs or hex-like tokens, implemented via a new private method isInsideHexToken() in BlaspService and covered by new unit tests for UUID/hex edge cases. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@tests/UuidFalsePositiveTest.php`:
- Around line 46-59: Update the two tests so the inputs actually place the
profanity as a substring of the hex-like tokens described: in
test_short_hex_does_not_suppress_profanity call Blasp::check with a short
hex-like token containing "ass" (e.g. "abass" or "abcass12" — any token shorter
than the long-hex guard threshold) and assert hasProfanity() is true; in
test_pure_letter_hex_does_not_suppress_profanity call Blasp::check with a
pure-letter hex token containing "boob" (e.g. "deadbeefboob" or "boobdeadbeef")
and assert hasProfanity() is true so the tests exercise the intended guard
behavior.
Use actual hex-like inputs (800b, deadbeef) instead of plain profanity strings so the tests exercise the guard behavior they describe. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Summary
isInsideHexToken()guard inBlaspService::handle()that skips profanity matches found inside UUIDs, MD5/SHA hashes, and other long hex strings6ec3e80f-11ad-3d5c-809f-144a2ef5800bwas flagged because800bmapped toboobvia character substitutionsTest plan
boob,ass,shit) still detected🤖 Generated with Claude Code
Summary by CodeRabbit
Bug Fixes
Tests
✏️ Tip: You can customize this high-level summary in your review settings.