Skip to content

v4.3.2

Choose a tag to compare

@deemonic deemonic released this 03 Nov 12:20
· 28 commits to main since this release
3acd2cf

A hardening release from a full review of v4.3.1. Everything here stops input from tying up a worker, fixes output that was wrong, or speeds checks up. Results for normal text are unchanged: a differential run of 3,337 texts against v4.3.1 found no new and no lost detections. No API changes. (#57)

Security

  • Crafted input could stall a worker. A few KB of text like aaaa…, !!!!… or o*o*… made checks take seconds to minutes. This was reachable through the middleware, the validation rule and Blaspable. Checks now scale linearly: 2 KB of a went from 10.5 s to 31 ms.
  • Fail-open on PCRE errors. When PCRE gave up on a long text, it passed as clean; for example, '!' x 2000 . ' you lickme' was not flagged. The text is now rescanned in windows instead.
  • An empty block-list word hung forever. This includes block(''), or explode(',', env(...)) returning ['']. Blank words are now ignored.
  • Invalid UTF-8 crashed the pipeline driver (a 500 through the middleware) and stopped invisible characters being stripped.

Bug Fixes

  • Repeated accented words are masked correctly: "fück fück" was "**** f***". Later words are no longer missed either.
  • Accented matches no longer spill into the next word: "fück and shit" was "******nd ****".
  • Pattern driver positions are correct for text whose lowercase changes length (İ).
  • Result cache:
    • It now respects config changes, language-file edits and package upgrades. Changing allow/block lists, mask, language, separators, substitutions or driver config previously served stale results for up to 24 h.
    • blasp:clear now clears every cached result.
  • ProfanityDetected now fires on cached checks too.
  • Blaspable:
    • Encrypted attributes are checked as plain text, not ciphertext.
    • array/json attributes are no longer corrupted on save.
  • Testing helpers:
    • Blasp::withoutFiltering() turns filtering back on afterwards.
    • Routes using the blasp middleware work after Blasp::fake().
  • strict() now forces the regex driver, as documented.
  • Profanity::in(), ::maxScore() and ::severity() work statically, as documented, and still chain on an instance.

Performance

  • Short checks: about 1 ms instead of about 15 ms.
  • inAllLanguages(): about 22 ms instead of about 140 ms.
  • Long or dense text: 64 KB of dense profanity takes 0.55 s instead of about 8 s.

Tip: cap input length before checking, e.g. ['bail', 'string', 'max:5000', Profanity::in('english')].