]> git.openstreetmap.org Git - chef.git/commitdiff
Escape passwords when creating postgres users
authorTom Hughes <tom@compton.nu>
Wed, 27 Jul 2016 19:20:23 +0000 (20:20 +0100)
committerTom Hughes <tom@compton.nu>
Wed, 27 Jul 2016 19:20:23 +0000 (20:20 +0100)
cookbooks/postgresql/providers/user.rb

index 5a1402d40389f28ff5a388dc3068788cf7c19f6b..5df0f3847845d07a19fb188bc25b97540587e5cb 100644 (file)
@@ -17,6 +17,8 @@
 # limitations under the License.
 #
 
+require "shellwords"
+
 use_inline_resources
 
 def load_current_resource
@@ -35,7 +37,7 @@ def load_current_resource
 end
 
 action :create do
-  password = new_resource.password ? "ENCRYPTED PASSWORD '#{new_resource.password}'" : ""
+  password = new_resource.password ? "ENCRYPTED PASSWORD '#{new_resource.password.shellescape}'" : ""
   superuser = new_resource.superuser ? "SUPERUSER" : "NOSUPERUSER"
   createdb = new_resource.createdb ? "CREATEDB" : "NOCREATEDB"
   createrole = new_resource.createrole ? "CREATEROLE" : "NOCREATEROLE"