Skip to content

Commit

Permalink
Merge pull request #1478 from hugocorbucci/fix/basic_auth_error_for_r…
Browse files Browse the repository at this point in the history
…eferenced_blocks

Fix authenticate_or_request_with_http_basic check for passed blocks
  • Loading branch information
presidentbeef committed May 12, 2020
2 parents d2b1b95 + db4bb50 commit 12fadf1
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/brakeman/checks/check_basic_auth.rb
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ def check_basic_auth_request

# Check if the block of a result contains a comparison of password to string
def include_password_literal? result
return false if result[:block_args].nil?

@password_var = result[:block_args].last
@include_password = false
process result[:block]
Expand Down
10 changes: 10 additions & 0 deletions test/apps/rails3.1/app/controllers/admin_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,14 @@ def make_system_calls
def use_lambda_filter
eval @thing
end

def authenticate_token!
authenticate_token_or_basic do |username, password|
username == "foo"
end
end

def authenticate_token_or_basic(&block)
authenticate_or_request_with_http_basic(&block)
end
end

0 comments on commit 12fadf1

Please sign in to comment.