Details
-
Bug
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Fixed
-
10.1.25, 10.2.8, 5.5(EOL), 10.0(EOL), 10.1(EOL), 10.2(EOL)
-
None
-
10.1.29
Description
Since the query lines get joined, single-line comments cause the rest of the line to be ignored.
Reproduction:
In [1]: from pymysql import connect # pymysql 0.7.11
|
|
In [2]: conn = connect(unix_socket='/run/mysqld/mysqld.sock')
|
|
In [3]: c = conn.cursor()
|
|
In [4]: c.execute('''SELECT 1,
|
...: -- Single-line comment
|
...: 2;''')
|
Out[4]: 1
|
|
In [5]: c.execute('''SELECT 1,
|
...: # Single-line comment
|
...: 2;''')
|
Out[5]: 1
|
Resulting log:
20170925 15:23:24,hostname,username,localhost,38,141,QUERY,,'SELECT 1, -- Single-line comment 2',0
|
20170925 15:23:28,hostname,username,localhost,38,142,QUERY,,'SELECT 1, # Single-line comment 2',0
|
Cause:
https://github.com/MariaDB/server/blob/fd2c5d19d0f0eeb054d18d4455d3ad28dd680219/plugin/server_audit/server_audit.c#L1346
https://github.com/MariaDB/server/blob/fd2c5d19d0f0eeb054d18d4455d3ad28dd680219/plugin/server_audit/server_audit.c#L1111
Solution
A) Skip comments (defeats the purpose of the audit log to some degree)
B) Log queries with escaped newlines (or better - all special characters).
B seems better.
Attachments
Activity
Field | Original Value | New Value |
---|---|---|
Description |
Since the query lines get joined, single-line comments cause the rest of the line to be ignored.
Reproduction: ``` In [1]: from pymysql import connect # pymysql 0.7.11 In [2]: conn = connect(unix_socket='/run/mysqld/mysqld.sock') In [3]: c = conn.cursor() In [4]: c.execute('''SELECT 1, ...: -- Single-line comment ...: 2;''') Out[4]: 1 In [5]: c.execute('''SELECT 1, ...: # Single-line comment ...: 2;''') Out[5]: 1 ``` Resulting log: ``` 20170925 15:23:24,hostname,username,localhost,38,141,QUERY,,'SELECT 1, -- Single-line comment 2',0 20170925 15:23:28,hostname,username,localhost,38,142,QUERY,,'SELECT 1, # Single-line comment 2',0 ``` Cause: https://github.com/MariaDB/server/blob/fd2c5d19d0f0eeb054d18d4455d3ad28dd680219/plugin/server_audit/server_audit.c#L1346 https://github.com/MariaDB/server/blob/fd2c5d19d0f0eeb054d18d4455d3ad28dd680219/plugin/server_audit/server_audit.c#L1111 Solution A) Skip comments (defeats the purpose of the audit log to some degree) B) Log queries with escaped newlines (or better - all special characters). B seems better. |
Since the query lines get joined, single-line comments cause the rest of the line to be ignored.
Reproduction: {noformat} In [1]: from pymysql import connect # pymysql 0.7.11 In [2]: conn = connect(unix_socket='/run/mysqld/mysqld.sock') In [3]: c = conn.cursor() In [4]: c.execute('''SELECT 1, ...: -- Single-line comment ...: 2;''') Out[4]: 1 In [5]: c.execute('''SELECT 1, ...: # Single-line comment ...: 2;''') Out[5]: 1 {noformat} Resulting log: {noformat} 20170925 15:23:24,hostname,username,localhost,38,141,QUERY,,'SELECT 1, -- Single-line comment 2',0 20170925 15:23:28,hostname,username,localhost,38,142,QUERY,,'SELECT 1, # Single-line comment 2',0 {noformat} Cause: https://github.com/MariaDB/server/blob/fd2c5d19d0f0eeb054d18d4455d3ad28dd680219/plugin/server_audit/server_audit.c#L1346 https://github.com/MariaDB/server/blob/fd2c5d19d0f0eeb054d18d4455d3ad28dd680219/plugin/server_audit/server_audit.c#L1111 Solution A) Skip comments (defeats the purpose of the audit log to some degree) B) Log queries with escaped newlines (or better - all special characters). B seems better. |
Status | Open [ 1 ] | Confirmed [ 10101 ] |
Fix Version/s | 10.1 [ 16100 ] | |
Fix Version/s | 10.2 [ 14601 ] | |
Affects Version/s | 5.5 [ 15800 ] | |
Affects Version/s | 10.0 [ 16000 ] | |
Affects Version/s | 10.1 [ 16100 ] | |
Affects Version/s | 10.2 [ 14601 ] | |
Assignee | Alexey Botchkov [ holyfoot ] |
Sprint | 10.1.29 [ 202 ] |
Status | Confirmed [ 10101 ] | In Progress [ 3 ] |
Fix Version/s | 10.1.19 [ 22111 ] | |
Fix Version/s | 10.2 [ 14601 ] | |
Fix Version/s | 10.1 [ 16100 ] | |
Resolution | Fixed [ 1 ] | |
Status | In Progress [ 3 ] | Closed [ 6 ] |
Workflow | MariaDB v3 [ 82810 ] | MariaDB v4 [ 152893 ] |