[MDEV-23457] CREATE / DROP PROCEDURE not logged with audit plugin Created: 2020-08-12 Updated: 2022-02-08 Resolved: 2021-03-29 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Plugin - Audit |
| Affects Version/s: | 10.5.4 |
| Fix Version/s: | 10.2.38, 10.3.29, 10.4.22, 10.5.13, 10.6.5 |
| Type: | Bug | Priority: | Critical |
| Reporter: | Richard Stracke | Assignee: | Alexey Botchkov |
| Resolution: | Fixed | Votes: | 1 |
| Labels: | None | ||
| Issue Links: |
|
||||
| Description |
|
The commands
will not be logged with set global server_audit_events = "CONNECT,QUERY_DDL,QUERY_DCL"; also not with QUERY_DML set global server_audit_events = "CONNECT,QUERY_DDL,QUERY_DCL,QUERY_DML"; with adding QUERY it works. set global server_audit_events = "CONNECT,QUERY_DDL,QUERY_DCL,QUERY_DML,QUERY"; In the KB CREATE / DROP PROCEDURE will not classified as DDL.
[https://mariadb.com/kb/en/mariadb-audit-plugin-log-settings/| Even if this would be true, it should be logged with adding QUERY_DML at least, https://www.w3schools.in/mysql/ddl-dml-dcl/#DDL In MariaDB and SQL standard DROP / CREATE Procedures is classified as DDL. |
| Comments |
| Comment by Elena Stepanova [ 2020-08-18 ] |
|
I had difficulties parsing the description of the issue, I think eventually I got it, let me re-phrase it the way I understood it: Problem 1: Problem 2: I agree that "problem 2" is a valid complaint. Even if, on whatever reason, the Audit plugin is designed not to count CREATE PROCEDURE as an audit event of type QUERY_DDL, it doesn't mean that "they're not DDL". The KB should be more accurate and say that they are not logged along with other DDL statements, or whatever, and preferably explain why. For the "problem 1", apparently the Audit plugin works as designed, or at least as documented. The fact that the Audit plugin intentionally doesn't consider CREATE PROCEDURE as QUERY_DDL is explicitly stated in the documentation, even if the wording is clumsy. I cannot determine whether it's a design flaw which needs to be fixed, as I don't know why it was decided to be done this way. Assigning to ralf.gebhardt@mariadb.com, hopefully he knows the reason. At the same time, this exception by no means implies that it would be considered DML instead, neither does the documentation say so. Regardless of whether it counts as DDL in the Audit plugin world, CREATE PROCEDURE cannot possibly be DML. |
| Comment by Sergei Golubchik [ 2021-01-06 ] |
|
This is so very "implementation defined", every DBMS does it differently. In the SQL standard there is no DML and DDL, there are
|
| Comment by Sergei Golubchik [ 2021-01-06 ] |
|
We can define DDL as "SQL-schema statements" and DML as "SQL-data statements", that looks like a least controversial definition, avoids the need to decide per statement. Of course, MariaDB extensions, like HANDLER, still needs to be categorized on a per statement basis. We could also define DCL, TCL, and other TLAs based on this standard statement grouping |
| Comment by Jacob Moorman (Inactive) [ 2021-01-08 ] |
|
serg Within the Documentation Team, GeoffMontee and I have evaluated the definitions proposed. ISO 9075-2:2016 identifies the following implementation-specific classifiers:
We agree that for Documentation purposes, we would want to define:
We have additionally surveyed peer documentation practices by MySQL, PostgreSQL, Oracle database, and Microsoft SQL Server. The number of classifications they define within their documentation varies from the low end of defining only DDL and DML, to the high end of additionally defining SQL-control, SQL-session, and/or SQL-transaction. The proposed definitions for DDL and DML appear consistent with the practices of these other databases. |
| Comment by Sergei Golubchik [ 2021-01-09 ] |
|
holyfoot, see above. For audit plugin, too, QUERY_DDL should mean all statements from the standard "SQL-schema statements" group, |