BotServ BADWORDS: user-configurable regex kicker
BADWORDS <#channel> ADD|DEL|LIST|CLEAR manages a channel's badword patterns, each a regular expression, so a channel matches whatever it wants — an improvement over Anope's fixed ANY/SINGLE/START/END. Enable with KICK <#channel> BADWORDS ON. Uses the regex crate: it's finite-automata based with linear-time matching, so untrusted user patterns can't cause catastrophic backtracking (ReDoS). A channel's patterns compile into one RegexSet (single-pass match against all of them), cached in the engine and rebuilt only when the list's revision changes — so the hot path is one is_match call, no per-message compilation or allocation. Patterns are validated (and size-limited) at add time; matching is case-insensitive by default.
This commit is contained in:
parent
43def8ee23
commit
ca95184359
9 changed files with 238 additions and 7 deletions
|
|
@ -25,6 +25,7 @@ sha2 = "0.10"
|
|||
hmac = "0.12"
|
||||
pbkdf2 = { version = "0.12", default-features = false, features = ["hmac"] }
|
||||
subtle = "2"
|
||||
regex = "1"
|
||||
anyhow = "1"
|
||||
tracing = "0.1"
|
||||
tracing-subscriber = { version = "0.3", features = ["env-filter"] }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue