Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Brakeman #16

Merged
merged 2 commits into from
Jan 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,24 @@ on:
branches: [main]

jobs:
scan_ruby:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: .ruby-version
bundler-cache: true

- name: Scan for security vulnerabilities in Ruby Dependencies
run: |
gem install error_highlight -v 0.5.1
bin/brakeman

lint:
runs-on: ubuntu-latest
steps:
Expand Down
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ group :development do
gem "error_highlight", ">= 0.4.0", platforms: [ :ruby ]

gem "rubocop-rails-omakase", require: false
gem "brakeman"
end

group :test do
Expand Down
3 changes: 3 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,8 @@ GEM
bindex (0.8.1)
bootsnap (1.17.0)
msgpack (~> 1.2)
brakeman (6.1.1)
racc
builder (3.2.4)
capybara (3.39.2)
addressable
Expand Down Expand Up @@ -375,6 +377,7 @@ PLATFORMS

DEPENDENCIES
bootsnap
brakeman
capybara
debug
error_highlight (>= 0.4.0)
Expand Down
8 changes: 6 additions & 2 deletions app/views/gemfiles/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,15 @@
<%= content_for?(:header_title) ? (yield(:header_title)).html_safe : "Gemfile" %>
</h1>
<% if @gemfile.app_link.present? %>
<%= link_to '<i class="text-xl text-white fa-solid fa-link hover:text-amber-300"></i>'.html_safe, @gemfile.app_link %>
<%= link_to "#{@gemfile.app_link}" do %>
<i class="text-xl text-white fa-solid fa-link hover:text-amber-300"></i>
<% end %>
<% end %>

<% if @gemfile.github_link.present? %>
<%= link_to '<i class="text-xl text-white fa-brands fa-github hover:text-amber-300"></i>'.html_safe, @gemfile.github_link %>
<%= link_to "#{@gemfile.github_link}" do %>
<i class="text-xl text-white fa-brands fa-github hover:text-amber-300"></i>
<% end %>
<% end %>
</div>
<div class="flex items-center text-sm text-white">
Expand Down
27 changes: 27 additions & 0 deletions bin/brakeman
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/usr/bin/env ruby
# frozen_string_literal: true

#
# This file was generated by Bundler.
#
# The application 'brakeman' is installed as part of a gem, and
# this file is here to facilitate running it.
#

ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__)

bundle_binstub = File.expand_path("bundle", __dir__)

if File.file?(bundle_binstub)
if File.read(bundle_binstub, 300).include?("This file was generated by Bundler")
load(bundle_binstub)
else
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
end
end

require "rubygems"
require "bundler/setup"

load Gem.bin_path("brakeman", "brakeman")