You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I had searched in the issues and found no similar issues.
Description
#66115 gates RETAIN CURRENT PASSWORD / DISCARD OLD PASSWORD behind the GRANT tier, including on one's own account. That closes the park-a-secondary-password hole, but it also means the only accounts that can rotate themselves with an overlap window are accounts that already hold account-management power — which excludes the population that needs online rotation most: low-privilege machine identities (BI tools, service accounts, AI/MCP integrations) holding a long-lived credential.
MySQL's answer is a dedicated dynamic privilege: APPLICATION_PASSWORD_ADMIN authorizes the dual password clauses on one's own account, so a DBA can delegate exactly "you may rotate yourself with an overlap" and nothing else.
Two pieces:
APPLICATION_PASSWORD_ADMIN_PRIV — a new GLOBAL-context entry in Privilege (index 15; 9–11 are the contaminated legacy indexes, 12–14 are taken). Grantable via the existing grammar (GRANT APPLICATION_PASSWORD_ADMIN_PRIV ON *.*.* TO user — privilege names resolve through AccessPrivilege.fromName(), no lexer work). The own-account clause checks in SetPassVarOp.validate() / AlterUserInfo.validate() accept it as an alternative to GRANT/ADMIN; clauses on other accounts keep the GRANT tier (MySQL requires CREATE USER there, and GRANT is Doris's account-management tier).
Secondary-password introspection — per the [feat](auth) Support MySQL-compatible dual password (RETAIN CURRENT PASSWORD / DISCARD OLD PASSWORD) #66115 review, there is currently no way to ask "who is holding a retained secondary password right now" (fe.audit.log keeps the RETAIN clause, but that's forensics, not state). MySQL exposes it in mysql.user.User_attributes. Surface a boolean per account (e.g. in SHOW GRANTS output or an information_schema column) so operators can find leftovers to DISCARD.
How
All FE-side, small surface:
Privilege.java: new enum entry + privileges map slot 15 + the notBelongTo* arrays (global-only, like NODE/ADMIN).
AccessPrivilege.java: name + toDorisPrivilege() mapping.
PrivPredicate: a predicate covering APPLICATION_PASSWORD_ADMIN_PRIV | GRANT_PRIV | ADMIN_PRIV, used by the own-account clause checks.
Compatibility: a new privilege bit in PrivBitSet follows the same forward/backward story as SHOW_VIEW_PRIV (index 14) did — an older FE ignores the unknown bit; granting the privilege before all FEs are upgraded means older followers won't honor it until upgraded.
Tests: grant → self-RETAIN works without GRANT; revoke → rejected; other-account clauses still require GRANT.
Happy to implement this — it falls out of the #66115 review discussion with @CalvinKirs, who suggested deferring the fine-grained privilege until someone actually needs the delegation. We do: fleets of read-only service accounts that must rotate on a schedule without a maintenance window and must never hold GRANT.
Use case
Online credential rotation for low-privilege machine identities (BI tools, service accounts) on a stable username: the account rotates its own password with SET PASSWORD ... RETAIN CURRENT PASSWORD under a delegated privilege, consumers converge during the overlap window, and no account-management-capable credential is involved in the loop.
Search before asking
Description
#66115 gates
RETAIN CURRENT PASSWORD/DISCARD OLD PASSWORDbehind the GRANT tier, including on one's own account. That closes the park-a-secondary-password hole, but it also means the only accounts that can rotate themselves with an overlap window are accounts that already hold account-management power — which excludes the population that needs online rotation most: low-privilege machine identities (BI tools, service accounts, AI/MCP integrations) holding a long-lived credential.MySQL's answer is a dedicated dynamic privilege:
APPLICATION_PASSWORD_ADMINauthorizes the dual password clauses on one's own account, so a DBA can delegate exactly "you may rotate yourself with an overlap" and nothing else.Two pieces:
APPLICATION_PASSWORD_ADMIN_PRIV— a new GLOBAL-context entry inPrivilege(index 15; 9–11 are the contaminated legacy indexes, 12–14 are taken). Grantable via the existing grammar (GRANT APPLICATION_PASSWORD_ADMIN_PRIV ON *.*.* TO user— privilege names resolve throughAccessPrivilege.fromName(), no lexer work). The own-account clause checks inSetPassVarOp.validate()/AlterUserInfo.validate()accept it as an alternative to GRANT/ADMIN; clauses on other accounts keep the GRANT tier (MySQL requiresCREATE USERthere, and GRANT is Doris's account-management tier).fe.audit.logkeeps theRETAINclause, but that's forensics, not state). MySQL exposes it inmysql.user.User_attributes. Surface a boolean per account (e.g. inSHOW GRANTSoutput or aninformation_schemacolumn) so operators can find leftovers toDISCARD.How
All FE-side, small surface:
Privilege.java: new enum entry +privilegesmap slot 15 + the notBelongTo* arrays (global-only, like NODE/ADMIN).AccessPrivilege.java: name +toDorisPrivilege()mapping.PrivPredicate: a predicate coveringAPPLICATION_PASSWORD_ADMIN_PRIV | GRANT_PRIV | ADMIN_PRIV, used by the own-account clause checks.PrivBitSetfollows the same forward/backward story asSHOW_VIEW_PRIV(index 14) did — an older FE ignores the unknown bit; granting the privilege before all FEs are upgraded means older followers won't honor it until upgraded.Happy to implement this — it falls out of the #66115 review discussion with @CalvinKirs, who suggested deferring the fine-grained privilege until someone actually needs the delegation. We do: fleets of read-only service accounts that must rotate on a schedule without a maintenance window and must never hold GRANT.
Use case
Online credential rotation for low-privilege machine identities (BI tools, service accounts) on a stable username: the account rotates its own password with
SET PASSWORD ... RETAIN CURRENT PASSWORDunder a delegated privilege, consumers converge during the overlap window, and no account-management-capable credential is involved in the loop.Related issues
#66115 #66113
Are you willing to submit PR?
Code of Conduct