Skip to content

Commit

Permalink
properly escape quotes in passwords by calling to_python
Browse files Browse the repository at this point in the history
database passwords can contain special characters, especially " and '
so we can't just print the value of the field enclosed by single quotes
as that would break whenever the user uses a literal ' in their password
  • Loading branch information
evgeni authored and ekohl committed Oct 16, 2024
1 parent d75c952 commit 8103e5c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion templates/settings.py.erb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ DATABASES = {
'ENGINE': 'django.db.backends.postgresql',
'NAME': '<%= scope['pulpcore::postgresql_db_name'] %>',
'USER': '<%= scope['pulpcore::postgresql_db_user'] %>',
'PASSWORD': '<%= scope['pulpcore::postgresql_db_password'] %>',
'PASSWORD': <%= scope.call_function('to_python', [scope['pulpcore::postgresql_db_password']]) %>,
'HOST': '<%= scope['pulpcore::postgresql_db_host'] %>',
'PORT': '<%= scope['pulpcore::postgresql_db_port'] %>',
<% if scope['pulpcore::postgresql_db_ssl'] && !scope['pulpcore::postgresql_manage_db'] -%>
Expand Down

0 comments on commit 8103e5c

Please sign in to comment.