Today we are going to talk about some cool tools that help keep Ruby systems safe from bad guys. Let’s focus on Brakeman, and compare it to a couple of others.
Brakeman is like a highly intelligent detective for your Ruby on Rails code. Monitors your program and tries to spot any security issues before they become a real problem. It’s like a friend checking your homework for mistakes before handing it in. For more information, visit https://github.com/presidentbeef/brakeman
Brakeman reads your code and looks for potentially dangerous patterns. For example, if you accidentally left a "back door" that allows hackers to enter, Brakeman will notice and let you know. It’s really quick and allows you to review an entire project in just seconds!
There are other tools that work the same way. Let’s take a look at two of them:
Grype https://github.com/anchore/grype
Bundler Audit https://github.com/rubysec/bundler-audit
How are they different?
Brakeman is great because:
Add Brakeman to your project:
gem install brakeman
For rbenv users, refresh the environment:
rm -rf ~/.rbenv/shims && rbenv rehash
Generate a security report:
brakeman -o brakeman_report.html
This will create an HTML file with the scan results.
Remember, no tool is perfect, but using Brakeman along with others like Grype and Bundler Audit can make your Ruby projects much safer.