From 4f4c9c07a449a4857e0093d86a630be9c06aed74 Mon Sep 17 00:00:00 2001 From: Justin Collins Date: Thu, 10 Nov 2022 09:22:09 -0800 Subject: [PATCH] Move code around --- lib/brakeman/checks/check_weak_rsa_key.rb | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/brakeman/checks/check_weak_rsa_key.rb b/lib/brakeman/checks/check_weak_rsa_key.rb index bbeb38a564..dec91cfc28 100644 --- a/lib/brakeman/checks/check_weak_rsa_key.rb +++ b/lib/brakeman/checks/check_weak_rsa_key.rb @@ -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) @@ -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)