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

Fix issue where brakeman does not detect lockfile correctly from engines #23325

Merged
merged 1 commit into from
Feb 4, 2025
Merged
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
8 changes: 8 additions & 0 deletions lib/tasks/test_security_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,14 @@ def self.brakeman(format: "human")
puts "** engines:"
puts "** - #{engine_paths.join("\n** - ")}"

# Brakeman's Gemfile detection does not work properly with engines
# Brakeman detects the Gemfile.lock from the application root directory,
# however when running from an engine the lockfile is in the engine
# directory. So, we copy the Gemfile.lock into the application directory.
if defined?(ENGINE_ROOT)
FileUtils.cp(File.join(ENGINE_ROOT, "Gemfile.lock"), File.join(app_path, "Gemfile.lock"))
end

# See all possible options here:
# https://brakemanscanner.org/docs/brakeman_as_a_library/#using-options
options = {
Expand Down