
Security News
Follow-up and Clarification on Recent Malicious Ruby Gems Campaign
A clarification on our recent research investigating 60 malicious Ruby gems.
Add this line to your application's Gemfile:
gem 'jarvis-cli', require: 'jarvis'
And then execute:
$ bundle
Or install it yourself as:
$ gem install jarvis-cli
Jarvis is an application framework for building Chat bots to integrate with your Slack chat room. It ships with a number of useful and funny built-in services, but it also provides and easy DSL for creating your own services.
Creating a chatbot is as easy as:
$ jarvis new my-bot
/bot/server.rb
is the main brain of your Jarvis bot. Here you can register which services you want to be available on your chatbot.
class Server < Jarvis::Server
register_services :tweet_that, :img_flip, :urban_dictionary, :weather
end
These are the services that will be enabled when Jarvis interprets a message from Slack.
If a Service integrates with an authenticated, third party API, you may need to set up environment variables for API Tokens, Secrets, Usernames and Passwords, etc. To ensure that services are not run in environments that aren't set up to support them, services can require certain variables be set up.
class MyService < Jarvis::Service
environment :service_token, :service_secret
end
If a service is Registered in app/server.rb
but does not have it's expected environment, Jarvis will throw an exception and respond with a polite refusal to execute the service. This message can be set in your Jarvis configuration. The enviornment method will also create a getter method for each environment variable.
There are two ways to tell Jarvis to send a given message to a particular service.interpreter_pattern
and phrases
class ImgFlip < Jarvis::Service
phrases "success kid", "overly attached girlfriend"
# will converted to a pattern that looks like /success kid|overly attached girlfriend/i
end
class SortingHat < Jarvis::Service
interpreter_pattern /sorting hat|where do I belong/i
end
Setting interpreter pattern directly will take precendence over phrases if you include both.
Services should expose a run
method. This method will perform whatever actions necessary to fulfill the service and should ultimately return the string that Jarvis will send back to the channel in slack.
A very simple service might look like:
class SortingHat < Jarvis::Service
def run
[
"Gryphondor, where dwell the brave of heart!",
"Slytherine, because you are kind of a jerk"
].sample
end
end
If you want to use a more semantic name for your service, you can override the method using invoke_with
class IJustMetYou < Jarvis::Service
invoke_with :call_me_maybe
def call_me_maybe
"This is crazy, but here's my number, so call me maybe"
end
end
You can do actions before or after the service is run, but before Jarvis responds. For instance:
class Joke < Jarvis::Service
before_invoke :setup
invoke_with :punch
def setup
Slack::Post.new(channel_id, "What do you call a fish with no eyes?").send_message
sleep 1
end
def punch
"A FSH!"
end
end
When these things are done, we'll be ready for 1.0
✓ Finish Porting The Services from the original bot to the framework
☐ Ability for Jarvis to Post Back into the Slack Chatroom
☐ Jarvis::Schedule
☐ Add Test Framework to the Project Generator
✓ Service Generator
✓ Configure All The Things
✓ Boot Process for the Generated App
git checkout -b my-new-feature
)git commit -am 'Add some feature'
)git push origin my-new-feature
)FAQs
Unknown package
We found that jarvis-cli demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
A clarification on our recent research investigating 60 malicious Ruby gems.
Security News
ESLint now supports parallel linting with a new --concurrency flag, delivering major speed gains and closing a 10-year-old feature request.
Research
/Security News
A malicious Go module posing as an SSH brute forcer exfiltrates stolen credentials to a Telegram bot controlled by a Russian-speaking threat actor.