botframework-ruby
botframework-ruby copied to clipboard
Shouldn't raise InvalidToken exception
Currently lib/bot_framework/server.rb raises InvalidToken exception, but it shouldn't because it's perfectly fine to receive invalid requests and should just log and ignore them. Otherwise currently I get a lot of spam like this from exploit scanners...
2019-01-29 07:15:21 +0200: Rack app error handling request { POST /vendor/phpunit/phpunit/src/Util/PHP/eval-stdin.php }
#<BotFramework::InvalidToken: BotFramework::InvalidToken>
vendor/bundle/ruby/2.3.0/bundler/gems/botframework-ruby/lib/bot_framework/server.rb:14:in `call'
vendor/bundle/ruby/2.3.0/bundler/gems/botframework-ruby/lib/bot_framework/server.rb:4:in `call'
vendor/bundle/ruby/2.3.0/gems/puma-3.11.3/lib/puma/configuration.rb:225:in `call'
vendor/bundle/ruby/2.3.0/gems/puma-3.11.3/lib/puma/server.rb:624:in `handle_request'
vendor/bundle/ruby/2.3.0/gems/puma-3.11.3/lib/puma/server.rb:438:in `process_client'
vendor/bundle/ruby/2.3.0/gems/puma-3.11.3/lib/puma/server.rb:302:in `block in run'
vendor/bundle/ruby/2.3.0/gems/puma-3.11.3/lib/puma/thread_pool.rb:120:in `block in spawn_thread'
WDYT about making this configurable
BotFramework.configure do |config|
config.app_id = ENV['MICROSOFT_APP_ID']
config.app_secret = ENV['MICROSOFT_APP_SECRET']
config.raise_exceptions = false
end
Something like this
Looks good :+1: , but it would be even better if could set a Logger instance there and it would log this as debug level and BotFramework could use that logging in other places too.