Skip to content

Commit

Permalink
Move code around
Browse files Browse the repository at this point in the history
  • Loading branch information
presidentbeef committed Nov 10, 2022
1 parent 69aec85 commit 4f4c9c0
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions lib/brakeman/checks/check_weak_rsa_key.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ class Brakeman::CheckWeakRSAKey < Brakeman::BaseCheck
@description = "Checks for weak uses RSA keys"

def run_check
check_rsa_key_creation
check_rsa_operations
end

def check_rsa_key_creation
tracker.find_call(targets: [:'OpenSSL::PKey::RSA'], method: [:new, :generate], nested: true).each do |result|
key_size_arg = result[:call].first_arg
check_key_size(result, key_size_arg)
Expand All @@ -23,7 +28,9 @@ def run_check
check_key_size(result, key_size_arg)
end
end
end

def check_rsa_operations
tracker.find_call(targets: [:'OpenSSL::PKey::RSA.new'], methods: [:public_encrypt, :public_decrypt, :private_encrypt, :private_decrypt], nested: true).each do |result|
padding_arg = result[:call].second_arg
check_padding(result, padding_arg)
Expand Down

0 comments on commit 4f4c9c0

Please # to comment.