Skip to content

v4.4.0

Choose a tag to compare

@deemonic deemonic released this 03 Nov 13:06
· 17 commits to main since this release
240315d

Far fewer false positives, nested middleware input, documented config keys that now work, and loud failures instead of silently filtering nothing. This release changes what gets flagged: see Upgrading to 4.4 before updating. (#58)

On a corpus of 67 clean sentences built from reported cases, 37 were flagged on v4.3.2 and 3 are now.

Breaking / behaviour changes

  • Unknown languages throw UnknownLanguageException. Blasp::in('englsh') or a misspelt BLASP_LANGUAGE used to flag nothing. Names are now case-insensitive.
  • blasp.severity and blasp.false_positives are applied. Both were documented but ignored.
    • severity sets the default minimum; the default, mild, changes nothing. An invalid value throws.
    • false_positives (and configure()'s) now apply to every language.
  • Middleware:
    • Nested and array input is checked and sanitized by dotted path (comment.body, tags.0), and every offending field is reported.
    • JSON requests get the same 422 as before; form posts are redirected back with validation errors.
    • Password fields are never checked.
    • An invalid action or severity throws.
  • Base words are lowercase in uniqueWords() / MatchedWord::$base.
  • Laravel 10 or later is required. The validation rule never worked on 8 or 9.

Fewer false positives

  • Contractions: "Let's hit", "it's hitting", "he'll", "she'll", "can't". Obfuscations like "cun't" are still caught.
  • Word pairs that spell a list word: "a hole", "dam nation", "money shot". Add your own multi-word false_positives.
  • Runs of *: ***** ratings, ******** passwords, **bold**, *italic*. "f***" and "f*ck" still match.
  • Stretched words: "Hellllo", "classsy". "crapped" is reported as crap, not raped.
  • Phonetic driver (also in the default pipeline): ordinary prose went from 35 and 22 flagged words to 0 and 4, and sound-alike evasions like "phuck" and "phag" are still caught.
  • Word lists:
    • The French list drops about 1,250 ordinary words ("information", "email", "page", "famille", "sein", "derrière"…) and keeps its 238 real slang words and insults.
    • German "zu"/"breit", Spanish "perro", and four English entries are removed.

Fixes

  • Capitalised list entries ("Fukah") missed spellings like "FFuukkaahh".
  • Allowed words were still flagged by the phonetic driver as sound-alikes.

New

  • max_length (BLASP_MAX_LENGTH, off by default): the middleware and validation rule reject longer text instead of checking it. There's also Profanity::maxLength(n).

Compatibility

  • illuminate/support ^10–^13.
  • CI now tests Laravel 10 (PHP 8.2), 11 (8.3), 12 (8.2, 8.4) and 13 (8.3, 8.4).