Class: Brakeman::CheckSessionManipulation

Inherits:
BaseCheck
  • Object
show all
Defined in:
lib/brakeman/checks/check_session_manipulation.rb

Instance Method Summary collapse

Instance Method Details

#process_result(result) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/brakeman/checks/check_session_manipulation.rb', line 14

def process_result result
  return unless original? result

  index = result[:call].first_arg

  if input = has_immediate_user_input?(index)
    if params? index
      confidence = :high
    else
      confidence = :medium
    end

    warn :result => result,
      :warning_type => "Session Manipulation",
      :warning_code => :session_key_manipulation,
      :message => msg(msg_input(input), " used as key in session hash"),
      :user_input => input,
      :confidence => confidence,
      :cwe_id => [20] # TODO: what cwe should this be? it seems like it's looking for authz bypass
  end
end

#run_checkObject



8
9
10
11
12
# File 'lib/brakeman/checks/check_session_manipulation.rb', line 8

def run_check
  tracker.find_call(:method => :[]=, :target => :session).each do |result|
    process_result result
  end
end