Skip to content

Commit 841187b

Browse files
daianamezdreaDavidS
authored andcommitted
Fix quotes to avoid shell injection
1 parent 34f566f commit 841187b

File tree

1 file changed

+1
-2
lines changed
  • lib/puppet/provider/postgresql_psql

1 file changed

+1
-2
lines changed

lib/puppet/provider/postgresql_psql/ruby.rb

+1-2
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ def run_sql_command(sql)
1616
command = [resource[:psql_path]]
1717
command.push('-d', resource[:db]) if resource[:db]
1818
command.push('-p', resource[:port]) if resource[:port]
19-
command.push('-t', '-X', '-c', '"' + sql.gsub('"', '\"') + '"')
19+
command.push('-t', '-X', '-c', sql)
2020

2121
environment = fetch_environment
2222

@@ -57,7 +57,6 @@ def fetch_environment
5757
end
5858

5959
def run_command(command, user, group, environment)
60-
command = command.join ' '
6160
output = Puppet::Util::Execution.execute(command, uid: user,
6261
gid: group,
6362
failonfail: false,

0 commit comments

Comments
 (0)