Skip to content

Commit

Permalink
Check passwords for '
Browse files Browse the repository at this point in the history
  • Loading branch information
domoritz committed Sep 26, 2012
1 parent cad3ec0 commit ab6e970
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions ckanext/datastore/commands.py
Expand Up @@ -127,6 +127,7 @@ def create_db(self):

def create_read_only_user(self):
password = self.db_read_url_parts['db_pass']
self.validate_password(password)
sql = read_only_user_sql.format(
maindb=self.db_ckan_url_parts['db_name'],
datastore=self.db_write_url_parts['db_name'],
Expand All @@ -137,3 +138,7 @@ def create_read_only_user(self):
self._run_sql(sql,
as_sql_user=self.sql_superuser,
database=self.db_write_url_parts['db_name'])

def validate_password(self, password):
if "'" in password:
raise ValueError("Passwords cannot contain '")

0 comments on commit ab6e970

Please sign in to comment.