Skip to content

Commit c5e07f5

Browse files
committed
fixed spec for remote code execution vulnerability
1 parent 818f526 commit c5e07f5

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
@@ -369,7 +369,8 @@
369369
'approved' => nil,
370370
'written_on' => nil,
371371
'viewed_at' => nil,
372-
'content' => nil,
372+
# don't execute arbitary YAML code
373+
'content' => { "@type" => "yaml" },
373374
'parent_id' => nil,
374375
'nil_true' => nil,
375376
'namespaced' => nil
@@ -409,12 +410,13 @@
409410
# Changed this line where the key is :message. The yaml specifies this as a symbol, and who am I to change what you specify
410411
# The line in ActiveSupport is
411412
# 'content' => { 'message' => "Have a nice day", 1 => "should be an integer", "array" => [{ "should-have-dashes" => true, "should_have_underscores" => true }] },
412-
'content' => { :message => "Have a nice day", 1 => "should be an integer", "array" => [{ "should-have-dashes" => true, "should_have_underscores" => true }] },
413+
'content' => "--- \n1: should be an integer\n:message: Have a nice day\narray: \n- should-have-dashes: true\n should_have_underscores: true\n",
413414
'author_email_address' => "[email protected]",
414415
'parent_id' => nil,
415416
'ad_revenue' => BigDecimal("1.50"),
416417
'optimum_viewing_angle' => 135.0,
417-
'resident' => :yes
418+
# don't create symbols from arbitary remote code
419+
'resident' => "yes"
418420
}
419421

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

0 commit comments

Comments
 (0)