Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

installation: fix database password escaping #2846

Closed
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion invenio/base/scripts/database.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ def init(user='root', password='', yes_i_know=False):
# Create user and grant access to database.
(cmd_prefix + '-e "GRANT ALL PRIVILEGES ON '
'{CFG_DATABASE_NAME}.* TO {CFG_DATABASE_USER}@localhost '
'IDENTIFIED BY {CFG_DATABASE_PASS}"'),
'IDENTIFIED BY \'{CFG_DATABASE_PASS}\'"'),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@eamonnmag actually this highlights the issue of proper escaping of the password. What if the password has a quotation sign? You should probably protect the CFG_DATABASE_PASS variable within args, so that any single quote is properly escaped.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

cmd_admin_prefix + 'flush-privileges'
]
for cmd in cmds:
Expand Down