Skip to content
This repository has been archived by the owner on Mar 21, 2018. It is now read-only.

Ensure that paths are escaped when validating #128

Merged
merged 1 commit into from
May 10, 2013
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions lib/ridley/chef/cookbook/syntax_check.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
require 'shellwords'

module Ridley::Chef
class Cookbook
# @author Jamie Winsor <reset@riotgames.com>
Expand Down Expand Up @@ -125,7 +127,7 @@ def validate_templates
end

def validate_template(erb_file)
result = quietly { shell_out("erubis -x #{erb_file} | ruby -c") }
result = quietly { shell_out("erubis -x #{erb_file.shellescape} | ruby -c") }
result.error!
true
rescue Mixlib::ShellOut::ShellCommandFailed
Expand All @@ -136,7 +138,7 @@ def validate_template(erb_file)
end

def validate_ruby_file(ruby_file)
result = quietly { shell_out("ruby -c #{ruby_file}") }
result = quietly { shell_out("ruby -c #{ruby_file.shellescape}") }
result.error!
true
rescue Mixlib::ShellOut::ShellCommandFailed
Expand Down