mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-12-25 04:02:46 +01:00
ChannelIdDatabasePlugin: limit --regexp to trusted users
Overcomplicated regexps can freeze the bot, an issue which is amplified as a database (e.g. for quotes) grows. Closes #855.
This commit is contained in:
parent
0e1e37a5a2
commit
5ee15c38bb
@ -406,6 +406,12 @@ class ChannelIdDatabasePlugin(callbacks.Plugin):
|
||||
if opt == 'by':
|
||||
predicates.append(lambda r, arg=arg: r.by == arg.id)
|
||||
elif opt == 'regexp':
|
||||
if not ircdb.checkCapability(msg.prefix, 'trusted'):
|
||||
# Limited --regexp to trusted users, because specially
|
||||
# crafted regexps can freeze the bot. See
|
||||
# https://github.com/ProgVal/Limnoria/issues/855 for details
|
||||
irc.errorNoCapability('trusted')
|
||||
|
||||
predicates.append(lambda r: regexp_wrapper(r.text, reobj=arg,
|
||||
timeout=0.1, plugin_name=self.name(), fcn_name='search'))
|
||||
if glob:
|
||||
|
Loading…
Reference in New Issue
Block a user