Class: Spektr::Checks::BasicAuth
- Defined in:
- lib/spektr/checks/basic_auth.rb
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
- #check_filter ⇒ Object
-
#initialize(app, target) ⇒ BasicAuth
constructor
A new instance of BasicAuth.
- #run ⇒ Object
Methods inherited from Base
#app_version_between?, #dupe?, #model_attribute?, #should_run?, #target_affected?, #user_input?, #version_affected, #version_between?, #warn!
Constructor Details
#initialize(app, target) ⇒ BasicAuth
Returns a new instance of BasicAuth.
5 6 7 8 9 10 |
# File 'lib/spektr/checks/basic_auth.rb', line 5 def initialize(app, target) super @name = "Basic Authentication" @type = "Password Plaintext Storage" @targets = ["Spektr::Targets::Controller"] end |
Instance Method Details
#check_filter ⇒ Object
17 18 19 20 21 22 23 24 |
# File 'lib/spektr/checks/basic_auth.rb', line 17 def check_filter calls = @target.find_calls(:http_basic_authenticate_with) calls.each do |call| if call.[:password] && call.[:password].value_type == :str warn! @target, self, call.location, "Basic authentication password stored in source code" end end end |
#run ⇒ Object
12 13 14 15 |
# File 'lib/spektr/checks/basic_auth.rb', line 12 def run return unless super check_filter end |