lib/contrast/agent/assess/rule/provider/hardcoded_key.rb in contrast-agent-4.6.0 vs lib/contrast/agent/assess/rule/provider/hardcoded_key.rb in contrast-agent-4.7.0

- old
+ new

@@ -53,13 +53,16 @@ # That array seems to always end in a nil value, so we allow # those as well. value_node.children.each do |child| next unless child - return false unless child.cs__is_a?(RubyVM::AbstractSyntaxTree::Node) && - child.type == :LIT && - child.children[0]&.cs__is_a?(Integer) + unless child.cs__is_a?(RubyVM::AbstractSyntaxTree::Node) && + child.type == :LIT && + child.children[0]&.cs__is_a?(Integer) + + return false + end end true end @@ -82,11 +85,14 @@ children = value_node.children return false unless children return false unless children.length >= 2 potential_string_node = children[0] - return false unless potential_string_node.cs__is_a?(RubyVM::AbstractSyntaxTree::Node) && - potential_string_node.type == :STR + unless potential_string_node.cs__is_a?(RubyVM::AbstractSyntaxTree::Node) && + potential_string_node.type == :STR + + return false + end children[1] == :bytes end # TODO: RUBY-1014 remove `#value_type_passes?` and `#value_passes?`