Skip to content

Commit d14ae8b

Browse files
evgeniekohl
authored andcommitted
properly escape quotes in passwords by calling to_ruby
database passwords can contain special characters, especially " and ' so we can't just print the value of the field enclosed by double quotes as that would break whenever the user uses a literal " in their password using to_ruby here and not to_yaml, as the former gives us correct escaping without the whole `---` and `\n` enclosing that to_yaml forces. using to_yaml would require to pass *the whole* config hash to it
1 parent b1a2286 commit d14ae8b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

templates/database.yml.epp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,6 @@
3030
username: <%= $username %>
3131
<% } -%>
3232
<% if $password { -%>
33-
password: "<%= $password %>"
33+
password: <%= stdlib::to_ruby($password) %>
3434
<% } -%>
3535
pool: <%= $db_pool %>

0 commit comments

Comments
 (0)