Skip to content

(8.4)PXC-5291: User without super can create trigger even without log_bin_… - #2324

Open
jaideepkarande wants to merge 1 commit into
percona:8.4from
jaideepkarande:PXC-5291-8.4
Open

(8.4)PXC-5291: User without super can create trigger even without log_bin_…#2324
jaideepkarande wants to merge 1 commit into
percona:8.4from
jaideepkarande:PXC-5291-8.4

Conversation

@jaideepkarande

Copy link
Copy Markdown
Contributor

…trust_function_creators enabled

https://perconadev.atlassian.net/browse/PXC-5291

The PXC-4765 change folded the trigger DEFINER-mismatch check and the binlog-safety (log_bin_trust_function_creators) check into a single privilege test that accepted SUPER or SET_ANY_DEFINER. As a result a user holding only SET_ANY_DEFINER could create a trigger while log_bin_trust_function_creators = 0, diverging from PS and PXC 8.4.7 which reject it with ER_BINLOG_CREATE_ROUTINE_NEED_SUPER.

Split the two checks in Sql_cmd_create_trigger::execute(): the DEFINER-mismatch check keeps SUPER or SET_ANY_DEFINER, while the binlog-safety check now requires SUPER only. SET_ANY_DEFINER no longer bypasses the binlog-safety gate.

@jaideepkarande

Copy link
Copy Markdown
Contributor Author

@jaideepkarande
jaideepkarande marked this pull request as ready for review July 16, 2026 06:17

@kamil-holubicki kamil-holubicki left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Please consider refactoring it according to suggestions in PR #2325

…trust_function_creators enabled

https://perconadev.atlassian.net/browse/PXC-5291

Problem:
The PXC-4765 change combined trigger DEFINER validation with the
log_bin_trust_function_creators check and allowed either SUPER or
SET_ANY_DEFINER to satisfy both. Consequently, a user holding only
SET_ANY_DEFINER could create a trigger with
log_bin_trust_function_creators=0, diverging from PS and PXC 8.4.7,
which reject the statement with ER_BINLOG_CREATE_ROUTINE_NEED_SUPER.

While fixing this, an additional issue was found where early validation
covered a differing DEFINER but not a nonexistent one. A SET_ANY_DEFINER
user could therefore pass the pre-TOI check, after which the origin rejected
the trigger during creation while appliers accepted it, causing node
inconsistency and possible eviction.

Resolution:
Replace the combined privilege test with two independent checks:

* Use check_valid_definer() before TOI to validate differing and
  nonexistent DEFINER accounts, including the SYSTEM_USER rule.
* Keep the binlog-safety check separate and require SUPER when
  log_bin_trust_function_creators=0. This check continues to apply with
  emulated binlogging because Galera replicates the trigger body.
Comment thread sql/sql_trigger.cc

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I will re-add it for upstream compatibility.
And add sql_authorization.h inside WITH_WSREP, if issue is raised by pipelines.

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.

2 participants