@@ -124,6 +124,14 @@ class RubySamlTest < Minitest::Test
124124 assert_equal response . name_id , "test@onelogin.com"
125125 end
126126
127+ it "Prevent node text with comment (VU#475445) attack" do
128+ response_doc = File . read ( File . join ( File . dirname ( __FILE__ ) , "responses" , 'response_node_text_attack.xml.base64' ) )
129+ response = OneLogin ::RubySaml ::Response . new ( response_doc )
130+
131+ assert_equal "support@onelogin.com" , response . name_id
132+ assert_equal "smith" , response . attributes [ "surname" ]
133+ end
134+
127135 it "support dynamic namespace resolution on signature elements" do
128136 response = OneLogin ::RubySaml ::Response . new ( fixture ( "no_signature_ns.xml" ) )
129137 response . stubs ( :conditions ) . returns ( nil )
@@ -335,14 +343,14 @@ class RubySamlTest < Minitest::Test
335343
336344 it "check what happens when trying retrieve attribute that does not exists" do
337345 response = OneLogin ::RubySaml ::Response . new ( fixture ( :response_with_multiple_attribute_values ) )
338- assert_equal nil , response . attributes [ :attribute_not_exists ]
339- assert_equal nil , response . attributes . single ( :attribute_not_exists )
340- assert_equal nil , response . attributes . multi ( :attribute_not_exists )
346+ assert_nil response . attributes [ :attribute_not_exists ]
347+ assert_nil response . attributes . single ( :attribute_not_exists )
348+ assert_nil response . attributes . multi ( :attribute_not_exists )
341349
342350 OneLogin ::RubySaml ::Attributes . single_value_compatibility = false
343- assert_equal nil , response . attributes [ :attribute_not_exists ]
344- assert_equal nil , response . attributes . single ( :attribute_not_exists )
345- assert_equal nil , response . attributes . multi ( :attribute_not_exists )
351+ assert_nil response . attributes [ :attribute_not_exists ]
352+ assert_nil response . attributes . single ( :attribute_not_exists )
353+ assert_nil response . attributes . multi ( :attribute_not_exists )
346354 OneLogin ::RubySaml ::Attributes . single_value_compatibility = true
347355 end
348356
@@ -383,7 +391,7 @@ class RubySamlTest < Minitest::Test
383391 malicious_response_document = fixture ( 'response_eval' , false )
384392 response = OneLogin ::RubySaml ::Response . new ( malicious_response_document )
385393 response . send ( :xpath_first_from_signed_assertion )
386- assert_equal ( $evalled, nil )
394+ assert_nil $evalled
387395 end
388396 end
389397
0 commit comments