tachyons / botframework-ruby

Microsoft Bot Framework ruby client
MIT License
39 stars 16 forks source link

Shouldn't raise InvalidToken exception #36

Open davispuh opened 5 years ago

davispuh commented 5 years ago

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'
tachyons commented 5 years ago

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

davispuh commented 5 years ago

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.