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

Remove SQL injection warning for multiStatement in README #1430

Closed
wants to merge 1 commit into from

Conversation

arp242
Copy link

@arp242 arp242 commented May 16, 2023

I can't really find any reference to the risk of SQL injections. This sets the clientMultiStatements flag (or CLIENT_MULTI_STATEMENTS in the C API).

This comment was added in #411, but without much explanation, and I can't find anything in e.g. #66 or other issues either.

The documentation for MySQL1 or MariaDB2 doesn't warn for SQL injections, and after some internet searching the only reference I found was in the PHP Docs3:

The API functions mysqli::query() and mysqli::real_query() do
not set a connection flag necessary for activating multi queries
in the server. An extra API call is used for multiple statements
to reduce the damage of accidental SQL injection attacks. An
attacker may try to add statements such as ; DROP DATABASE mysql
or ; SELECT SLEEP(999).

So I assume this is what this comment refers to.

This removes the comment, as discussed in #1206.

Description

Please explain the changes you made here.

Checklist

  • Code compiles correctly
  • Created tests which fail without the change (if possible)
  • All tests passing
  • Extended the README / documentation, if necessary
  • Added myself / the copyright holder to the AUTHORS file

I can't really find any reference to the risk of SQL injections. This
sets the clientMultiStatements flag (or CLIENT_MULTI_STATEMENTS in the C
API).

This comment was added in go-sql-driver#411, but without much explanation, and I
can't find anything in e.g. go-sql-driver#66 or other issues either.

The documentation for MySQL[1] or MariaDB[2] doesn't warn for SQL
injections, and after some internet searching the only reference I found
was in the PHP Docs[3]:

	The API functions mysqli::query() and mysqli::real_query() do
	not set a connection flag necessary for activating multi queries
	in the server. An extra API call is used for multiple statements
	to reduce the damage of accidental SQL injection attacks. An
	attacker may try to add statements such as ; DROP DATABASE mysql
	or ; SELECT SLEEP(999).

So I assume this is what this comment refers to.

This removes the comment, as discussed in go-sql-driver#1206.

[1]: https://dev.mysql.com/doc/c-api/8.0/en/c-api-multiple-queries.html
[2]: https://mariadb.com/kb/en/mysql_real_connect/
[3]: https://www.php.net/manual/de/mysqli.quickstart.multiple-statement.php
@@ -295,7 +295,7 @@ Valid Values: true, false
Default: false
```

Allow multiple statements in one query. While this allows batch queries, it also greatly increases the risk of SQL injections. Only the result of the first query is returned, all other results are silently discarded.
Allow multiple statements in one query. While this allows batch queries. Only the result of the first query is returned, all other results are silently discarded.
Copy link
Member

Choose a reason for hiding this comment

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

"While this..." paragraph doesn't make sense.
And "Only the..." paragraph is incorrect for now too.

I will rewrite this paragraph.

Copy link
Author

Choose a reason for hiding this comment

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

Oops >_<

@methane
Copy link
Member

methane commented May 17, 2023

Please review #1431.

@methane methane closed this May 17, 2023
@arp242 arp242 deleted the multistmt-inject branch May 17, 2023 15:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants