From 6cf365c49ce5fbe24c0a4ff0663550390b501fea Mon Sep 17 00:00:00 2001 From: Matthias Hecker Date: Sat, 28 Mar 2020 03:04:19 +0100 Subject: plugin(script): remove deprecated $SAFE closes #32 --- data/rbot/plugins/script.rb | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) (limited to 'data/rbot/plugins/script.rb') diff --git a/data/rbot/plugins/script.rb b/data/rbot/plugins/script.rb index ccdf037d..11aed396 100644 --- a/data/rbot/plugins/script.rb +++ b/data/rbot/plugins/script.rb @@ -17,10 +17,6 @@ define_structure :Command, :code, :nick, :created, :channel class ScriptPlugin < Plugin - Config.register Config::IntegerValue.new('script.safe', - :default => 3, - :desc => 'configure $SAFE level for scripts (3=safe/tainted, 0=unsafe/ruby default)') - def initialize super if @registry.has_key?(:commands) @@ -64,7 +60,7 @@ class ScriptPlugin < Plugin auth_path = "script::run::#{name}".intern return unless @bot.auth.allow?(auth_path, m.source, m.replyto) - code = @commands[name].code.dup.untaint + code = @commands[name].code.dup # Convenience variables, can be accessed by scripts: args = m.message.split @@ -72,8 +68,6 @@ class ScriptPlugin < Plugin user = args.empty? ? m.sourcenick : args.first Thread.start { - $SAFE = @bot.config['script.safe'] - begin eval( code ) rescue Exception => e @@ -106,10 +100,8 @@ class ScriptPlugin < Plugin def handle_eval( m, params ) - code = params[:code].to_s.dup.untaint + code = params[:code].to_s.dup Thread.start { - $SAFE = @bot.config['script.safe'] - begin eval( code ) rescue Exception => e @@ -121,10 +113,8 @@ class ScriptPlugin < Plugin def handle_echo( m, params ) - code = params[:code].to_s.dup.untaint + code = params[:code].to_s.dup Thread.start { - $SAFE = @bot.config['script.safe'] - begin m.reply eval( code ).to_s rescue Exception => e @@ -205,6 +195,7 @@ plugin = ScriptPlugin.new plugin.default_auth( 'edit', false ) plugin.default_auth( 'eval', false ) plugin.default_auth( 'echo', false ) +plugin.default_auth( 'show', false ) plugin.default_auth( 'run', true ) plugin.map 'script add -f :name *code', :action => 'handle_add_force', :auth_path => 'edit' -- cgit v1.2.3