Check if an object is considered tainted by using the tainted? method: : tainted « Class « Ruby






Check if an object is considered tainted by using the tainted? method:


x = "Hello, world!"
puts x.tainted?

y = [x, x, x]
puts y.tainted?

z = 20 + 50
puts z.tainted?

a = File.open("somefile").readlines.first
puts a.tainted?

b = ENV["PATH"]
puts b.tainted?

c = [a, b]
puts c.tainted?

 








Related examples in the same category

1.Force an object to be seen as untainted by calling the untaint method on the object.
2.Tell if a certain operation is safe: