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

mysql USER and HOST should be quoted for drop query #443

Merged
merged 1 commit into from
Apr 27, 2021

Conversation

neubi4
Copy link
Contributor

@neubi4 neubi4 commented Apr 27, 2021

USER and HOST should be quoted to avoid errors in drop user statement.

Query result unquoted:

+------------------------------------------+
| users                                    |
+------------------------------------------+
| root@localhost, root@127.0.0.1, root@::1 |
+------------------------------------------+

Raised this error:

TASK [devsec.hardening.mysql_hardening : ensure that there are no users without password or authentication_string] *************************************************************************
fatal: [host]: FAILED! => changed=false
  msg: 'Cannot execute SQL ''DROP USER root@localhost, root@127.0.0.1, root@::1'' args [None]: (1064, "You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ''::1'' at line 1")'

Query result Quoted:

+------------------------------------------------------+
| users                                                |
+------------------------------------------------------+
| 'root'@'localhost', 'root'@'127.0.0.1', 'root'@'::1' |
+------------------------------------------------------+

USER and HOST should be quoted to avoid errors in drop user statement

Signed-off-by: Martin Neubert <martin.neubert@t-systems.com>
@rndmh3ro
Copy link
Member

Thank you! I wonder why this error didn't happen in my tests..

divialth pushed a commit to divialth/ansible-collection-hardening that referenced this pull request Aug 3, 2022
USER and HOST should be quoted to avoid errors in drop user statement

Signed-off-by: Martin Neubert <martin.neubert@t-systems.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants