Skip to content

Revoke PROXY privilege on seeded user role changes - #110

Merged
kimago merged 1 commit into
mainfrom
tnz-97930/revoke-proxy-priv-on-role-change
May 5, 2026
Merged

Revoke PROXY privilege on seeded user role changes#110
kimago merged 1 commit into
mainfrom
tnz-97930/revoke-proxy-priv-on-role-change

Conversation

@abg

@abg abg commented May 5, 2026

Copy link
Copy Markdown
Member

Feature or Bug Description

This change revokes the PROXY privilege from a seeded_users managed user when redeploying pxc-release and downgrading the role of a seeded user from admin to a lesser privileged role. Previously the user would retain the admin PROXY privilege.

Additionally, adjusted the REVOKE ALL PRIVILEGES syntax to use the MySQL v8.0+ variant:

REVOKE ALL PRIVILEGES, GRANT OPTION FROM $user

This makes is more obvious that all privileges are being revoked. This is functionality identical to the older REVOKE ALL PRIVILEGES ON *.* FROM ... form, and merely updated for clarity.

A change was also made to admin grants to revoke previous privileges before adjusting a new admin user's grant. This avoids a corner case where redeploying a less role to an admin role retained unnecessary grants (which would be covered by the admin role anyway). This aligns the admin privilege grants with other types of roles in the seeded_users feature.

Motivation

This addresses an observation that PROXY privilege was retained on an unprivileged after a redeploy that demoted a user that was previously deployed with role: admin user.

None of these issues were problematic in practice. The PROXY privilege on the anonymous user without a GRANT OPTION confers no special privilege escalation. The REVOKE ALL syntax change is aesthetic. Admin users retaining less privileged per-object (e.g. database) grants were not given any additional privileges.

This change is purely around security hygiene and cleaning up the implementation.

When resetting a seeded user's privileges, also revoke the PROXY grant
that the admin role issues. Uses REVOKE IF EXISTS (MySQL 8.0+) for
idempotency. Switches REVOKE ALL PRIVILEGES ON *.* to the explicit
REVOKE ALL PRIVILEGES, GRANT OPTION FROM form. Adds a revoke step at
the start of grant_admin_privs so any accumulated grants are cleared
before admin privileges are re-applied.

Adds integration tests covering admin-to-minimal downgrade and
idempotent revoke of a non-existent PROXY grant.

@kimago kimago left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Approving:

  • new integration tests fail on main, pass on branch
  • new integ test "redeploys" across distinct containers -- but with the persistent disk retaining the "admin" user's config for modification, validating the privilege downgrade.
  • noted removal of redundant DeferCleanup/RemoveContainer cleanup

@github-project-automation github-project-automation Bot moved this from Inbox to Pending Merge | Prioritized in Foundational Infrastructure Working Group May 5, 2026
@kimago
kimago merged commit f65a3e7 into main May 5, 2026
2 checks passed
@github-project-automation github-project-automation Bot moved this from Pending Merge | Prioritized to Done in Foundational Infrastructure Working Group May 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Development

Successfully merging this pull request may close these issues.

2 participants