From c0881a6a7d5de2bf9cc4052ed9c1ab9dc34d7cc8 Mon Sep 17 00:00:00 2001 From: Erik Ordway Date: Thu, 19 Mar 2015 08:39:15 -0700 Subject: [PATCH] single quote password in backup command This protects against characters like '&' in passwords. Sometimes you are assigned passwords by idiots or are and idiot that uses pronounceable passwords. Anyways this small change protects against ruby's shell interpreter from background the pg_dump command before it has really started. --- lib/backup_restore/backuper.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/backup_restore/backuper.rb b/lib/backup_restore/backuper.rb index 3c0ddaf7d8f..02b1c48811a 100644 --- a/lib/backup_restore/backuper.rb +++ b/lib/backup_restore/backuper.rb @@ -174,7 +174,7 @@ module BackupRestore def pg_dump_command db_conf = BackupRestore.database_configuration - password_argument = "PGPASSWORD=#{db_conf.password}" if db_conf.password.present? + password_argument = "PGPASSWORD='#{db_conf.password}'" if db_conf.password.present? host_argument = "--host=#{db_conf.host}" if db_conf.host.present? port_argument = "--port=#{db_conf.port}" if db_conf.port.present? username_argument = "--username=#{db_conf.username}" if db_conf.username.present?