Skip to content

HBASE-30578 Fix null-user ACL failures on master HBCK and Operation Details pages - #8936

Open
jackMintao wants to merge 1 commit into
apache:branch-2.6from
jackMintao:HBASE-30578
Open

jackMintao wants to merge 1 commit into
apache:branch-2.6from
jackMintao:HBASE-30578

Conversation

@jackMintao

Copy link
Copy Markdown

JIRA: https://issues.apache.org/jira/browse/HBASE-30578

Problem

When hbase.security.authorization=true, two master Web UI pages fail:

  • /hbck.jsp (without ?cache=true) shows
    Insufficient permissions for user 'null' (global, action=ADMIN) for both
    runHbckChore and runCatalogScan, and no new report is generated.
  • /operationDetails.jsp returns HTTP 500 with the same
    AccessDeniedException.

Both JSPs call master RPC services in-process. master.getConnection() is a
short-circuit connection, so the JSP Jetty thread has no RpcServer.CurCall;
RSRpcServices.requirePermission therefore checks a null user and denies.

Fix

Keep RSRpcServices.requirePermission unchanged and fix the two pages at the
page boundary:

  • operationDetails.jsp reads BalancerDecision/BalancerRejection directly
    from master.getNamedQueueRecorder(), matching rsOperationDetails.jsp,
    instead of going through Admin#getLogEntries -> MasterRpcServices#getLogEntries.
  • hbck.jsp only calls HbckChore#runChore() and CatalogJanitor#scan()
    when InfoServer.canUserModifyUI() allows the request. Otherwise it shows
    the cached reports with an informational message. This prevents read-only or
    unauthorized UI visitors from triggering writes/metadata GC via a plain GET.

A generic fallback in RSRpcServices.requirePermission was deliberately not
used: it would affect every in-process ADMIN-level RPC, not just these pages.

Tests

  • TestInfoServers#testHbckAndOperationDetailsReadOnly:
    read-only mode shows the informational message and No Report created.
    (proves runChore was skipped), no error/ACL alert;
    /operationDetails.jsp renders.
  • TestInfoServersACL#testHbckPagePermissions:
    with hbase.security.authorization=true (MiniKdc/SPNEGO), the admin gets no
    read-only message, no error alert, no ACL error and a generated report; the
    non-admin gets the read-only/cached-report message; the admin
    /operationDetails.jsp returns HTTP 200 and Operations Details without
    ACL errors. Before this fix it returned HTTP 500 in this environment.
  • JspC precompilation: 0 errors. mvn test-compile: BUILD SUCCESS.
  • Manual verification on HBase 2.6.8-SNAPSHOT / Hadoop 3.4.3 / ACL:
    before, hbck had the two ACL errors and operationDetails was HTTP 500;
    after, both pages are HTTP 200 with no ACL errors, read-only requests do not
    change the CatalogJanitor report time, the authorized test path generates
    reports, and a remote non-superuser is still denied for
    catalogjanitor_run/get_balancer_decisions.

Behavior note

InfoServer.canUserModifyUI() requires hbase.master.ui.readonly=false,
Kerberos UI authentication, hadoop.security.authorization=true, and a UI
administrator. In simple-auth clusters /hbck.jsp no longer auto-triggers
chores; it shows cached reports and points admins to hbck_chore_run /
catalogjanitor_run. This matches the existing table.jsp/snapshot.jsp
read-only behavior and avoids unauthenticated GET-triggered writes.

RSRpcServices is untouched; remote RPC ACL behavior is unchanged.

…etails pages

The master web UI JSPs invoke MasterRpcServices in-process through the
short-circuit connection. Such calls have no RpcServer request user, so
with hbase.security.authorization=true RSRpcServices.requirePermission sees
a null user and denies the request:

  Insufficient permissions for user 'null' (global, action=ADMIN)

This makes /hbck.jsp show errors for runHbckChore/runCatalogScan and makes
/operationDetails.jsp return HTTP 500 for getLogEntries.

Fix the two pages locally instead of widening RSRpcServices.requirePermission
for every in-process ADMIN RPC:

- operationDetails.jsp reads BalancerDecision/BalancerRejection directly from
  master.getNamedQueueRecorder(), like rsOperationDetails.jsp, instead of
  going through Admin#getLogEntries -> MasterRpcServices#getLogEntries.

- hbck.jsp only calls HbckChore#runChore() and CatalogJanitor#scan() when
  InfoServer.canUserModifyUI() allows the request. Otherwise it shows the
  cached reports with an informational message. This prevents arbitrary or
  read-only UI visitors from triggering writes/metadata GC via a GET.

RSRpcServices#requirePermission is deliberately unchanged so remote and
in-process ADMIN RPC authorization is not broadened.
pageContext.setAttribute("pageTitle", "HBase Master HBCK Report: " + master.getServerName());
String hbckChoreErrorMessage = null;
final boolean canModifyUI =
InfoServer.canUserModifyUI(request, getServletContext(), master.getConfiguration());

@hingu-8103 hingu-8103 Nov 26, 2026 •

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.

InfoServer.canUserModifyUI(request, getServletContext(), master.getConfiguration()) needs hbase.security.authentication.ui=kerberos, hadoop.security.authorization=true and hbase.master.ui.readonly=true, and it never reads hbase.security.authorization.

On a default cluster (hbase.security.authorization=false and non-Kerberos UI) the page therefore stops refreshing, and it shows the "read-only or not authorized" message. Today it refreshes, because NoopAccessChecker allows the runHbckChore/runCatalogScan without permission check.

Could we skip the gate when authorization is off: !readonly && (!AccessChecker.isAuthorizationSupported(conf) || InfoServer.canUserModifyUI(...))? Please validate my suggestion before applying it directly.

}
if (cj != null) {
try {
cj.scan();

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.

The gate is the web UI admin list (hbase.security.authentication.spnego.admin.users/.groups), which is separate from HBase's global ADMIN (hbase:acl grants, superusers). cj.scan() garbage-collects merged and split parents, and HBASE-19400 added the ADMIN check on runCatalogScan. With this change a UI admin who has no HBase ADMIN can trigger it from a plain GET. Is that intended?

If not, could we also call master.getAccessChecker().requirePermission(webUser, ..., ADMIN) and show the info message on AccessDeniedException? A test with a UI admin who lacks HBase ADMIN would document either choice.

List<RecentLogs.BalancerRejection> logList = Collections.emptyList();
List<RecentLogs.BalancerDecision> decisionList = Collections.emptyList();
if (master.isInitialized()) {
NamedQueueRecorder namedQueueRecorder = master.getNamedQueueRecorder();

@hingu-8103 hingu-8103 Nov 26, 2026 •

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.

This also drops the ADMIN check that MasterRpcServices.getLogEntries applied to these reads, so the page now returns balancer decisions and rejections (including region plans) without ADMIN check.

Could we keep the same rule for this page, for example by checking ADMIN for the web user and showing an info note to others? If the open read is intended, could that be stated in the PR and split into its own JIRA?

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.

3 participants