Skip to content

branch-4.1: [improvement](auth) Scope mysql.user rows to the caller and mask password columns #67444 - #67474

Open
github-actions[bot] wants to merge 1 commit into
branch-4.1from
auto-pick-67444-branch-4.1
Open

branch-4.1: [improvement](auth) Scope mysql.user rows to the caller and mask password columns #67444#67474
github-actions[bot] wants to merge 1 commit into
branch-4.1from
auto-pick-67444-branch-4.1

Conversation

@github-actions

@github-actions github-actions Bot commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

Cherry-picked from #67444

…word columns (#67444)

### What this PR does

Adjusts what `mysql.user` returns so the visible rows follow the
requesting user's privileges, and keeps password-derived columns out of
the result entirely.

- Rows are now scoped to the caller: role administrators (`ADMIN_PRIV`
or `GRANT_PRIV`) still see every account; other users see only their own
account.
- The `authentication_string` and `password_policy.history_passwords`
columns are always rendered as `***` for every caller, including
accounts with an empty password.

To make row scoping possible, the caller identity is threaded through
`TShowUserRequest` (the same pattern already used by the sibling
schema-table scanners such as `user_privileges` and `processlist`), so
the FE can filter rows. A request without an identity returns no rows.

### Compatibility

- `current_user_ident` is an `optional` Thrift field, wire-compatible in
both directions.
- No metadata / editlog / storage-format change, so downgrade is clean.
- During a rolling window where a new FE talks to an old BE that does
not set the field, `mysql.user` returns no rows (fail-closed) until the
BE is also upgraded; upgrading BE before FE avoids this.

### Tests

- `FrontendServiceImplTest#testShowUser` asserts the administrator,
normal-user, and no-identity behaviors, including that the password
columns are masked.
- `regression-test/suites/auth_p0/test_mysql_user_visibility.groovy`
covers the end-to-end admin-vs-normal-user visibility and masking.
@github-actions
github-actions Bot requested a review from yiguolei as a code owner September 3, 2026 06:57
@hello-stephen

Copy link
Copy Markdown
Contributor

Thank you for your contribution to Apache Doris.
Don't know what should be done next? See How to process your PR.

Please clearly describe your PR:

  1. What problem was fixed (it's best to include specific error reporting information). How it was fixed.
  2. Which behaviors were modified. What was the previous behavior, what is it now, why was it modified, and what possible impacts might there be.
  3. What features were added. Why was this function added?
  4. Which code was refactored and why was this part of the code refactored?
  5. Which functions were optimized and what is the difference before and after the optimization?

@hello-stephen

Copy link
Copy Markdown
Contributor

run buildall

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