Skip to content

Commit 4bcf59a

Browse files
committed
fixed spec for remote code execution vulnerability
1 parent d9b6866 commit 4bcf59a

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

spec/nori/nori_spec.rb

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -395,7 +395,8 @@
395395
'approved' => nil,
396396
'written_on' => nil,
397397
'viewed_at' => nil,
398-
'content' => nil,
398+
# don't execute arbitary YAML code
399+
'content' => { "@type" => "yaml" },
399400
'parent_id' => nil,
400401
'nil_true' => nil,
401402
'namespaced' => nil
@@ -435,12 +436,13 @@
435436
# Changed this line where the key is :message. The yaml specifies this as a symbol, and who am I to change what you specify
436437
# The line in ActiveSupport is
437438
# 'content' => { 'message' => "Have a nice day", 1 => "should be an integer", "array" => [{ "should-have-dashes" => true, "should_have_underscores" => true }] },
438-
'content' => { :message => "Have a nice day", 1 => "should be an integer", "array" => [{ "should-have-dashes" => true, "should_have_underscores" => true }] },
439+
'content' => "--- \n1: should be an integer\n:message: Have a nice day\narray: \n- should-have-dashes: true\n should_have_underscores: true\n",
439440
'author_email_address' => "[email protected]",
440441
'parent_id' => nil,
441442
'ad_revenue' => BigDecimal("1.50"),
442443
'optimum_viewing_angle' => 135.0,
443-
'resident' => :yes
444+
# don't create symbols from arbitary remote code
445+
'resident' => "yes"
444446
}
445447

446448
parse(topic_xml)["topic"].each do |k,v|

0 commit comments

Comments
 (0)