Class: Brakeman::CheckSessionSettings
- Inherits:
-
BaseCheck
- Object
- SexpProcessor
- BaseCheck
- Brakeman::CheckSessionSettings
- Defined in:
- lib/brakeman/checks/check_session_settings.rb
Overview
Checks for session key length and http_only settings
Constant Summary
Constant Summary
Constants inherited from BaseCheck
Constants included from Util
Util::ALL_PARAMETERS, Util::COOKIES, Util::PARAMETERS, Util::PATH_PARAMETERS, Util::QUERY_PARAMETERS, Util::REQUEST_PARAMETERS, Util::SESSION
Instance Attribute Summary
Attributes inherited from BaseCheck
Instance Method Summary (collapse)
-
- (CheckSessionSettings) initialize(*args)
constructor
A new instance of CheckSessionSettings.
-
- (Object) process_attrasgn(exp)
Looks for ActionController::Base.session = { ... } in Rails 2.x apps.
-
- (Object) process_call(exp)
Looks for Rails3::Application.config.session_store :cookie_store, { ... } in Rails 3.x apps.
- - (Object) run_check
Methods inherited from BaseCheck
#add_result, #process_cookies, #process_default, #process_params
Methods included from Util
#array?, #call?, #camelize, #cookies?, #false?, #hash?, #hash_insert, #hash_iterate, #integer?, #number?, #params?, #pluralize, #regexp?, #result?, #set_env_defaults, #sexp?, #string?, #symbol?, #true?, #underscore
Methods included from ProcessorHelper
Constructor Details
- (CheckSessionSettings) initialize(*args)
A new instance of CheckSessionSettings
7 8 9 10 11 12 13 14 15 |
# File 'lib/brakeman/checks/check_session_settings.rb', line 7 def initialize *args super if tracker.[:rails3] @session_settings = Sexp.new(:call, Sexp.new(:colon2, Sexp.new(:const, :Rails3), :Application), :config, Sexp.new(:arglist)) else @session_settings = Sexp.new(:colon2, Sexp.new(:const, :ActionController), :Base) end end |
Instance Method Details
- (Object) process_attrasgn(exp)
Looks for ActionController::Base.session = { ... } in Rails 2.x apps
31 32 33 34 35 36 37 |
# File 'lib/brakeman/checks/check_session_settings.rb', line 31 def process_attrasgn exp if not tracker.[:rails3] and exp[1] == @session_settings and exp[2] == :session= check_for_issues exp[3][1], "#{tracker.[:app_path]}/config/initializers/session_store.rb" end exp end |
- (Object) process_call(exp)
Looks for Rails3::Application.config.session_store :cookie_store, { ... } in Rails 3.x apps
41 42 43 44 45 46 47 |
# File 'lib/brakeman/checks/check_session_settings.rb', line 41 def process_call exp if tracker.[:rails3] and exp[1] == @session_settings and exp[2] == :session_store check_for_issues exp[3][2], "#{tracker.[:app_path]}/config/initializers/session_store.rb" end exp end |
- (Object) run_check
17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/brakeman/checks/check_session_settings.rb', line 17 def run_check settings = tracker.config[:rails] and tracker.config[:rails][:action_controller] and tracker.config[:rails][:action_controller][:session] check_for_issues settings, "#{tracker.[:app_path]}/config/environment.rb" if tracker.initializers["session_store.rb"] process tracker.initializers["session_store.rb"] end end |