惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

S
Security @ Cisco Blogs
罗磊的独立博客
宝玉的分享
宝玉的分享
Last Week in AI
Last Week in AI
T
The Blog of Author Tim Ferriss
美团技术团队
T
Tailwind CSS Blog
博客园 - 三生石上(FineUI控件)
博客园 - Franky
G
Google Developers Blog
Jina AI
Jina AI
Stack Overflow Blog
Stack Overflow Blog
H
Hackread – Cybersecurity News, Data Breaches, AI and More
V
Visual Studio Blog
腾讯CDC
S
SegmentFault 最新的问题
Recent Announcements
Recent Announcements
博客园 - 叶小钗
Microsoft Security Blog
Microsoft Security Blog
雷峰网
雷峰网
L
LangChain Blog
Vercel News
Vercel News
Forbes - Security
Forbes - Security
PCI Perspectives
PCI Perspectives
N
News | PayPal Newsroom
S
Security Affairs
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
博客园 - 司徒正美
J
Java Code Geeks
Recent Commits to openclaw:main
Recent Commits to openclaw:main
Hacker News: Ask HN
Hacker News: Ask HN
Schneier on Security
Schneier on Security
A
About on SuperTechFans
Attack and Defense Labs
Attack and Defense Labs
Google Online Security Blog
Google Online Security Blog
aimingoo的专栏
aimingoo的专栏
MongoDB | Blog
MongoDB | Blog
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
酷 壳 – CoolShell
酷 壳 – CoolShell
Cloudbric
Cloudbric
B
Blog
C
CXSECURITY Database RSS Feed - CXSecurity.com
P
Proofpoint News Feed
D
DataBreaches.Net
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
B
Blog RSS Feed
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
N
News and Events Feed by Topic

MariaDB.org

IBM continues as a Platinum Sponsor of MariaDB Foundation - MariaDB.org Say the Name: MariaDB, MySQL, and the Ecosystem We Share - MariaDB.org Deploying the MariaDB Privacy-First Stack Anywhere with Terraform - MariaDB.org From PostgreSQL 12 to MariaDB 11: A Gradual Fintech Migration with 23% Lower TCO - MariaDB.org MariaDB 13.1 Feature in Focus: Validate Your Configuration Before Starting the Server - MariaDB.org MariaDB Hidden Gem: Online Schema Change without pt-osc - MariaDB.org MariaDB 13.1 Feature in Focus: BLOB, TEXT, JSON and GEOMETRY Support in the HEAP Engine - MariaDB.org MariaDB Foundation Sea Lion Champions Nominees: Federico Razzoli - MariaDB.org TAF 3.0 — Results Backend With Automated Performance Change Detection - MariaDB.org MariaDB 13.1 Feature in Focus: DENY / Negative Grants - MariaDB.org Continuent joins MariaDB Foundation as a Silver Sponsor - MariaDB.org Lowering the Barrier for MariaDB Plugin Development: Plugins in More Languages - MariaDB.org Nextcloud renews its Silver sponsorship of MariaDB Foundation - MariaDB.org MariaDB Foundation Sea Lion Champions Nominees: Fariha Shaikh - MariaDB.org MariaDB Privacy-First Stack: Nextcloud, Passbolt and MariaDB Server - MariaDB.org Passbolt renews its support for MariaDB Foundation - MariaDB.org Aqtra Joins MariaDB Foundation as a Gold Sponsor - MariaDB.org MariaDB 13.1 Preview: This One Is Full of Community Goodies! - MariaDB.org MariaDB 13.1 preview available - MariaDB.org Simple tool to build MariaDB commits for performance-change analysis - MariaDB.org MariaDB Vector in Laravel: insights on choosing an embedding model - MariaDB.org MariaDB Server 10.6 Reaches End of Life on July 6th - MariaDB.org MariaDB Foundation Sea Lion Champions Nominees: Sylvain Arbaudie - MariaDB.org MariaDB + DuckDB: A New Playground for Analytics – A First Look at the New Storage Engine MariaDB Server 12.3, 11.8, 11.4, 10.11, 10.6 – May 2026’s releases: thank you for your contributions DuckDB Storage Engine for MariaDB. When the Sea Lion Learns to Quack. MariaDB Foundation Sea Lion Champions Nominees: Mark Callaghan MariaDB Foundation Sea Lion Champions Nominees: Sumit Srivastava The Power Of The Community! MariaDB Hidden Gem: Create Aggregate Function Celebrating the MariaDB Foundation Sea Lions Champions Nominees MariaDB Foundation: Bringing TPC-B Back To Life MariaDB Community Server Corrective Releases A New Pull Request Processing Time Record MariaDB Server 12.3 LTS Released MariaDB Foundation at Oracle’s MySQL Contributor Summit: Ecosystems, Forks and Constructive Coexistence Virtuozzo Renews Sponsorship of MariaDB Foundation ProxySQL joins MariaDB Foundation as Silver Sponsor Drupal recommends MariaDB Vibe-coding an Audit Plugin in Under 3 Minutes Introducing Our First MariaDB Server Solution Stack: A Privacy-First Stack with Nextcloud, Passbolt, and MariaDB Documented: The MariaDB Server (Community) Contribution Process Unleashing Innovation Through Plugins Adding a New Data Type to MariaDB with Type_handler – Part 5
MariaDB Server Plugins: disabled functions - MariaDB.org
Frédéric Descamps · 2026-07-06 · via MariaDB.org

During the last MariaDB Foundation Board Meeting (24 June 2026), Barry shared how it can be difficult to deploy an upgrade immediately and that they sometimes have to wait for one that fixes security bugs. Wait for the validation, wait for the fix, and the release. Even if the MariaDB engineers are doing incredible work, it might still not be fast enough for the security team.

That’s where Barry requested MariaDB implement a query-rewriter plugin, like the one in MySQL, to address the fact that, in a multi-tenant environment, certain queries that would trigger known vulnerabilities are never legitimately used by applications.

So I wrote something similar, but unfortunately, this didn’t solve the problem. Queries are way too different. For example, these two queries will provide two different digests or normalized forms:

select now() as nu;

select now() as maintenant;

So this solution was discarded, and we discussed maybe using a regular expression, but that might become too heavy; it would be better to use a proxy like MaxScale with the rewrite or regexp filter.

And then the real problem arose: most of their issues stemmed from built-in functions they never use in their application, but that could become dangerous. So they asked if it was possible to “just” disable some built-in functions

The Solution

Of course, there is nothing currently implemented in MariaDB Server that allows the DBA to disable built-in functions.

But our Chief Architect, Sergei Golubchik, had an idea: a dynamic plugin loaded at startup could disable a function and return an error. We could monkey-patch a C++ virtual method at runtime by directly modifying a class’s vtable.

Monkey-patching means changing the behavior of existing code at runtime, rather than by editing and recompiling the original source. It’s primarily used in dynamic languages like Python and JavaScript to add, replace, or suppress functionality in memory.

That rang a bell and opened a new perspective to reach the desired objective.

The key idea

MariaDB has internal registries of built-in SQL functions, represented as arrays:

extern Native_func_registry_array native_func_registry_array;
extern Native_func_registry_array native_func_registry_array_geom;
extern Native_func_registry_array oracle_func_registry_array;

Each entry looks like this:

struct Native_func_registry
{
  LEX_CSTRING name;
  Create_func *builder;
};

Meaning that each function has a name and a builder (an object used to create the function expression).

Finally, MariaDB also has hash tables used to look up functions quickly:

extern Native_functions_hash native_functions_hash;
extern Native_functions_hash native_functions_hash_oracle;

So when a SQL statement contains something like:

SELECT SLEEP(10);

MariaDB parses SLEEP, searches the function registry/hash, finds its Create_func *builder, and uses that to construct the function call.

This plugin simply removes selected entries from those hashes.

After removal, the function still exists in the compiled MariaDB code, but the SQL layer can no longer resolve its name via the normal native-function lookup path.

Creating a plugin for MariaDB Server isn’t complicated (see this page), so I tried to write a plugin that, when loaded at startup, would disable functions referenced by a global read-only variable using the key idea above.

The plugin is available on my GitHub repository.

When compiled and installed, you can load the module directly from the my.cnf:

[mariadb]
plugin_load_add=disabled_functions
disabled_functions=SLEEP,COLUMN_LIST

This will load the plugin and disable the commands SLEEP() and COLUMN_LIST():

MariaDB [test]> SELECT * FROM information_schema.PLUGINS  
                WHERE plugin_name = 'disabled_functions'\G
*************************** 1. row ***************************
           PLUGIN_NAME: disabled_functions
        PLUGIN_VERSION: 1.0
         PLUGIN_STATUS: ACTIVE
           PLUGIN_TYPE: DAEMON
   PLUGIN_TYPE_VERSION: 130100.0
        PLUGIN_LIBRARY: disabled_functions.so
PLUGIN_LIBRARY_VERSION: 1.15
         PLUGIN_AUTHOR: lefred
    PLUGIN_DESCRIPTION: Disables selected native built-in SQL functions
        PLUGIN_LICENSE: GPL
           LOAD_OPTION: ON
       PLUGIN_MATURITY: Experimental
   PLUGIN_AUTH_VERSION: 1.0
1 row in set (0.002 sec)

MariaDB [test]> SHOW GLOBAL VARIABLES LIKE 'disabled_functions_list';
+-------------------------+-------------------+
| Variable_name           | Value             |
+-------------------------+-------------------+
| disabled_functions_list | SLEEP,COLUMN_LIST |
+-------------------------+-------------------+
1 row in set (0.000 sec)

Now let’s try to use one of these functions:

MariaDB [test]> select sleep();
ERROR 1305 (42000): FUNCTION test.sleep does not exist
MariaDB [test]> select sleep(10);
ERROR 1305 (42000): FUNCTION test.sleep does not exist
MariaDB [test]> select sleep('fred');
ERROR 1305 (42000): FUNCTION test.sleep does not exist
MariaDB [test]> 

The plugin works exactly as expected.

Conclusion

This is not a wow-feature plugin, but it illustrates how flexible MariaDB is and how quickly it’s possible to extend it with a feature that could be used in production.

Please give it a try, and if you code some plugins, please share them with me. I will be happy to test them.

As usual, enjoy MariaDB Server and enjoy hacking!