lib/contrast/utils/class_util.rb in contrast-agent-4.3.2 vs lib/contrast/utils/class_util.rb in contrast-agent-4.4.0
- old
+ new
@@ -50,20 +50,22 @@
end
# Return a String representing the object invoking this method in the
# form expected by our dataflow events.
#
- # @param object [Object] the entity to convert to a String
+ # @param object [Object, nil] the entity to convert to a String
# @return [String] the human readable form of the String, as defined by
# https://bitbucket.org/contrastsecurity/assess-specifications/src/master/vulnerability/capture-snapshot.md
def to_contrast_string object
# Only treat object like a string if it actually is a string
# some subclasses of String override string methods we depend on
if object.cs__class == String
cached = to_cached_string(object)
return cached if cached
object.dup
+ elsif object.nil?
+ Contrast::Utils::ObjectShare::NIL_STRING
elsif object.cs__is_a?(Symbol)
":#{ object }"
elsif object.cs__is_a?(Numeric)
object.to_s
elsif object.cs__is_a?(Module) || object.cs__is_a?(Class)