Skip to content

Commit

Permalink
Merge pull request #1019 from presidentbeef/avoid_recursive_concerns
Browse files Browse the repository at this point in the history
Avoid recursive concerns
  • Loading branch information
presidentbeef committed Mar 22, 2017
2 parents 28caf38 + 73dc2c1 commit b88c8cb
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/brakeman/processors/controller_processor.rb
Expand Up @@ -16,6 +16,7 @@ def initialize app_tree, tracker
@current_module = nil
@visibility = :public
@file_name = nil
@concerns = Set.new
end

#Use this method to process a Controller
Expand Down Expand Up @@ -65,7 +66,8 @@ def process_concern concern_name
return unless @current_class

if mod = @tracker.find_class(concern_name)
if mod.options[:included]
if mod.options[:included] and not @concerns.include? concern_name
@concerns << concern_name
process mod.options[:included].deep_clone
end
end
Expand Down
7 changes: 7 additions & 0 deletions test/apps/rails5/app/controllers/concerns/concerning.rb
@@ -0,0 +1,7 @@
module Concerning
extend ActiveSupport::Concern

included do
include Concerning
end
end
1 change: 1 addition & 0 deletions test/apps/rails5/app/controllers/mixed_controller.rb
@@ -1,4 +1,5 @@
class BaseController < ActionController::Base
# No protect_from_forgery call, but one mixed in
include ForgeryProtection
include Concerning
end

0 comments on commit b88c8cb

Please sign in to comment.