[CONC-515] Implement safe LOAD DATA LOCAL INFILE method Created: 2020-11-02 Updated: 2021-11-09 |
|
| Status: | In Review |
| Project: | MariaDB Connector/C |
| Component/s: | Security |
| Affects Version/s: | None |
| Fix Version/s: | 3.3 |
| Type: | Task | Priority: | Major |
| Reporter: | Georg Richter | Assignee: | Sergei Golubchik |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Issue Links: |
|
||||||||||||||||||||||||
| Description |
| Comments |
| Comment by Diego Dupin [ 2020-11-06 ] |
|
Current proposition is not the best fit :
Load local infile is the only exchange with multiples request-answer in the protocol after authentication. The problem is that this block async driver to work the best possible way. After authentication, if load local infile capability is disabled, async driver can fully use the possibility that non blocking socket offer : pipelining request then read response orderly. This is what async offer, no possibility of socket hanging because of socket buffer full. So when all exchanges are only request - answer, that's perfect, driver can just send command, and when corresponding answer comes, deliver result. If there is even one command that can have multiple exchanges, then driver will have to ensure having the response of previous request before sending next command. The alternative is to parse command then lock all other commands until completion if command was a load local infile. Actual LOAD LOCAL INFILE command are blocked by default by recent server. If this functionality is essential, this will have to be done in a one exchange command, and probably have a dedicated API to send that special command. |
| Comment by Sergei Golubchik [ 2020-11-07 ] |
|
diego dupin, this is the task of what a connector can do without any changes to the server and with breaking as few existing applications as possible. Under those constraints this approach works quite good, perhaps it's even the best fit. If it's allowed to break existing applications or to modify the protocol then you can do larger changes, of course. |
| Comment by Georg Richter [ 2020-11-07 ] |
|
serg I don't think that introducing a new capability flag (CLIENT_SAFE_LOCAL_INFILE) would be much overhead: if both client and server have this capability flag set, the server doesn't need to send the filename anymore to the client - and it will not break existing applications. Additionally the configuration variable local_infile=ON/OFF would only apply if client isn't able to handle safe load data local infile. However on client side both variants will require either parsing, or to specify a filename e.g. via mysql_optionsv() before executing the statement. |
| Comment by Georg Richter [ 2020-11-07 ] |
|
A special case are multi statements (statements concatenated by semicolon) and the init_command which can be send after connection was established. Either we need to parsecompletely, or we need to document that LOAD DATA LOCAL INFILE might fail if used inside multi statements. |